Merge lp:~agilebg/account-financial-tools/adding_account_deferred_charge_7 into lp:~account-core-editors/account-financial-tools/7.0
- adding_account_deferred_charge_7
- Merge into 7.0
Status: | Rejected |
---|---|
Rejected by: | Guewen Baconnier @ Camptocamp |
Proposed branch: | lp:~agilebg/account-financial-tools/adding_account_deferred_charge_7 |
Merge into: | lp:~account-core-editors/account-financial-tools/7.0 |
Diff against target: |
685 lines (+638/-0) 9 files modified
account_deferred_charge/__init__.py (+23/-0) account_deferred_charge/__openerp__.py (+50/-0) account_deferred_charge/account.py (+112/-0) account_deferred_charge/account_invoice_view.xml (+74/-0) account_deferred_charge/company.py (+39/-0) account_deferred_charge/company_view.xml (+25/-0) account_deferred_charge/i18n/account_deferred_charge.pot (+118/-0) account_deferred_charge/i18n/it.po (+120/-0) account_deferred_charge/test/invoice.yml (+77/-0) |
To merge this branch: | bzr merge lp:~agilebg/account-financial-tools/adding_account_deferred_charge_7 |
Related bugs: | |
Related blueprints: |
Ratei e risconti
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lorenzo Battistini (community) | Disapprove | ||
Nicolas Bessi - Camptocamp (community) | Disapprove | ||
Review via email: mp+185171@code.launchpad.net |
Commit message
Description of the change
This module hanldes invoices with deferred charges.
You have to configure 'Deferred charge journal' in account settings.
In order to generate the deferred charge journal entry, in the invoice line you have to
set the 'Deferred charge account' and the time range of the deferred charge.
Optionally, you can set the 'Reversal date': when the deferred charge move has
to be reverted
- 123. By Lorenzo Battistini
-
[ADD] i18n - it
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote : | # |
Lorenzo Battistini (elbati) wrote : | # |
Hello Nicolas, thanks for your review.
I agree the 'deferred charge' requirement can be covered by cutoff modules
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : | # |
> Hello Nicolas, thanks for your review.
> I agree the 'deferred charge' requirement can be covered by cutoff modules
So what are you going to do with this MP?
Lorenzo Battistini (elbati) wrote : | # |
On 11/11/2013 11:33 AM, Guewen Baconnier @ Camptocamp wrote:
>> Hello Nicolas, thanks for your review.
>> I agree the 'deferred charge' requirement can be covered by cutoff modules
> So what are you going to do with this MP?
This MP should be set as rejected, but I can't set that status.
Unmerged revisions
- 123. By Lorenzo Battistini
-
[ADD] i18n - it
- 122. By Lorenzo Battistini
-
[imp] descr
- 121. By Lorenzo Battistini
-
[add] cancel
- 120. By Lorenzo Battistini
-
[fix] test
- 119. By Lorenzo Battistini
-
[fix] timedelta & test
- 118. By Lorenzo Battistini
-
[imp] view
- 117. By Lorenzo Battistini
-
[add] interface
- 116. By Lorenzo Battistini
-
[add] working prototype. no interface. just tests
- 115. By Lorenzo Battistini
-
[imp] test
- 114. By Lorenzo Battistini
-
[add] first draft
Preview Diff
1 | === added directory 'account_deferred_charge' | |||
2 | === added file 'account_deferred_charge/__init__.py' | |||
3 | --- account_deferred_charge/__init__.py 1970-01-01 00:00:00 +0000 | |||
4 | +++ account_deferred_charge/__init__.py 2013-10-22 13:25:12 +0000 | |||
5 | @@ -0,0 +1,23 @@ | |||
6 | 1 | # -*- coding: utf-8 -*- | ||
7 | 2 | ############################################################################## | ||
8 | 3 | # | ||
9 | 4 | # Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) | ||
10 | 5 | # @author Lorenzo Battistini <lorenzo.battistini@agilebg.com> | ||
11 | 6 | # | ||
12 | 7 | # This program is free software: you can redistribute it and/or modify | ||
13 | 8 | # it under the terms of the GNU Affero General Public License as published | ||
14 | 9 | # by the Free Software Foundation, either version 3 of the License, or | ||
15 | 10 | # (at your option) any later version. | ||
16 | 11 | # | ||
17 | 12 | # This program is distributed in the hope that it will be useful, | ||
18 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | 15 | # GNU Affero General Public License for more details. | ||
21 | 16 | # | ||
22 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
23 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
24 | 19 | # | ||
25 | 20 | ############################################################################## | ||
26 | 21 | |||
27 | 22 | import account | ||
28 | 23 | import company | ||
29 | 0 | 24 | ||
30 | === added file 'account_deferred_charge/__openerp__.py' | |||
31 | --- account_deferred_charge/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
32 | +++ account_deferred_charge/__openerp__.py 2013-10-22 13:25:12 +0000 | |||
33 | @@ -0,0 +1,50 @@ | |||
34 | 1 | # -*- coding: utf-8 -*- | ||
35 | 2 | ############################################################################## | ||
36 | 3 | # | ||
37 | 4 | # Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) | ||
38 | 5 | # @author Lorenzo Battistini <lorenzo.battistini@agilebg.com> | ||
39 | 6 | # | ||
40 | 7 | # This program is free software: you can redistribute it and/or modify | ||
41 | 8 | # it under the terms of the GNU Affero General Public License as published | ||
42 | 9 | # by the Free Software Foundation, either version 3 of the License, or | ||
43 | 10 | # (at your option) any later version. | ||
44 | 11 | # | ||
45 | 12 | # This program is distributed in the hope that it will be useful, | ||
46 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
47 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
48 | 15 | # GNU Affero General Public License for more details. | ||
49 | 16 | # | ||
50 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
51 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
52 | 19 | # | ||
53 | 20 | ############################################################################## | ||
54 | 21 | |||
55 | 22 | { | ||
56 | 23 | 'name': "Deferred charged invoices", | ||
57 | 24 | 'version': '0.1', | ||
58 | 25 | 'category' : 'Accounting & Finance', | ||
59 | 26 | 'description': """ | ||
60 | 27 | This module hanldes invoices with deferred charges. | ||
61 | 28 | |||
62 | 29 | You have to configure 'Deferred charge journal' in account settings. | ||
63 | 30 | |||
64 | 31 | In order to generate the deferred charge journal entry, in the invoice line you have to | ||
65 | 32 | set the 'Deferred charge account' and the time range of the deferred charge. | ||
66 | 33 | Optionally, you can set the 'Reversal date': when the deferred charge move has | ||
67 | 34 | to be reverted. | ||
68 | 35 | """, | ||
69 | 36 | 'author': 'Agile Business Group', | ||
70 | 37 | 'website': 'http://www.agilebg.com', | ||
71 | 38 | 'license': 'AGPL-3', | ||
72 | 39 | "depends" : ['account_reversal'], | ||
73 | 40 | "data" : [ | ||
74 | 41 | 'company_view.xml', | ||
75 | 42 | 'account_invoice_view.xml', | ||
76 | 43 | ], | ||
77 | 44 | "demo" : [], | ||
78 | 45 | "test": [ | ||
79 | 46 | 'test/invoice.yml', | ||
80 | 47 | ], | ||
81 | 48 | "active": False, | ||
82 | 49 | "installable": True | ||
83 | 50 | } | ||
84 | 0 | 51 | ||
85 | === added file 'account_deferred_charge/account.py' | |||
86 | --- account_deferred_charge/account.py 1970-01-01 00:00:00 +0000 | |||
87 | +++ account_deferred_charge/account.py 2013-10-22 13:25:12 +0000 | |||
88 | @@ -0,0 +1,112 @@ | |||
89 | 1 | # -*- coding: utf-8 -*- | ||
90 | 2 | ############################################################################## | ||
91 | 3 | # | ||
92 | 4 | # Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) | ||
93 | 5 | # @author Lorenzo Battistini <lorenzo.battistini@agilebg.com> | ||
94 | 6 | # | ||
95 | 7 | # This program is free software: you can redistribute it and/or modify | ||
96 | 8 | # it under the terms of the GNU Affero General Public License as published | ||
97 | 9 | # by the Free Software Foundation, either version 3 of the License, or | ||
98 | 10 | # (at your option) any later version. | ||
99 | 11 | # | ||
100 | 12 | # This program is distributed in the hope that it will be useful, | ||
101 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
102 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
103 | 15 | # GNU Affero General Public License for more details. | ||
104 | 16 | # | ||
105 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
106 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
107 | 19 | # | ||
108 | 20 | ############################################################################## | ||
109 | 21 | |||
110 | 22 | from __future__ import division | ||
111 | 23 | from openerp.osv import fields, orm | ||
112 | 24 | from datetime import datetime | ||
113 | 25 | from openerp.tools import DEFAULT_SERVER_DATE_FORMAT | ||
114 | 26 | from openerp.tools.translate import _ | ||
115 | 27 | |||
116 | 28 | class account_invoice(orm.Model): | ||
117 | 29 | |||
118 | 30 | _inherit = "account.invoice" | ||
119 | 31 | |||
120 | 32 | _columns = { | ||
121 | 33 | 'deferred_charge_move_ids': fields.many2many('account.move', | ||
122 | 34 | 'invoice_deferred_charge_move_ids_rel', 'invoice_id', 'move_id', | ||
123 | 35 | 'Deferred charge Entries', readonly=True), | ||
124 | 36 | } | ||
125 | 37 | |||
126 | 38 | def action_move_create(self, cr, uid, ids, context=None): | ||
127 | 39 | move_obj = self.pool.get('account.move') | ||
128 | 40 | res = super(account_invoice,self).action_move_create(cr, uid, ids, context=context) | ||
129 | 41 | for invoice in self.browse(cr, uid, ids, context): | ||
130 | 42 | for inv_line in invoice.invoice_line: | ||
131 | 43 | if inv_line.deferrede_charge: | ||
132 | 44 | if not invoice.company_id.deferred_charge_journal_id: | ||
133 | 45 | raise orm.except_orm(_('Error'), | ||
134 | 46 | _('No deferred charge journal configured in accounting settings')) | ||
135 | 47 | if (not inv_line.deferred_charge_account_id | ||
136 | 48 | or not inv_line.deferred_charge_from | ||
137 | 49 | or not inv_line.deferred_charge_to): | ||
138 | 50 | raise orm.except_orm(_('Error'), _('Missing deferred charge data')) | ||
139 | 51 | date_from = datetime.strptime(inv_line.deferred_charge_from, | ||
140 | 52 | DEFAULT_SERVER_DATE_FORMAT) | ||
141 | 53 | date_to = datetime.strptime(inv_line.deferred_charge_to, | ||
142 | 54 | DEFAULT_SERVER_DATE_FORMAT) | ||
143 | 55 | if date_from.year == date_to.year: | ||
144 | 56 | raise orm.except_orm(_('Error'), | ||
145 | 57 | _('Deferred charge: start date and end are on the same year')) | ||
146 | 58 | total_delta = date_to - date_from | ||
147 | 59 | current_year_delta = datetime(date_from.year, 12, 31) - date_from | ||
148 | 60 | current_year_amount = inv_line.price_subtotal * ( | ||
149 | 61 | current_year_delta.days / total_delta.days) | ||
150 | 62 | next_year_amount = inv_line.price_subtotal - current_year_amount | ||
151 | 63 | move_vals = { | ||
152 | 64 | 'period_id': invoice.move_id.period_id.id, | ||
153 | 65 | 'journal_id': invoice.company_id.deferred_charge_journal_id.id, | ||
154 | 66 | 'date': invoice.move_id.date, | ||
155 | 67 | 'line_id': [ | ||
156 | 68 | (0,0, { | ||
157 | 69 | 'name': _("Deferred charge") + ': ' + inv_line.name, | ||
158 | 70 | 'account_id': inv_line.account_id.id, | ||
159 | 71 | 'credit': next_year_amount, | ||
160 | 72 | 'debit': 0.0, | ||
161 | 73 | }), | ||
162 | 74 | (0,0, { | ||
163 | 75 | 'name': _("Deferred charge") + ': ' + inv_line.name, | ||
164 | 76 | 'account_id': inv_line.deferred_charge_account_id.id, | ||
165 | 77 | 'debit': next_year_amount, | ||
166 | 78 | 'credit': 0.0, | ||
167 | 79 | }), | ||
168 | 80 | ], | ||
169 | 81 | } | ||
170 | 82 | move_id = move_obj.create(cr, uid, move_vals, context=context) | ||
171 | 83 | invoice.write({ | ||
172 | 84 | 'deferred_charge_move_ids': [ | ||
173 | 85 | (4, move_id), | ||
174 | 86 | ], | ||
175 | 87 | }, context=context) | ||
176 | 88 | |||
177 | 89 | if inv_line.reversal_date: | ||
178 | 90 | move_obj.create_reversals(cr, uid, [move_id], inv_line.reversal_date) | ||
179 | 91 | return res | ||
180 | 92 | |||
181 | 93 | def action_cancel(self, cr, uid, ids, context=None): | ||
182 | 94 | res = super(account_invoice,self).action_cancel(cr, uid, ids, context=context) | ||
183 | 95 | account_move_obj = self.pool.get('account.move') | ||
184 | 96 | for inv in self.browse(cr, uid, ids, context): | ||
185 | 97 | for move in inv.deferred_charge_move_ids: | ||
186 | 98 | account_move_obj.button_cancel(cr, uid, [move.id], context=context) | ||
187 | 99 | account_move_obj.unlink(cr, uid, [move.id], context=context) | ||
188 | 100 | return res | ||
189 | 101 | |||
190 | 102 | class account_invoice_line(orm.Model): | ||
191 | 103 | _inherit = 'account.invoice.line' | ||
192 | 104 | |||
193 | 105 | _columns = { | ||
194 | 106 | 'deferrede_charge': fields.boolean('Deferred charge'), | ||
195 | 107 | 'deferred_charge_account_id': fields.many2one('account.account', | ||
196 | 108 | 'Deferred charge account'), | ||
197 | 109 | 'deferred_charge_from': fields.date('Deferred charge from date'), | ||
198 | 110 | 'deferred_charge_to': fields.date('Deferred charge to date'), | ||
199 | 111 | 'reversal_date': fields.date('Reversal date'), | ||
200 | 112 | } | ||
201 | 0 | 113 | ||
202 | === added file 'account_deferred_charge/account_invoice_view.xml' | |||
203 | --- account_deferred_charge/account_invoice_view.xml 1970-01-01 00:00:00 +0000 | |||
204 | +++ account_deferred_charge/account_invoice_view.xml 2013-10-22 13:25:12 +0000 | |||
205 | @@ -0,0 +1,74 @@ | |||
206 | 1 | <?xml version="1.0"?> | ||
207 | 2 | <openerp> | ||
208 | 3 | <data> | ||
209 | 4 | <record model="ir.ui.view" id="invoice_form_deferred_charge_1"> | ||
210 | 5 | <field name="name">account.invoice.form.editable</field> | ||
211 | 6 | <field name="model">account.invoice</field> | ||
212 | 7 | <field name="inherit_id" ref="account.invoice_form"/> | ||
213 | 8 | <field name="arch" type="xml"> | ||
214 | 9 | <xpath expr="//field[@name='invoice_line']/tree" position="attributes" > | ||
215 | 10 | <attribute name="editable" eval="False"/> | ||
216 | 11 | </xpath> | ||
217 | 12 | </field> | ||
218 | 13 | </record> | ||
219 | 14 | |||
220 | 15 | <record model="ir.ui.view" id="invoice_form_deferred_charge_1b"> | ||
221 | 16 | <field name="name">account.invoice.form.supplier.editable</field> | ||
222 | 17 | <field name="model">account.invoice</field> | ||
223 | 18 | <field name="inherit_id" ref="account.invoice_supplier_form"/> | ||
224 | 19 | <field name="arch" type="xml"> | ||
225 | 20 | <xpath expr="//field[@name='invoice_line']/tree" position="attributes" > | ||
226 | 21 | <attribute name="editable" eval="False"/> | ||
227 | 22 | </xpath> | ||
228 | 23 | </field> | ||
229 | 24 | </record> | ||
230 | 25 | |||
231 | 26 | <record model="ir.ui.view" id="invoice_form_deferred_charge_moves"> | ||
232 | 27 | <field name="name">account.invoice.form.add.moves</field> | ||
233 | 28 | <field name="model">account.invoice</field> | ||
234 | 29 | <field name="inherit_id" ref="account.invoice_form"/> | ||
235 | 30 | <field name="arch" type="xml"> | ||
236 | 31 | <page string="Payments" position="after" > | ||
237 | 32 | <page string="Deferred moves" > | ||
238 | 33 | <field name="deferred_charge_move_ids" /> | ||
239 | 34 | </page> | ||
240 | 35 | </page> | ||
241 | 36 | </field> | ||
242 | 37 | </record> | ||
243 | 38 | |||
244 | 39 | <!-- attrs not working. bug? | ||
245 | 40 | --> | ||
246 | 41 | <record model="ir.ui.view" id="invoice_form_deferred_charge_supplier_moves"> | ||
247 | 42 | <field name="name">account.invoice.form.add.supplier.moves</field> | ||
248 | 43 | <field name="model">account.invoice</field> | ||
249 | 44 | <field name="inherit_id" ref="account.invoice_supplier_form"/> | ||
250 | 45 | <field name="arch" type="xml"> | ||
251 | 46 | <page string="Payments" position="after" > | ||
252 | 47 | <page string="Deferred moves" attrs="{'invisible': [('payment_ids','=', False)]}"> | ||
253 | 48 | <field name="deferred_charge_move_ids" /> | ||
254 | 49 | </page> | ||
255 | 50 | </page> | ||
256 | 51 | </field> | ||
257 | 52 | </record> | ||
258 | 53 | |||
259 | 54 | <record model="ir.ui.view" id="invoice_form_deferred_charge"> | ||
260 | 55 | <field name="name">account.invoice.form.deferred.charge</field> | ||
261 | 56 | <field name="model">account.invoice.line</field> | ||
262 | 57 | <field name="inherit_id" ref="account.view_invoice_line_form"/> | ||
263 | 58 | <field name="arch" type="xml"> | ||
264 | 59 | <field name="name" position="after"> | ||
265 | 60 | <group> | ||
266 | 61 | <field name="deferrede_charge"/> | ||
267 | 62 | <field name="deferred_charge_account_id" attrs="{'invisible': [('deferrede_charge','=',False)], | ||
268 | 63 | 'required': [('deferrede_charge','=', True)]}"/> | ||
269 | 64 | <field name="deferred_charge_from" attrs="{'invisible': [('deferrede_charge','=',False)], | ||
270 | 65 | 'required': [('deferrede_charge','=', True)]}"/> | ||
271 | 66 | <field name="deferred_charge_to" attrs="{'invisible': [('deferrede_charge','=',False)], | ||
272 | 67 | 'required': [('deferrede_charge','=', True)]}"/> | ||
273 | 68 | <field name="reversal_date" attrs="{'invisible': [('deferrede_charge','=',False)]}"/> | ||
274 | 69 | </group> | ||
275 | 70 | </field> | ||
276 | 71 | </field> | ||
277 | 72 | </record> | ||
278 | 73 | </data> | ||
279 | 74 | </openerp> | ||
280 | 0 | 75 | ||
281 | === added file 'account_deferred_charge/company.py' | |||
282 | --- account_deferred_charge/company.py 1970-01-01 00:00:00 +0000 | |||
283 | +++ account_deferred_charge/company.py 2013-10-22 13:25:12 +0000 | |||
284 | @@ -0,0 +1,39 @@ | |||
285 | 1 | # -*- coding: utf-8 -*- | ||
286 | 2 | ############################################################################## | ||
287 | 3 | # | ||
288 | 4 | # Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) | ||
289 | 5 | # @author Lorenzo Battistini <lorenzo.battistini@agilebg.com> | ||
290 | 6 | # | ||
291 | 7 | # This program is free software: you can redistribute it and/or modify | ||
292 | 8 | # it under the terms of the GNU Affero General Public License as published | ||
293 | 9 | # by the Free Software Foundation, either version 3 of the License, or | ||
294 | 10 | # (at your option) any later version. | ||
295 | 11 | # | ||
296 | 12 | # This program is distributed in the hope that it will be useful, | ||
297 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
298 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
299 | 15 | # GNU Affero General Public License for more details. | ||
300 | 16 | # | ||
301 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
302 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
303 | 19 | # | ||
304 | 20 | ############################################################################## | ||
305 | 21 | |||
306 | 22 | from openerp.osv import fields, orm | ||
307 | 23 | |||
308 | 24 | class res_company(orm.Model): | ||
309 | 25 | _inherit = 'res.company' | ||
310 | 26 | _columns = { | ||
311 | 27 | 'deferred_charge_journal_id': fields.many2one('account.journal', | ||
312 | 28 | 'Deferred charge journal'), | ||
313 | 29 | } | ||
314 | 30 | |||
315 | 31 | class account_config_settings(orm.TransientModel): | ||
316 | 32 | _inherit = 'account.config.settings' | ||
317 | 33 | _columns = { | ||
318 | 34 | 'deferred_charge_journal_id': fields.related( | ||
319 | 35 | 'company_id', 'deferred_charge_journal_id', | ||
320 | 36 | type='many2one', | ||
321 | 37 | relation="account.journal", | ||
322 | 38 | string="Deferred charge journal"), | ||
323 | 39 | } | ||
324 | 0 | 40 | ||
325 | === added file 'account_deferred_charge/company_view.xml' | |||
326 | --- account_deferred_charge/company_view.xml 1970-01-01 00:00:00 +0000 | |||
327 | +++ account_deferred_charge/company_view.xml 2013-10-22 13:25:12 +0000 | |||
328 | @@ -0,0 +1,25 @@ | |||
329 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
330 | 2 | <openerp> | ||
331 | 3 | <data> | ||
332 | 4 | |||
333 | 5 | <record id="view_account_config_settings" model="ir.ui.view"> | ||
334 | 6 | <field name="name">view_account_config_settings</field> | ||
335 | 7 | <field name="model">account.config.settings</field> | ||
336 | 8 | <field name="inherit_id" ref="account.view_account_config_settings"/> | ||
337 | 9 | <field name="arch" type="xml"> | ||
338 | 10 | <xpath expr="/form/group[6]" position="after"> | ||
339 | 11 | <separator string="Deferred charge"/> | ||
340 | 12 | <group name="Deferred charge"> | ||
341 | 13 | <label for="id" string="Configuration"/> | ||
342 | 14 | <div> | ||
343 | 15 | <div> | ||
344 | 16 | <label for="deferred_charge_journal_id"/> | ||
345 | 17 | <field name="deferred_charge_journal_id" class="oe_inline"/> | ||
346 | 18 | </div> | ||
347 | 19 | </div> | ||
348 | 20 | </group> | ||
349 | 21 | </xpath> | ||
350 | 22 | </field> | ||
351 | 23 | </record> | ||
352 | 24 | </data> | ||
353 | 25 | </openerp> | ||
354 | 0 | 26 | ||
355 | === added directory 'account_deferred_charge/i18n' | |||
356 | === added file 'account_deferred_charge/i18n/account_deferred_charge.pot' | |||
357 | --- account_deferred_charge/i18n/account_deferred_charge.pot 1970-01-01 00:00:00 +0000 | |||
358 | +++ account_deferred_charge/i18n/account_deferred_charge.pot 2013-10-22 13:25:12 +0000 | |||
359 | @@ -0,0 +1,118 @@ | |||
360 | 1 | # Translation of OpenERP Server. | ||
361 | 2 | # This file contains the translation of the following modules: | ||
362 | 3 | # * account_deferred_charge | ||
363 | 4 | # | ||
364 | 5 | msgid "" | ||
365 | 6 | msgstr "" | ||
366 | 7 | "Project-Id-Version: OpenERP Server 7.0\n" | ||
367 | 8 | "Report-Msgid-Bugs-To: \n" | ||
368 | 9 | "POT-Creation-Date: 2013-10-22 13:24+0000\n" | ||
369 | 10 | "PO-Revision-Date: 2013-10-22 13:24+0000\n" | ||
370 | 11 | "Last-Translator: <>\n" | ||
371 | 12 | "Language-Team: \n" | ||
372 | 13 | "MIME-Version: 1.0\n" | ||
373 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
374 | 15 | "Content-Transfer-Encoding: \n" | ||
375 | 16 | "Plural-Forms: \n" | ||
376 | 17 | |||
377 | 18 | #. module: account_deferred_charge | ||
378 | 19 | #: code:addons/account_deferred_charge/account.py:46 | ||
379 | 20 | #, python-format | ||
380 | 21 | msgid "No deferred charge journal configured in accounting settings" | ||
381 | 22 | msgstr "" | ||
382 | 23 | |||
383 | 24 | #. module: account_deferred_charge | ||
384 | 25 | #: field:account.invoice.line,deferred_charge_to:0 | ||
385 | 26 | msgid "Deferred charge to date" | ||
386 | 27 | msgstr "" | ||
387 | 28 | |||
388 | 29 | #. module: account_deferred_charge | ||
389 | 30 | #: model:ir.model,name:account_deferred_charge.model_account_invoice | ||
390 | 31 | msgid "Invoice" | ||
391 | 32 | msgstr "" | ||
392 | 33 | |||
393 | 34 | #. module: account_deferred_charge | ||
394 | 35 | #: model:ir.model,name:account_deferred_charge.model_account_config_settings | ||
395 | 36 | msgid "account.config.settings" | ||
396 | 37 | msgstr "" | ||
397 | 38 | |||
398 | 39 | #. module: account_deferred_charge | ||
399 | 40 | #: code:addons/account_deferred_charge/account.py:50 | ||
400 | 41 | #, python-format | ||
401 | 42 | msgid "Missing deferred charge data" | ||
402 | 43 | msgstr "" | ||
403 | 44 | |||
404 | 45 | #. module: account_deferred_charge | ||
405 | 46 | #: model:ir.model,name:account_deferred_charge.model_res_company | ||
406 | 47 | msgid "Companies" | ||
407 | 48 | msgstr "" | ||
408 | 49 | |||
409 | 50 | #. module: account_deferred_charge | ||
410 | 51 | #: model:ir.model,name:account_deferred_charge.model_account_invoice_line | ||
411 | 52 | msgid "Invoice Line" | ||
412 | 53 | msgstr "" | ||
413 | 54 | |||
414 | 55 | #. module: account_deferred_charge | ||
415 | 56 | #: code:addons/account_deferred_charge/account.py:57 | ||
416 | 57 | #, python-format | ||
417 | 58 | msgid "Deferred charge: start date and end are on the same year" | ||
418 | 59 | msgstr "" | ||
419 | 60 | |||
420 | 61 | #. module: account_deferred_charge | ||
421 | 62 | #: view:account.invoice:0 | ||
422 | 63 | msgid "Deferred moves" | ||
423 | 64 | msgstr "" | ||
424 | 65 | |||
425 | 66 | #. module: account_deferred_charge | ||
426 | 67 | #: view:account.config.settings:0 | ||
427 | 68 | #: field:account.invoice.line,deferrede_charge:0 | ||
428 | 69 | #: code:addons/account_deferred_charge/account.py:69 | ||
429 | 70 | #: code:addons/account_deferred_charge/account.py:75 | ||
430 | 71 | #, python-format | ||
431 | 72 | msgid "Deferred charge" | ||
432 | 73 | msgstr "" | ||
433 | 74 | |||
434 | 75 | #. module: account_deferred_charge | ||
435 | 76 | #: field:account.invoice.line,deferred_charge_account_id:0 | ||
436 | 77 | msgid "Deferred charge account" | ||
437 | 78 | msgstr "" | ||
438 | 79 | |||
439 | 80 | #. module: account_deferred_charge | ||
440 | 81 | #: field:account.invoice.line,reversal_date:0 | ||
441 | 82 | msgid "Reversal date" | ||
442 | 83 | msgstr "" | ||
443 | 84 | |||
444 | 85 | #. module: account_deferred_charge | ||
445 | 86 | #: view:account.invoice:0 | ||
446 | 87 | msgid "Payments" | ||
447 | 88 | msgstr "" | ||
448 | 89 | |||
449 | 90 | #. module: account_deferred_charge | ||
450 | 91 | #: field:account.invoice.line,deferred_charge_from:0 | ||
451 | 92 | msgid "Deferred charge from date" | ||
452 | 93 | msgstr "" | ||
453 | 94 | |||
454 | 95 | #. module: account_deferred_charge | ||
455 | 96 | #: code:addons/account_deferred_charge/account.py:45 | ||
456 | 97 | #: code:addons/account_deferred_charge/account.py:50 | ||
457 | 98 | #: code:addons/account_deferred_charge/account.py:56 | ||
458 | 99 | #, python-format | ||
459 | 100 | msgid "Error" | ||
460 | 101 | msgstr "" | ||
461 | 102 | |||
462 | 103 | #. module: account_deferred_charge | ||
463 | 104 | #: field:account.invoice,deferred_charge_move_ids:0 | ||
464 | 105 | msgid "Deferred charge Entries" | ||
465 | 106 | msgstr "" | ||
466 | 107 | |||
467 | 108 | #. module: account_deferred_charge | ||
468 | 109 | #: view:account.config.settings:0 | ||
469 | 110 | msgid "Configuration" | ||
470 | 111 | msgstr "" | ||
471 | 112 | |||
472 | 113 | #. module: account_deferred_charge | ||
473 | 114 | #: field:account.config.settings,deferred_charge_journal_id:0 | ||
474 | 115 | #: field:res.company,deferred_charge_journal_id:0 | ||
475 | 116 | msgid "Deferred charge journal" | ||
476 | 117 | msgstr "" | ||
477 | 118 | |||
478 | 0 | 119 | ||
479 | === added file 'account_deferred_charge/i18n/it.po' | |||
480 | --- account_deferred_charge/i18n/it.po 1970-01-01 00:00:00 +0000 | |||
481 | +++ account_deferred_charge/i18n/it.po 2013-10-22 13:25:12 +0000 | |||
482 | @@ -0,0 +1,120 @@ | |||
483 | 1 | # Translation of OpenERP Server. | ||
484 | 2 | # This file contains the translation of the following modules: | ||
485 | 3 | # * account_deferred_charge | ||
486 | 4 | # | ||
487 | 5 | msgid "" | ||
488 | 6 | msgstr "" | ||
489 | 7 | "Project-Id-Version: OpenERP Server 7.0\n" | ||
490 | 8 | "Report-Msgid-Bugs-To: \n" | ||
491 | 9 | "POT-Creation-Date: 2013-10-22 12:43+0000\n" | ||
492 | 10 | "PO-Revision-Date: 2013-10-22 15:23+0100\n" | ||
493 | 11 | "Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n" | ||
494 | 12 | "Language-Team: \n" | ||
495 | 13 | "MIME-Version: 1.0\n" | ||
496 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
497 | 15 | "Content-Transfer-Encoding: 8bit\n" | ||
498 | 16 | "Plural-Forms: \n" | ||
499 | 17 | "X-Generator: Poedit 1.5.4\n" | ||
500 | 18 | |||
501 | 19 | #. module: account_deferred_charge | ||
502 | 20 | #: code:addons/account_deferred_charge/account.py:46 | ||
503 | 21 | #, python-format | ||
504 | 22 | msgid "No deferred charge journal configured in accounting settings" | ||
505 | 23 | msgstr "" | ||
506 | 24 | "Nessun sezionale di ratei/risconti configurato nelle impostazioni della " | ||
507 | 25 | "contabilità" | ||
508 | 26 | |||
509 | 27 | #. module: account_deferred_charge | ||
510 | 28 | #: field:account.invoice.line,deferred_charge_to:0 | ||
511 | 29 | msgid "Deferred charge to date" | ||
512 | 30 | msgstr "Alla data" | ||
513 | 31 | |||
514 | 32 | #. module: account_deferred_charge | ||
515 | 33 | #: model:ir.model,name:account_deferred_charge.model_account_invoice | ||
516 | 34 | msgid "Invoice" | ||
517 | 35 | msgstr "Fattura" | ||
518 | 36 | |||
519 | 37 | #. module: account_deferred_charge | ||
520 | 38 | #: model:ir.model,name:account_deferred_charge.model_account_config_settings | ||
521 | 39 | msgid "account.config.settings" | ||
522 | 40 | msgstr "account.config.settings" | ||
523 | 41 | |||
524 | 42 | #. module: account_deferred_charge | ||
525 | 43 | #: code:addons/account_deferred_charge/account.py:50 | ||
526 | 44 | #, python-format | ||
527 | 45 | msgid "Missing deferred charge data" | ||
528 | 46 | msgstr "Mancano i dati per il rateo/risconto" | ||
529 | 47 | |||
530 | 48 | #. module: account_deferred_charge | ||
531 | 49 | #: model:ir.model,name:account_deferred_charge.model_res_company | ||
532 | 50 | msgid "Companies" | ||
533 | 51 | msgstr "Aziende" | ||
534 | 52 | |||
535 | 53 | #. module: account_deferred_charge | ||
536 | 54 | #: model:ir.model,name:account_deferred_charge.model_account_invoice_line | ||
537 | 55 | msgid "Invoice Line" | ||
538 | 56 | msgstr "Righe Fattura" | ||
539 | 57 | |||
540 | 58 | #. module: account_deferred_charge | ||
541 | 59 | #: code:addons/account_deferred_charge/account.py:57 | ||
542 | 60 | #, python-format | ||
543 | 61 | msgid "Deferred charge: start date and end are on the same year" | ||
544 | 62 | msgstr "Rateo/risconto: data inizio e data fine sono nello stesso anno" | ||
545 | 63 | |||
546 | 64 | #. module: account_deferred_charge | ||
547 | 65 | #: view:account.invoice:0 | ||
548 | 66 | msgid "Deferred moves" | ||
549 | 67 | msgstr "Registrazioni contabili ratei/risconti" | ||
550 | 68 | |||
551 | 69 | #. module: account_deferred_charge | ||
552 | 70 | #: view:account.config.settings:0 | ||
553 | 71 | #: field:account.invoice.line,deferrede_charge:0 | ||
554 | 72 | #: code:addons/account_deferred_charge/account.py:69 | ||
555 | 73 | #: code:addons/account_deferred_charge/account.py:75 | ||
556 | 74 | #, python-format | ||
557 | 75 | msgid "Deferred charge" | ||
558 | 76 | msgstr "Rateo/risconto" | ||
559 | 77 | |||
560 | 78 | #. module: account_deferred_charge | ||
561 | 79 | #: field:account.invoice.line,deferred_charge_account_id:0 | ||
562 | 80 | msgid "Deferred charge account" | ||
563 | 81 | msgstr "Conto rateo/risconto" | ||
564 | 82 | |||
565 | 83 | #. module: account_deferred_charge | ||
566 | 84 | #: field:account.invoice.line,reversal_date:0 | ||
567 | 85 | msgid "Reversal date" | ||
568 | 86 | msgstr "Data di storno" | ||
569 | 87 | |||
570 | 88 | #. module: account_deferred_charge | ||
571 | 89 | #: view:account.invoice:0 | ||
572 | 90 | msgid "Payments" | ||
573 | 91 | msgstr "Pagamenti" | ||
574 | 92 | |||
575 | 93 | #. module: account_deferred_charge | ||
576 | 94 | #: field:account.invoice.line,deferred_charge_from:0 | ||
577 | 95 | msgid "Deferred charge from date" | ||
578 | 96 | msgstr "Dalla data" | ||
579 | 97 | |||
580 | 98 | #. module: account_deferred_charge | ||
581 | 99 | #: code:addons/account_deferred_charge/account.py:45 | ||
582 | 100 | #: code:addons/account_deferred_charge/account.py:50 | ||
583 | 101 | #: code:addons/account_deferred_charge/account.py:56 | ||
584 | 102 | #, python-format | ||
585 | 103 | msgid "Error" | ||
586 | 104 | msgstr "Errore" | ||
587 | 105 | |||
588 | 106 | #. module: account_deferred_charge | ||
589 | 107 | #: field:account.invoice,deferred_charge_move_ids:0 | ||
590 | 108 | msgid "Deferred charge Entries" | ||
591 | 109 | msgstr "Registrazioni contabili ratei/risconti" | ||
592 | 110 | |||
593 | 111 | #. module: account_deferred_charge | ||
594 | 112 | #: view:account.config.settings:0 | ||
595 | 113 | msgid "Configuration" | ||
596 | 114 | msgstr "Configurazione" | ||
597 | 115 | |||
598 | 116 | #. module: account_deferred_charge | ||
599 | 117 | #: field:account.config.settings,deferred_charge_journal_id:0 | ||
600 | 118 | #: field:res.company,deferred_charge_journal_id:0 | ||
601 | 119 | msgid "Deferred charge journal" | ||
602 | 120 | msgstr "Sezionale ratei/risconti" | ||
603 | 0 | 121 | ||
604 | === added directory 'account_deferred_charge/test' | |||
605 | === added file 'account_deferred_charge/test/invoice.yml' | |||
606 | --- account_deferred_charge/test/invoice.yml 1970-01-01 00:00:00 +0000 | |||
607 | +++ account_deferred_charge/test/invoice.yml 2013-10-22 13:25:12 +0000 | |||
608 | @@ -0,0 +1,77 @@ | |||
609 | 1 | - | ||
610 | 2 | I create next year | ||
611 | 3 | - | ||
612 | 4 | !record {model: account.fiscalyear, id: next_year}: | ||
613 | 5 | name: 'next year' | ||
614 | 6 | code: 'next year' | ||
615 | 7 | date_start: !eval "'%s-01-01'% (datetime.now().year+1)" | ||
616 | 8 | date_stop: !eval "'%s-12-31'% (datetime.now().year+1)" | ||
617 | 9 | - | ||
618 | 10 | I create periods | ||
619 | 11 | - | ||
620 | 12 | !python {model: account.fiscalyear}: | | ||
621 | 13 | self.create_period(cr, uid, [ref('next_year')]) | ||
622 | 14 | - | ||
623 | 15 | I configure deferred charge journal | ||
624 | 16 | - | ||
625 | 17 | !record {model: res.company, id: base.main_company}: | ||
626 | 18 | deferred_charge_journal_id: account.expenses_journal | ||
627 | 19 | - | ||
628 | 20 | I create a supplier invoice | ||
629 | 21 | - | ||
630 | 22 | !record {model: account.invoice, id: account_invoice_supplier0, view: account.invoice_supplier_form}: | ||
631 | 23 | account_id: account.a_pay | ||
632 | 24 | check_total: 1200 | ||
633 | 25 | company_id: base.main_company | ||
634 | 26 | currency_id: base.EUR | ||
635 | 27 | invoice_line: | ||
636 | 28 | - account_id: account.a_expense | ||
637 | 29 | name: 'Insurance' | ||
638 | 30 | price_unit: 1200 | ||
639 | 31 | quantity: 1 | ||
640 | 32 | uos_id: product.product_uom_unit | ||
641 | 33 | deferred_charge_from: !eval "'%s-12-01'% (datetime.now().year)" | ||
642 | 34 | deferred_charge_to: !eval "'%s-11-30'% (datetime.now().year+1)" | ||
643 | 35 | deferred_charge_account_id: account.stk | ||
644 | 36 | reversal_date: !eval "'%s-01-01'% (datetime.now().year+1)" | ||
645 | 37 | deferrede_charge: True | ||
646 | 38 | journal_id: account.expenses_journal | ||
647 | 39 | partner_id: base.res_partner_12 | ||
648 | 40 | type: in_invoice | ||
649 | 41 | - | ||
650 | 42 | I check that Initially supplier invoice state is "Draft" | ||
651 | 43 | - | ||
652 | 44 | !assert {model: account.invoice, id: account_invoice_supplier0}: | ||
653 | 45 | - state == 'draft' | ||
654 | 46 | - | ||
655 | 47 | I change the state of invoice to open by clicking Validate button | ||
656 | 48 | - | ||
657 | 49 | !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier0} | ||
658 | 50 | - | ||
659 | 51 | I check that the invoice state is now "Open" | ||
660 | 52 | - | ||
661 | 53 | !assert {model: account.invoice, id: account_invoice_supplier0}: | ||
662 | 54 | - state == 'open' | ||
663 | 55 | - | ||
664 | 56 | I verify that account move is created | ||
665 | 57 | - | ||
666 | 58 | !python {model: account.invoice}: | | ||
667 | 59 | from datetime import datetime | ||
668 | 60 | move_obj = self.pool.get('account.move') | ||
669 | 61 | inv = self.browse(cr, uid, ref('account_invoice_supplier0')) | ||
670 | 62 | move = inv.move_id | ||
671 | 63 | get_period = move_obj._get_period(cr, uid, {'lang': u'en_US', 'active_model': 'ir.ui.menu', | ||
672 | 64 | 'active_ids': [ref('account.menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('account.menu_action_move_journal_line_form')}) | ||
673 | 65 | amt = move_obj._search_amount(cr, uid, move_obj, 'amount', [('amount', '=', 1200.0)], {'lang': u'en_US', 'active_model': 'ir.ui.menu', | ||
674 | 66 | 'active_ids': [ref('account.menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('account.menu_action_move_journal_line_form')}) | ||
675 | 67 | ids = amt[0][2] | ||
676 | 68 | amt_compute = move_obj._amount_compute(cr, uid, list(ids), 'amount', None, {'lang': u'en_US', 'active_model': 'ir.ui.menu', | ||
677 | 69 | 'active_ids': [ref('account.menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('account.menu_action_move_journal_line_form')}, where ='') | ||
678 | 70 | move_amount = amt_compute.values() | ||
679 | 71 | assert(inv.move_id and move.period_id.id == get_period and move_amount[0] == 1200.0), ('Journal Entries has not been created') | ||
680 | 72 | assert (inv.deferred_charge_move_ids) , 'No deferred charge move generated' | ||
681 | 73 | if inv.deferred_charge_move_ids: | ||
682 | 74 | for move_line in inv.deferred_charge_move_ids[0].line_id: | ||
683 | 75 | if move_line.account_id.id == ref('account.stk'): | ||
684 | 76 | assert(move_line.debit == 1101.1), 'Wrong deferred charge amount' | ||
685 | 77 | assert (inv.deferred_charge_move_ids[0].reversal_id and inv.deferred_charge_move_ids[0].reversal_id.date == '%s-01-01'% (datetime.now().year+1)), 'Wrong reversal move' |
Hello,
I will put the MP under accout-closing branch.
I also think it is duplicate with lp:~akretion-team/account-closing/70-cutoff-modules that seems to be more complete and manage also stock.
I put it in disapprove state, until situation is cleared (no offence).
Regards
Nicolas