Merge lp:~camptocamp/account-financial-tools/7.0-move-draft-improvements-mdh into lp:~account-core-editors/account-financial-tools/7.0

Proposed by Matthieu Dietrich @ camptocamp
Status: Merged
Merged at revision: 154
Proposed branch: lp:~camptocamp/account-financial-tools/7.0-move-draft-improvements-mdh
Merge into: lp:~account-core-editors/account-financial-tools/7.0
Diff against target: 230 lines (+183/-1)
7 files modified
account_default_draft_move/__openerp__.py (+2/-1)
account_default_draft_move/account_view.xml (+17/-0)
account_move_validation_improvement/__init__.py (+22/-0)
account_move_validation_improvement/__openerp__.py (+35/-0)
account_move_validation_improvement/wizard/__init__.py (+22/-0)
account_move_validation_improvement/wizard/account_validate_move.py (+60/-0)
account_move_validation_improvement/wizard/account_validate_move_view.xml (+25/-0)
To merge this branch: bzr merge lp:~camptocamp/account-financial-tools/7.0-move-draft-improvements-mdh
Reviewer Review Type Date Requested Status
Frederic Clementi - Camptocamp (community) functional Approve
Guewen Baconnier @ Camptocamp Approve
Review via email: mp+201359@code.launchpad.net

Commit message

[IMP] removed buttons for posting/unposting entries.
[ADD] modified wizard for posting multiple entries.

Description of the change

A few changes for draft moves:
- in account_default_draft_move: change an eval field in the invoice view (issues when you reinstalled the module), and removed cancel/post buttons in the move's form view.
- new module, account_move_validation_improvement, re-defining the "Post Journal Entries" wizard from account, to use multiple journals/periods.

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) :
review: Approve
Revision history for this message
Frederic Clementi - Camptocamp (frederic-clementi) wrote :

It rocks. :)

review: Approve (functional)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_default_draft_move/__openerp__.py'
2--- account_default_draft_move/__openerp__.py 2013-02-13 10:56:26 +0000
3+++ account_default_draft_move/__openerp__.py 2014-01-13 10:18:25 +0000
4@@ -48,7 +48,8 @@
5
6 """,
7 'website': 'http://www.camptocamp.com',
8- 'data' : ['invoice_view.xml'],
9+ 'data' : ['account_view.xml',
10+ 'invoice_view.xml'],
11 'installable': True,
12 'active': False,
13 }
14
15=== added file 'account_default_draft_move/account_view.xml'
16--- account_default_draft_move/account_view.xml 1970-01-01 00:00:00 +0000
17+++ account_default_draft_move/account_view.xml 2014-01-13 10:18:25 +0000
18@@ -0,0 +1,17 @@
19+<openerp>
20+ <data>
21+
22+ <record id="view_move_form_remove_button" model="ir.ui.view">
23+ <field name="name">account.move.form.remove.button</field>
24+ <field name="model">account.move</field>
25+ <field name="inherit_id" ref="account.view_move_form"/>
26+ <field name="arch" type="xml">
27+ <data>
28+ <button name="button_validate" position="replace"/>
29+ <button name="button_cancel" position="replace"/>
30+ </data>
31+ </field>
32+ </record>
33+
34+ </data>
35+</openerp>
36\ No newline at end of file
37
38=== modified file 'account_default_draft_move/invoice_view.xml'
39=== added directory 'account_move_validation_improvement'
40=== added file 'account_move_validation_improvement/__init__.py'
41--- account_move_validation_improvement/__init__.py 1970-01-01 00:00:00 +0000
42+++ account_move_validation_improvement/__init__.py 2014-01-13 10:18:25 +0000
43@@ -0,0 +1,22 @@
44+# -*- coding: utf-8 -*-
45+##############################################################################
46+#
47+# Author Matthieu Dietrich. Copyright 2012 Camptocamp SA
48+#
49+# This program is free software: you can redistribute it and/or modify
50+# it under the terms of the GNU Affero General Public License as
51+# published by the Free Software Foundation, either version 3 of the
52+# License, or (at your option) any later version.
53+#
54+# This program is distributed in the hope that it will be useful,
55+# but WITHOUT ANY WARRANTY; without even the implied warranty of
56+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57+# GNU Affero General Public License for more details.
58+#
59+# You should have received a copy of the GNU Affero General Public License
60+# along with this program. If not, see <http://www.gnu.org/licenses/>.
61+#
62+##############################################################################
63+
64+from . import wizard
65+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
66\ No newline at end of file
67
68=== added file 'account_move_validation_improvement/__openerp__.py'
69--- account_move_validation_improvement/__openerp__.py 1970-01-01 00:00:00 +0000
70+++ account_move_validation_improvement/__openerp__.py 2014-01-13 10:18:25 +0000
71@@ -0,0 +1,35 @@
72+# -*- coding: utf-8 -*-
73+##############################################################################
74+#
75+# Author Vincent Renaville/Joel Grand-Guillaume. Copyright 2012 Camptocamp SA
76+#
77+# This program is free software: you can redistribute it and/or modify
78+# it under the terms of the GNU Affero General Public License as
79+# published by the Free Software Foundation, either version 3 of the
80+# License, or (at your option) any later version.
81+#
82+# This program is distributed in the hope that it will be useful,
83+# but WITHOUT ANY WARRANTY; without even the implied warranty of
84+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
85+# GNU Affero General Public License for more details.
86+#
87+# You should have received a copy of the GNU Affero General Public License
88+# along with this program. If not, see <http://www.gnu.org/licenses/>.
89+##############################################################################
90+{
91+ "name" : "Wizard to validate multiple moves",
92+ "version" : "1.0",
93+ "depends" : ["base", "account", "account_constraints"],
94+ "author" : "Camptocamp",
95+ 'license': 'AGPL-3',
96+ "description": """
97+Re-defining a base wizard (validate all moves in a period for a journal),
98+but extending it to multiple periods and multiple journals. It replaces the
99+base one defined in addons/account/wizard.
100+ """,
101+ 'website': 'http://www.camptocamp.com',
102+ 'data' : ['wizard/account_validate_move_view.xml'],
103+ 'installable': True,
104+ 'active': False,
105+}
106+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
107
108=== added directory 'account_move_validation_improvement/wizard'
109=== added file 'account_move_validation_improvement/wizard/__init__.py'
110--- account_move_validation_improvement/wizard/__init__.py 1970-01-01 00:00:00 +0000
111+++ account_move_validation_improvement/wizard/__init__.py 2014-01-13 10:18:25 +0000
112@@ -0,0 +1,22 @@
113+# -*- coding: utf-8 -*-
114+##############################################################################
115+#
116+# Author Matthieu Dietrich. Copyright 2012 Camptocamp SA
117+#
118+# This program is free software: you can redistribute it and/or modify
119+# it under the terms of the GNU Affero General Public License as
120+# published by the Free Software Foundation, either version 3 of the
121+# License, or (at your option) any later version.
122+#
123+# This program is distributed in the hope that it will be useful,
124+# but WITHOUT ANY WARRANTY; without even the implied warranty of
125+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
126+# GNU Affero General Public License for more details.
127+#
128+# You should have received a copy of the GNU Affero General Public License
129+# along with this program. If not, see <http://www.gnu.org/licenses/>.
130+#
131+##############################################################################
132+
133+from . import account_validate_move
134+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
135\ No newline at end of file
136
137=== added file 'account_move_validation_improvement/wizard/account_validate_move.py'
138--- account_move_validation_improvement/wizard/account_validate_move.py 1970-01-01 00:00:00 +0000
139+++ account_move_validation_improvement/wizard/account_validate_move.py 2014-01-13 10:18:25 +0000
140@@ -0,0 +1,60 @@
141+# -*- coding: utf-8 -*-
142+##############################################################################
143+#
144+# OpenERP, Open Source Management Solution
145+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
146+#
147+# This program is free software: you can redistribute it and/or modify
148+# it under the terms of the GNU Affero General Public License as
149+# published by the Free Software Foundation, either version 3 of the
150+# License, or (at your option) any later version.
151+#
152+# This program is distributed in the hope that it will be useful,
153+# but WITHOUT ANY WARRANTY; without even the implied warranty of
154+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
155+# GNU Affero General Public License for more details.
156+#
157+# You should have received a copy of the GNU Affero General Public License
158+# along with this program. If not, see <http://www.gnu.org/licenses/>.
159+#
160+##############################################################################
161+from openerp.osv import fields, orm, osv
162+from openerp.tools.translate import _
163+
164+
165+class ValidateAccountMove(orm.TransientModel):
166+ _name = "validate.account.move"
167+ _inherit = "validate.account.move"
168+
169+ _columns = {
170+ 'journal_ids': fields.many2many('account.journal', string='Journals',
171+ required=True),
172+ 'period_ids': fields.many2many('account.period', string='Periods',
173+ required=True,
174+ domain=[('state', '<>', 'done')]),
175+ # re-define existing fields as non-mandatory
176+ 'journal_id': fields.many2one('account.journal', 'Journal',
177+ required=False),
178+ 'period_id': fields.many2one('account.period', 'Period',
179+ required=False),
180+ }
181+
182+ def validate_move(self, cr, uid, ids, context=None):
183+ obj_move = self.pool.get('account.move')
184+ if context is None:
185+ context = {}
186+ data = self.browse(cr, uid, ids, context=context)[0]
187+ journal_ids = [journal.id for journal in data.journal_ids]
188+ period_ids = [period.id for period in data.period_ids]
189+ ids_move = obj_move.search(cr, uid, [('state', '=', 'draft'),
190+ ('journal_id', 'in', journal_ids),
191+ ('period_id', '=', period_ids)],
192+ context=context)
193+ if not ids_move:
194+ raise osv.except_osv(_('Warning!'),
195+ ('Specified journal does not have any account move entries in draft state for this period.'))
196+ obj_move.button_validate(cr, uid, ids_move, context=context)
197+ return {'type': 'ir.actions.act_window_close'}
198+
199+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
200+
201
202=== added file 'account_move_validation_improvement/wizard/account_validate_move_view.xml'
203--- account_move_validation_improvement/wizard/account_validate_move_view.xml 1970-01-01 00:00:00 +0000
204+++ account_move_validation_improvement/wizard/account_validate_move_view.xml 2014-01-13 10:18:25 +0000
205@@ -0,0 +1,25 @@
206+<?xml version="1.0" encoding="utf-8"?>
207+<openerp>
208+ <data>
209+
210+ <!--Account Moves-->
211+ <record id="account.validate_account_move_view" model="ir.ui.view">
212+ <field name="name">Post Journal Entries</field>
213+ <field name="model">validate.account.move</field>
214+ <field name="arch" type="xml">
215+ <form string="Post Journal Entries" version="7.0">
216+ <group>
217+ <field name="journal_ids"/>
218+ <field name="period_ids"/>
219+ </group>
220+ <footer>
221+ <button string="Approve" name="validate_move" type="object" class="oe_highlight"/>
222+ or
223+ <button string="Cancel" class="oe_link" special="cancel"/>
224+ </footer>
225+ </form>
226+ </field>
227+ </record>
228+
229+ </data>
230+</openerp>

Subscribers

People subscribed via source and target branches