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
=== added directory 'account_deferred_charge'
=== added file 'account_deferred_charge/__init__.py'
--- account_deferred_charge/__init__.py 1970-01-01 00:00:00 +0000
+++ account_deferred_charge/__init__.py 2013-10-22 13:25:12 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
5# @author Lorenzo Battistini <lorenzo.battistini@agilebg.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published
9# by the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import account
23import company
024
=== added file 'account_deferred_charge/__openerp__.py'
--- account_deferred_charge/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_deferred_charge/__openerp__.py 2013-10-22 13:25:12 +0000
@@ -0,0 +1,50 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
5# @author Lorenzo Battistini <lorenzo.battistini@agilebg.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published
9# by the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22{
23 'name': "Deferred charged invoices",
24 'version': '0.1',
25 'category' : 'Accounting & Finance',
26 'description': """
27This module hanldes invoices with deferred charges.
28
29You have to configure 'Deferred charge journal' in account settings.
30
31In order to generate the deferred charge journal entry, in the invoice line you have to
32set the 'Deferred charge account' and the time range of the deferred charge.
33Optionally, you can set the 'Reversal date': when the deferred charge move has
34to be reverted.
35""",
36 'author': 'Agile Business Group',
37 'website': 'http://www.agilebg.com',
38 'license': 'AGPL-3',
39 "depends" : ['account_reversal'],
40 "data" : [
41 'company_view.xml',
42 'account_invoice_view.xml',
43 ],
44 "demo" : [],
45 "test": [
46 'test/invoice.yml',
47 ],
48 "active": False,
49 "installable": True
50}
051
=== added file 'account_deferred_charge/account.py'
--- account_deferred_charge/account.py 1970-01-01 00:00:00 +0000
+++ account_deferred_charge/account.py 2013-10-22 13:25:12 +0000
@@ -0,0 +1,112 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
5# @author Lorenzo Battistini <lorenzo.battistini@agilebg.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published
9# by the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from __future__ import division
23from openerp.osv import fields, orm
24from datetime import datetime
25from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
26from openerp.tools.translate import _
27
28class account_invoice(orm.Model):
29
30 _inherit = "account.invoice"
31
32 _columns = {
33 'deferred_charge_move_ids': fields.many2many('account.move',
34 'invoice_deferred_charge_move_ids_rel', 'invoice_id', 'move_id',
35 'Deferred charge Entries', readonly=True),
36 }
37
38 def action_move_create(self, cr, uid, ids, context=None):
39 move_obj = self.pool.get('account.move')
40 res = super(account_invoice,self).action_move_create(cr, uid, ids, context=context)
41 for invoice in self.browse(cr, uid, ids, context):
42 for inv_line in invoice.invoice_line:
43 if inv_line.deferrede_charge:
44 if not invoice.company_id.deferred_charge_journal_id:
45 raise orm.except_orm(_('Error'),
46 _('No deferred charge journal configured in accounting settings'))
47 if (not inv_line.deferred_charge_account_id
48 or not inv_line.deferred_charge_from
49 or not inv_line.deferred_charge_to):
50 raise orm.except_orm(_('Error'), _('Missing deferred charge data'))
51 date_from = datetime.strptime(inv_line.deferred_charge_from,
52 DEFAULT_SERVER_DATE_FORMAT)
53 date_to = datetime.strptime(inv_line.deferred_charge_to,
54 DEFAULT_SERVER_DATE_FORMAT)
55 if date_from.year == date_to.year:
56 raise orm.except_orm(_('Error'),
57 _('Deferred charge: start date and end are on the same year'))
58 total_delta = date_to - date_from
59 current_year_delta = datetime(date_from.year, 12, 31) - date_from
60 current_year_amount = inv_line.price_subtotal * (
61 current_year_delta.days / total_delta.days)
62 next_year_amount = inv_line.price_subtotal - current_year_amount
63 move_vals = {
64 'period_id': invoice.move_id.period_id.id,
65 'journal_id': invoice.company_id.deferred_charge_journal_id.id,
66 'date': invoice.move_id.date,
67 'line_id': [
68 (0,0, {
69 'name': _("Deferred charge") + ': ' + inv_line.name,
70 'account_id': inv_line.account_id.id,
71 'credit': next_year_amount,
72 'debit': 0.0,
73 }),
74 (0,0, {
75 'name': _("Deferred charge") + ': ' + inv_line.name,
76 'account_id': inv_line.deferred_charge_account_id.id,
77 'debit': next_year_amount,
78 'credit': 0.0,
79 }),
80 ],
81 }
82 move_id = move_obj.create(cr, uid, move_vals, context=context)
83 invoice.write({
84 'deferred_charge_move_ids': [
85 (4, move_id),
86 ],
87 }, context=context)
88
89 if inv_line.reversal_date:
90 move_obj.create_reversals(cr, uid, [move_id], inv_line.reversal_date)
91 return res
92
93 def action_cancel(self, cr, uid, ids, context=None):
94 res = super(account_invoice,self).action_cancel(cr, uid, ids, context=context)
95 account_move_obj = self.pool.get('account.move')
96 for inv in self.browse(cr, uid, ids, context):
97 for move in inv.deferred_charge_move_ids:
98 account_move_obj.button_cancel(cr, uid, [move.id], context=context)
99 account_move_obj.unlink(cr, uid, [move.id], context=context)
100 return res
101
102class account_invoice_line(orm.Model):
103 _inherit = 'account.invoice.line'
104
105 _columns = {
106 'deferrede_charge': fields.boolean('Deferred charge'),
107 'deferred_charge_account_id': fields.many2one('account.account',
108 'Deferred charge account'),
109 'deferred_charge_from': fields.date('Deferred charge from date'),
110 'deferred_charge_to': fields.date('Deferred charge to date'),
111 'reversal_date': fields.date('Reversal date'),
112 }
0113
=== added file 'account_deferred_charge/account_invoice_view.xml'
--- account_deferred_charge/account_invoice_view.xml 1970-01-01 00:00:00 +0000
+++ account_deferred_charge/account_invoice_view.xml 2013-10-22 13:25:12 +0000
@@ -0,0 +1,74 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record model="ir.ui.view" id="invoice_form_deferred_charge_1">
5 <field name="name">account.invoice.form.editable</field>
6 <field name="model">account.invoice</field>
7 <field name="inherit_id" ref="account.invoice_form"/>
8 <field name="arch" type="xml">
9 <xpath expr="//field[@name='invoice_line']/tree" position="attributes" >
10 <attribute name="editable" eval="False"/>
11 </xpath>
12 </field>
13 </record>
14
15 <record model="ir.ui.view" id="invoice_form_deferred_charge_1b">
16 <field name="name">account.invoice.form.supplier.editable</field>
17 <field name="model">account.invoice</field>
18 <field name="inherit_id" ref="account.invoice_supplier_form"/>
19 <field name="arch" type="xml">
20 <xpath expr="//field[@name='invoice_line']/tree" position="attributes" >
21 <attribute name="editable" eval="False"/>
22 </xpath>
23 </field>
24 </record>
25
26 <record model="ir.ui.view" id="invoice_form_deferred_charge_moves">
27 <field name="name">account.invoice.form.add.moves</field>
28 <field name="model">account.invoice</field>
29 <field name="inherit_id" ref="account.invoice_form"/>
30 <field name="arch" type="xml">
31 <page string="Payments" position="after" >
32 <page string="Deferred moves" >
33 <field name="deferred_charge_move_ids" />
34 </page>
35 </page>
36 </field>
37 </record>
38
39 <!-- attrs not working. bug?
40 -->
41 <record model="ir.ui.view" id="invoice_form_deferred_charge_supplier_moves">
42 <field name="name">account.invoice.form.add.supplier.moves</field>
43 <field name="model">account.invoice</field>
44 <field name="inherit_id" ref="account.invoice_supplier_form"/>
45 <field name="arch" type="xml">
46 <page string="Payments" position="after" >
47 <page string="Deferred moves" attrs="{'invisible': [('payment_ids','=', False)]}">
48 <field name="deferred_charge_move_ids" />
49 </page>
50 </page>
51 </field>
52 </record>
53
54 <record model="ir.ui.view" id="invoice_form_deferred_charge">
55 <field name="name">account.invoice.form.deferred.charge</field>
56 <field name="model">account.invoice.line</field>
57 <field name="inherit_id" ref="account.view_invoice_line_form"/>
58 <field name="arch" type="xml">
59 <field name="name" position="after">
60 <group>
61 <field name="deferrede_charge"/>
62 <field name="deferred_charge_account_id" attrs="{'invisible': [('deferrede_charge','=',False)],
63 'required': [('deferrede_charge','=', True)]}"/>
64 <field name="deferred_charge_from" attrs="{'invisible': [('deferrede_charge','=',False)],
65 'required': [('deferrede_charge','=', True)]}"/>
66 <field name="deferred_charge_to" attrs="{'invisible': [('deferrede_charge','=',False)],
67 'required': [('deferrede_charge','=', True)]}"/>
68 <field name="reversal_date" attrs="{'invisible': [('deferrede_charge','=',False)]}"/>
69 </group>
70 </field>
71 </field>
72 </record>
73 </data>
74</openerp>
075
=== added file 'account_deferred_charge/company.py'
--- account_deferred_charge/company.py 1970-01-01 00:00:00 +0000
+++ account_deferred_charge/company.py 2013-10-22 13:25:12 +0000
@@ -0,0 +1,39 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
5# @author Lorenzo Battistini <lorenzo.battistini@agilebg.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published
9# by the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import fields, orm
23
24class res_company(orm.Model):
25 _inherit = 'res.company'
26 _columns = {
27 'deferred_charge_journal_id': fields.many2one('account.journal',
28 'Deferred charge journal'),
29 }
30
31class account_config_settings(orm.TransientModel):
32 _inherit = 'account.config.settings'
33 _columns = {
34 'deferred_charge_journal_id': fields.related(
35 'company_id', 'deferred_charge_journal_id',
36 type='many2one',
37 relation="account.journal",
38 string="Deferred charge journal"),
39 }
040
=== added file 'account_deferred_charge/company_view.xml'
--- account_deferred_charge/company_view.xml 1970-01-01 00:00:00 +0000
+++ account_deferred_charge/company_view.xml 2013-10-22 13:25:12 +0000
@@ -0,0 +1,25 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_account_config_settings" model="ir.ui.view">
6 <field name="name">view_account_config_settings</field>
7 <field name="model">account.config.settings</field>
8 <field name="inherit_id" ref="account.view_account_config_settings"/>
9 <field name="arch" type="xml">
10 <xpath expr="/form/group[6]" position="after">
11 <separator string="Deferred charge"/>
12 <group name="Deferred charge">
13 <label for="id" string="Configuration"/>
14 <div>
15 <div>
16 <label for="deferred_charge_journal_id"/>
17 <field name="deferred_charge_journal_id" class="oe_inline"/>
18 </div>
19 </div>
20 </group>
21 </xpath>
22 </field>
23 </record>
24 </data>
25</openerp>
026
=== added directory 'account_deferred_charge/i18n'
=== added file 'account_deferred_charge/i18n/account_deferred_charge.pot'
--- account_deferred_charge/i18n/account_deferred_charge.pot 1970-01-01 00:00:00 +0000
+++ account_deferred_charge/i18n/account_deferred_charge.pot 2013-10-22 13:25:12 +0000
@@ -0,0 +1,118 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_deferred_charge
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-10-22 13:24+0000\n"
10"PO-Revision-Date: 2013-10-22 13:24+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: account_deferred_charge
19#: code:addons/account_deferred_charge/account.py:46
20#, python-format
21msgid "No deferred charge journal configured in accounting settings"
22msgstr ""
23
24#. module: account_deferred_charge
25#: field:account.invoice.line,deferred_charge_to:0
26msgid "Deferred charge to date"
27msgstr ""
28
29#. module: account_deferred_charge
30#: model:ir.model,name:account_deferred_charge.model_account_invoice
31msgid "Invoice"
32msgstr ""
33
34#. module: account_deferred_charge
35#: model:ir.model,name:account_deferred_charge.model_account_config_settings
36msgid "account.config.settings"
37msgstr ""
38
39#. module: account_deferred_charge
40#: code:addons/account_deferred_charge/account.py:50
41#, python-format
42msgid "Missing deferred charge data"
43msgstr ""
44
45#. module: account_deferred_charge
46#: model:ir.model,name:account_deferred_charge.model_res_company
47msgid "Companies"
48msgstr ""
49
50#. module: account_deferred_charge
51#: model:ir.model,name:account_deferred_charge.model_account_invoice_line
52msgid "Invoice Line"
53msgstr ""
54
55#. module: account_deferred_charge
56#: code:addons/account_deferred_charge/account.py:57
57#, python-format
58msgid "Deferred charge: start date and end are on the same year"
59msgstr ""
60
61#. module: account_deferred_charge
62#: view:account.invoice:0
63msgid "Deferred moves"
64msgstr ""
65
66#. module: account_deferred_charge
67#: view:account.config.settings:0
68#: field:account.invoice.line,deferrede_charge:0
69#: code:addons/account_deferred_charge/account.py:69
70#: code:addons/account_deferred_charge/account.py:75
71#, python-format
72msgid "Deferred charge"
73msgstr ""
74
75#. module: account_deferred_charge
76#: field:account.invoice.line,deferred_charge_account_id:0
77msgid "Deferred charge account"
78msgstr ""
79
80#. module: account_deferred_charge
81#: field:account.invoice.line,reversal_date:0
82msgid "Reversal date"
83msgstr ""
84
85#. module: account_deferred_charge
86#: view:account.invoice:0
87msgid "Payments"
88msgstr ""
89
90#. module: account_deferred_charge
91#: field:account.invoice.line,deferred_charge_from:0
92msgid "Deferred charge from date"
93msgstr ""
94
95#. module: account_deferred_charge
96#: code:addons/account_deferred_charge/account.py:45
97#: code:addons/account_deferred_charge/account.py:50
98#: code:addons/account_deferred_charge/account.py:56
99#, python-format
100msgid "Error"
101msgstr ""
102
103#. module: account_deferred_charge
104#: field:account.invoice,deferred_charge_move_ids:0
105msgid "Deferred charge Entries"
106msgstr ""
107
108#. module: account_deferred_charge
109#: view:account.config.settings:0
110msgid "Configuration"
111msgstr ""
112
113#. module: account_deferred_charge
114#: field:account.config.settings,deferred_charge_journal_id:0
115#: field:res.company,deferred_charge_journal_id:0
116msgid "Deferred charge journal"
117msgstr ""
118
0119
=== added file 'account_deferred_charge/i18n/it.po'
--- account_deferred_charge/i18n/it.po 1970-01-01 00:00:00 +0000
+++ account_deferred_charge/i18n/it.po 2013-10-22 13:25:12 +0000
@@ -0,0 +1,120 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_deferred_charge
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-10-22 12:43+0000\n"
10"PO-Revision-Date: 2013-10-22 15:23+0100\n"
11"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"X-Generator: Poedit 1.5.4\n"
18
19#. module: account_deferred_charge
20#: code:addons/account_deferred_charge/account.py:46
21#, python-format
22msgid "No deferred charge journal configured in accounting settings"
23msgstr ""
24"Nessun sezionale di ratei/risconti configurato nelle impostazioni della "
25"contabilità"
26
27#. module: account_deferred_charge
28#: field:account.invoice.line,deferred_charge_to:0
29msgid "Deferred charge to date"
30msgstr "Alla data"
31
32#. module: account_deferred_charge
33#: model:ir.model,name:account_deferred_charge.model_account_invoice
34msgid "Invoice"
35msgstr "Fattura"
36
37#. module: account_deferred_charge
38#: model:ir.model,name:account_deferred_charge.model_account_config_settings
39msgid "account.config.settings"
40msgstr "account.config.settings"
41
42#. module: account_deferred_charge
43#: code:addons/account_deferred_charge/account.py:50
44#, python-format
45msgid "Missing deferred charge data"
46msgstr "Mancano i dati per il rateo/risconto"
47
48#. module: account_deferred_charge
49#: model:ir.model,name:account_deferred_charge.model_res_company
50msgid "Companies"
51msgstr "Aziende"
52
53#. module: account_deferred_charge
54#: model:ir.model,name:account_deferred_charge.model_account_invoice_line
55msgid "Invoice Line"
56msgstr "Righe Fattura"
57
58#. module: account_deferred_charge
59#: code:addons/account_deferred_charge/account.py:57
60#, python-format
61msgid "Deferred charge: start date and end are on the same year"
62msgstr "Rateo/risconto: data inizio e data fine sono nello stesso anno"
63
64#. module: account_deferred_charge
65#: view:account.invoice:0
66msgid "Deferred moves"
67msgstr "Registrazioni contabili ratei/risconti"
68
69#. module: account_deferred_charge
70#: view:account.config.settings:0
71#: field:account.invoice.line,deferrede_charge:0
72#: code:addons/account_deferred_charge/account.py:69
73#: code:addons/account_deferred_charge/account.py:75
74#, python-format
75msgid "Deferred charge"
76msgstr "Rateo/risconto"
77
78#. module: account_deferred_charge
79#: field:account.invoice.line,deferred_charge_account_id:0
80msgid "Deferred charge account"
81msgstr "Conto rateo/risconto"
82
83#. module: account_deferred_charge
84#: field:account.invoice.line,reversal_date:0
85msgid "Reversal date"
86msgstr "Data di storno"
87
88#. module: account_deferred_charge
89#: view:account.invoice:0
90msgid "Payments"
91msgstr "Pagamenti"
92
93#. module: account_deferred_charge
94#: field:account.invoice.line,deferred_charge_from:0
95msgid "Deferred charge from date"
96msgstr "Dalla data"
97
98#. module: account_deferred_charge
99#: code:addons/account_deferred_charge/account.py:45
100#: code:addons/account_deferred_charge/account.py:50
101#: code:addons/account_deferred_charge/account.py:56
102#, python-format
103msgid "Error"
104msgstr "Errore"
105
106#. module: account_deferred_charge
107#: field:account.invoice,deferred_charge_move_ids:0
108msgid "Deferred charge Entries"
109msgstr "Registrazioni contabili ratei/risconti"
110
111#. module: account_deferred_charge
112#: view:account.config.settings:0
113msgid "Configuration"
114msgstr "Configurazione"
115
116#. module: account_deferred_charge
117#: field:account.config.settings,deferred_charge_journal_id:0
118#: field:res.company,deferred_charge_journal_id:0
119msgid "Deferred charge journal"
120msgstr "Sezionale ratei/risconti"
0121
=== added directory 'account_deferred_charge/test'
=== added file 'account_deferred_charge/test/invoice.yml'
--- account_deferred_charge/test/invoice.yml 1970-01-01 00:00:00 +0000
+++ account_deferred_charge/test/invoice.yml 2013-10-22 13:25:12 +0000
@@ -0,0 +1,77 @@
1-
2 I create next year
3-
4 !record {model: account.fiscalyear, id: next_year}:
5 name: 'next year'
6 code: 'next year'
7 date_start: !eval "'%s-01-01'% (datetime.now().year+1)"
8 date_stop: !eval "'%s-12-31'% (datetime.now().year+1)"
9-
10 I create periods
11-
12 !python {model: account.fiscalyear}: |
13 self.create_period(cr, uid, [ref('next_year')])
14-
15 I configure deferred charge journal
16-
17 !record {model: res.company, id: base.main_company}:
18 deferred_charge_journal_id: account.expenses_journal
19-
20 I create a supplier invoice
21-
22 !record {model: account.invoice, id: account_invoice_supplier0, view: account.invoice_supplier_form}:
23 account_id: account.a_pay
24 check_total: 1200
25 company_id: base.main_company
26 currency_id: base.EUR
27 invoice_line:
28 - account_id: account.a_expense
29 name: 'Insurance'
30 price_unit: 1200
31 quantity: 1
32 uos_id: product.product_uom_unit
33 deferred_charge_from: !eval "'%s-12-01'% (datetime.now().year)"
34 deferred_charge_to: !eval "'%s-11-30'% (datetime.now().year+1)"
35 deferred_charge_account_id: account.stk
36 reversal_date: !eval "'%s-01-01'% (datetime.now().year+1)"
37 deferrede_charge: True
38 journal_id: account.expenses_journal
39 partner_id: base.res_partner_12
40 type: in_invoice
41-
42 I check that Initially supplier invoice state is "Draft"
43-
44 !assert {model: account.invoice, id: account_invoice_supplier0}:
45 - state == 'draft'
46-
47 I change the state of invoice to open by clicking Validate button
48-
49 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier0}
50-
51 I check that the invoice state is now "Open"
52-
53 !assert {model: account.invoice, id: account_invoice_supplier0}:
54 - state == 'open'
55-
56 I verify that account move is created
57-
58 !python {model: account.invoice}: |
59 from datetime import datetime
60 move_obj = self.pool.get('account.move')
61 inv = self.browse(cr, uid, ref('account_invoice_supplier0'))
62 move = inv.move_id
63 get_period = move_obj._get_period(cr, uid, {'lang': u'en_US', 'active_model': 'ir.ui.menu',
64 'active_ids': [ref('account.menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('account.menu_action_move_journal_line_form')})
65 amt = move_obj._search_amount(cr, uid, move_obj, 'amount', [('amount', '=', 1200.0)], {'lang': u'en_US', 'active_model': 'ir.ui.menu',
66 'active_ids': [ref('account.menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('account.menu_action_move_journal_line_form')})
67 ids = amt[0][2]
68 amt_compute = move_obj._amount_compute(cr, uid, list(ids), 'amount', None, {'lang': u'en_US', 'active_model': 'ir.ui.menu',
69 'active_ids': [ref('account.menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('account.menu_action_move_journal_line_form')}, where ='')
70 move_amount = amt_compute.values()
71 assert(inv.move_id and move.period_id.id == get_period and move_amount[0] == 1200.0), ('Journal Entries has not been created')
72 assert (inv.deferred_charge_move_ids) , 'No deferred charge move generated'
73 if inv.deferred_charge_move_ids:
74 for move_line in inv.deferred_charge_move_ids[0].line_id:
75 if move_line.account_id.id == ref('account.stk'):
76 assert(move_line.debit == 1101.1), 'Wrong deferred charge amount'
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'

Subscribers

People subscribed via source and target branches