Merge lp:~agilebg/account-financial-tools/adding_account_deferred_charge_7 into lp:~account-core-editors/account-financial-tools/7.0

Proposed by Lorenzo Battistini
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
Reviewer Review Type Date Requested Status
Lorenzo Battistini (community) Disapprove
Nicolas Bessi - Camptocamp (community) Disapprove
Review via email: mp+185171@code.launchpad.net

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

To post a comment you must log in.
123. By Lorenzo Battistini

[ADD] i18n - it

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

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

review: Disapprove
Revision history for this message
Lorenzo Battistini (elbati) wrote :

Hello Nicolas, thanks for your review.
I agree the 'deferred charge' requirement can be covered by cutoff modules

review: Disapprove
Revision history for this message
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?

Revision history for this message
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

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

Subscribers

People subscribed via source and target branches