Merge lp:~akretion-team/account-closing/70-forecast-prepaid into lp:~account-core-editors/account-closing/7.0

Proposed by Alexis de Lattre on 2014-03-09
Status: Needs review
Proposed branch: lp:~akretion-team/account-closing/70-forecast-prepaid
Merge into: lp:~account-core-editors/account-closing/7.0
Diff against target: 583 lines (+237/-61)
8 files modified
account_cutoff_base/account_cutoff.py (+10/-8)
account_cutoff_base/account_cutoff_view.xml (+5/-5)
account_cutoff_prepaid/__openerp__.py (+1/-1)
account_cutoff_prepaid/account_cutoff.py (+87/-27)
account_cutoff_prepaid/account_cutoff_view.xml (+48/-3)
account_cutoff_prepaid/account_invoice_view.xml (+5/-2)
account_cutoff_prepaid/i18n/account_cutoff_prepaid.pot (+52/-15)
account_cutoff_prepaid/migrations/7.0.0.2/pre-migration.py (+29/-0)
To merge this branch: bzr merge lp:~akretion-team/account-closing/70-forecast-prepaid
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no tests 2014-03-09 Needs Fixing on 2014-06-26
Benoit Guillot - http://www.akretion.com (community) code review no test Approve on 2014-06-04
Review via email: mp+210066@code.launchpad.net

Description of the change

The main change in this MP is the addition of one new feature : the ability to compute forecasts of prepaid expense and prepaid revenue. This is important when working on budgets ; it allows the Accountant to easily compute the amount of prepaid revenue and prepaid expense between 2 dates in the future (you can also use it for dates in the past...).

This feature used to be available in the module "account_prepaid_reporting" from lp:~akretion-team/+junk/70-prepaid-reporting, but this module had a lot of duplicate code with the module account_cutoff_prepaid and it was based on two TransientModels which caused some bugs in some scenarios when doing CSV exports. So I eventually decided to try to integrate this feature inside the module account_cutoff_prepaid ; I am happy with the result (it avoids code duplication and only introduce a few lines of additional code) so I propose it for inclusion in the official branch.

To post a comment you must log in.

LDTM

review: Approve (code review no test)
39. By Alexis de Lattre on 2014-06-06

Fix invisibility of "Create Journal Entry" button (live from Open Days !)

please add automated tests.

Additionally I'm interested in an explanation about the various comparison operators used : sometimes you use strict inequality, sometime -or-equal comparison (e.g. line 241 vs line 248).

review: Needs Fixing (code review, no tests)
40. By Alexis de Lattre on 2016-05-13

FIX compatibility with sale_analytic_plans

Unmerged revisions

40. By Alexis de Lattre on 2016-05-13

FIX compatibility with sale_analytic_plans

39. By Alexis de Lattre on 2014-06-06

Fix invisibility of "Create Journal Entry" button (live from Open Days !)

38. By Alexis de Lattre on 2014-03-09

Update POT file.

37. By Alexis de Lattre on 2014-03-07

Add Forecast feature for prepaid.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_cutoff_base/account_cutoff.py'
--- account_cutoff_base/account_cutoff.py 2013-12-24 15:31:15 +0000
+++ account_cutoff_base/account_cutoff.py 2016-05-13 13:23:12 +0000
@@ -61,7 +61,7 @@
6161
62 _columns = {62 _columns = {
63 'cutoff_date': fields.date(63 'cutoff_date': fields.date(
64 'Cut-off Date', required=True, readonly=True,64 'Cut-off Date', readonly=True,
65 states={'draft': [('readonly', False)]},65 states={'draft': [('readonly', False)]},
66 track_visibility='always'),66 track_visibility='always'),
67 'type': fields.selection([67 'type': fields.selection([
@@ -75,7 +75,7 @@
75 'account.move', 'Cut-off Journal Entry', readonly=True),75 'account.move', 'Cut-off Journal Entry', readonly=True),
76 'move_label': fields.char(76 'move_label': fields.char(
77 'Label of the Cut-off Journal Entry',77 'Label of the Cut-off Journal Entry',
78 size=64, required=True, readonly=True,78 size=64, readonly=True,
79 states={'draft': [('readonly', False)]},79 states={'draft': [('readonly', False)]},
80 help="This label will be written in the 'Name' field of the "80 help="This label will be written in the 'Name' field of the "
81 "Cut-off Account Move Lines and in the 'Reference' field of "81 "Cut-off Account Move Lines and in the 'Reference' field of "
@@ -83,10 +83,9 @@
83 'cutoff_account_id': fields.many2one(83 'cutoff_account_id': fields.many2one(
84 'account.account', 'Cut-off Account',84 'account.account', 'Cut-off Account',
85 domain=[('type', '<>', 'view'), ('type', '<>', 'closed')],85 domain=[('type', '<>', 'view'), ('type', '<>', 'closed')],
86 required=True, readonly=True,86 readonly=True, states={'draft': [('readonly', False)]}),
87 states={'draft': [('readonly', False)]}),
88 'cutoff_journal_id': fields.many2one(87 'cutoff_journal_id': fields.many2one(
89 'account.journal', 'Cut-off Account Journal', required=True,88 'account.journal', 'Cut-off Account Journal',
90 readonly=True, states={'draft': [('readonly', False)]}),89 readonly=True, states={'draft': [('readonly', False)]}),
91 'total_cutoff_amount': fields.function(90 'total_cutoff_amount': fields.function(
92 _compute_total_cutoff, type='float', string="Total Cut-off Amount",91 _compute_total_cutoff, type='float', string="Total Cut-off Amount",
@@ -165,12 +164,15 @@
165 )]164 )]
166165
167 def cutoff_date_onchange(166 def cutoff_date_onchange(
168 self, cr, uid, ids, type, cutoff_date, move_label):167 self, cr, uid, ids, type, cutoff_date, move_label, context=None):
168 if context is None:
169 context = {}
169 res = {'value': {}}170 res = {'value': {}}
170 if type and cutoff_date:171 if type and cutoff_date:
171 context = {'type': type, 'cutoff_date': cutoff_date}172 ctx = context.copy()
173 ctx.update({'type': type, 'cutoff_date': cutoff_date})
172 res['value']['move_label'] = self._default_move_label(174 res['value']['move_label'] = self._default_move_label(
173 cr, uid, context=context)175 cr, uid, context=ctx)
174 return res176 return res
175177
176 def back2draft(self, cr, uid, ids, context=None):178 def back2draft(self, cr, uid, ids, context=None):
177179
=== modified file 'account_cutoff_base/account_cutoff_view.xml'
--- account_cutoff_base/account_cutoff_view.xml 2013-10-15 19:35:48 +0000
+++ account_cutoff_base/account_cutoff_view.xml 2016-05-13 13:23:12 +0000
@@ -24,7 +24,7 @@
24 <header>24 <header>
25 <button name="back2draft" string="Back to Draft" type="object" states="done" />25 <button name="back2draft" string="Back to Draft" type="object" states="done" />
26 <!-- here, we have the 'get_lines' button that is supplied by the other cutoff modules -->26 <!-- here, we have the 'get_lines' button that is supplied by the other cutoff modules -->
27 <button class="oe_highlight" name="create_move" string="Create Journal Entry" type="object" states="draft" attrs="{'invisible': ['|', ('line_ids', '=', False), ('state', '=', 'done')]}"/>27 <button class="oe_highlight" name="create_move" string="Create Journal Entry" type="object" attrs="{'invisible': ['|', ('line_ids', '=', False), ('state', '=', 'done')]}"/>
28 <field name="state" widget="statusbar" />28 <field name="state" widget="statusbar" />
29 </header>29 </header>
30 <sheet>30 <sheet>
@@ -35,15 +35,15 @@
35 </div>35 </div>
36 <group name="top">36 <group name="top">
37 <group name="general-params">37 <group name="general-params">
38 <field name="cutoff_date" on_change="cutoff_date_onchange(type, cutoff_date, move_label)"/>38 <field name="cutoff_date" on_change="cutoff_date_onchange(type, cutoff_date, move_label, context)"/>
39 <field name="total_cutoff_amount" widget="monetary" options="{'currency_field': 'company_currency_id'}"/>39 <field name="total_cutoff_amount" widget="monetary" options="{'currency_field': 'company_currency_id'}"/>
40 <field name="company_id" groups="base.group_multi_company" widget="selection" />40 <field name="company_id" groups="base.group_multi_company" widget="selection" />
41 <field name="company_currency_id" invisible="1"/>41 <field name="company_currency_id" invisible="1"/>
42 </group>42 </group>
43 <group name="accounting-params">43 <group name="accounting-params">
44 <field name="cutoff_journal_id"/>44 <field name="cutoff_journal_id" required="1"/>
45 <field name="cutoff_account_id"/>45 <field name="cutoff_account_id" required="1"/>
46 <field name="move_label"/>46 <field name="move_label" required="1"/>
47 <field name="move_id"/>47 <field name="move_id"/>
48 </group>48 </group>
49 </group>49 </group>
5050
=== modified file 'account_cutoff_prepaid/__openerp__.py'
--- account_cutoff_prepaid/__openerp__.py 2013-09-09 21:28:50 +0000
+++ account_cutoff_prepaid/__openerp__.py 2016-05-13 13:23:12 +0000
@@ -23,7 +23,7 @@
2323
24{24{
25 'name': 'Account Cut-off Prepaid',25 'name': 'Account Cut-off Prepaid',
26 'version': '0.1',26 'version': '0.2',
27 'category': 'Accounting & Finance',27 'category': 'Accounting & Finance',
28 'license': 'AGPL-3',28 'license': 'AGPL-3',
29 'summary': 'Prepaid Expense, Prepaid Revenue',29 'summary': 'Prepaid Expense, Prepaid Revenue',
3030
=== modified file 'account_cutoff_prepaid/account_cutoff.py'
--- account_cutoff_prepaid/account_cutoff.py 2013-12-24 15:31:15 +0000
+++ account_cutoff_prepaid/account_cutoff.py 2016-05-13 13:23:12 +0000
@@ -23,6 +23,7 @@
2323
24from openerp.osv import orm, fields24from openerp.osv import orm, fields
25from openerp.tools.translate import _25from openerp.tools.translate import _
26from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
26from datetime import datetime27from datetime import datetime
2728
2829
@@ -34,6 +35,13 @@
34 'account.journal', id1='cutoff_id', id2='journal_id',35 'account.journal', id1='cutoff_id', id2='journal_id',
35 string='Source Journals', readonly=True,36 string='Source Journals', readonly=True,
36 states={'draft': [('readonly', False)]}),37 states={'draft': [('readonly', False)]}),
38 'forecast': fields.boolean(
39 'Forecast',
40 readonly=True, states={'draft': [('readonly', False)]},
41 help="The Forecast mode allows the user to compute "
42 "the prepaid revenue/expense between 2 dates in the future."),
43 'start_date': fields.date('Start Date'),
44 'end_date': fields.date('End Date'),
37 }45 }
3846
39 def _get_default_source_journals(self, cr, uid, context=None):47 def _get_default_source_journals(self, cr, uid, context=None):
@@ -58,32 +66,71 @@
58 }66 }
5967
60 _sql_constraints = [(68 _sql_constraints = [(
61 'date_type_company_uniq',69 'date_type_forecast_company_uniq',
62 'unique(cutoff_date, company_id, type)',70 'unique(cutoff_date, company_id, type, forecast, start_date, end_date)',
63 'A cut-off of the same type already exists with this cut-off date !'71 'A cut-off of the same type already exists with the same date(s) !'
64 )]72 )]
6573
74 def _check_start_end_dates(self, cr, uid, ids):
75 for prepaid in self.browse(cr, uid, ids):
76 if prepaid.forecast and prepaid.start_date and prepaid.end_date \
77 and prepaid.start_date > prepaid.end_date:
78 return False
79 return True
80
81 _constraints = [
82 (_check_start_end_dates, "The start date is after the end date!",
83 ['start_date', 'end_date', 'forecast']),
84 ]
85
86 def forecast_onchange(self, cr, uid, ids, forecast, context=None):
87 res = {'value': {}}
88 line_ids = self.pool['account.cutoff.line'].search(
89 cr, uid, [('parent_id', 'in', ids)], context=context)
90 self.pool['account.cutoff.line'].unlink(
91 cr, uid, line_ids, context=context)
92 if forecast:
93 res['value']['cutoff_date'] = False
94 else:
95 res['value']['start_date'] = False
96 res['value']['end_date'] = False
97 return res
98
66 def _prepare_prepaid_lines(99 def _prepare_prepaid_lines(
67 self, cr, uid, ids, aml, cur_cutoff, mapping, context=None):100 self, cr, uid, ids, aml, cur_cutoff, mapping, context=None):
68 start_date = datetime.strptime(aml['start_date'], '%Y-%m-%d')101 start_date = datetime.strptime(
69 end_date = datetime.strptime(aml['end_date'], '%Y-%m-%d')102 aml['start_date'], DEFAULT_SERVER_DATE_FORMAT)
70 cutoff_date_str = cur_cutoff['cutoff_date']103 end_date = datetime.strptime(
71 cutoff_date = datetime.strptime(cutoff_date_str, '%Y-%m-%d')104 aml['end_date'], DEFAULT_SERVER_DATE_FORMAT)
72 # Here, we compute the amount of the cutoff105 # Here, we compute the amount of the cutoff
73 # That's the important part !106 # That's the important part !
74 total_days = (end_date - start_date).days + 1107 total_days = (end_date - start_date).days + 1
75 if aml['start_date'] > cutoff_date_str:108 if cur_cutoff['forecast']:
76 after_cutoff_days = total_days109 out_days = 0
77 cutoff_amount = -1 * (aml['credit'] - aml['debit'])110 forecast_start_date = datetime.strptime(
111 cur_cutoff['start_date'], DEFAULT_SERVER_DATE_FORMAT)
112 forecast_end_date = datetime.strptime(
113 cur_cutoff['end_date'], DEFAULT_SERVER_DATE_FORMAT)
114 if aml['end_date'] > cur_cutoff['end_date']:
115 out_days += (end_date - forecast_end_date).days
116 if aml['start_date'] < cur_cutoff['start_date']:
117 out_days += (forecast_start_date - start_date).days
118 prepaid_days = total_days - out_days
78 else:119 else:
79 after_cutoff_days = (end_date - cutoff_date).days120 cutoff_date_str = cur_cutoff['cutoff_date']
80 if total_days:121 cutoff_date = datetime.strptime(
81 cutoff_amount = -1 * (aml['credit'] - aml['debit'])\122 cutoff_date_str, DEFAULT_SERVER_DATE_FORMAT)
82 * after_cutoff_days / total_days123 if aml['start_date'] > cutoff_date_str:
124 prepaid_days = total_days
83 else:125 else:
84 raise orm.except_orm(126 prepaid_days = (end_date - cutoff_date).days
85 _('Error:'),127 if total_days:
86 "Should never happen. Total days should always be > 0")128 cutoff_amount = (aml['debit'] - aml['credit'])\
129 * prepaid_days / float(total_days)
130 else:
131 raise orm.except_orm(
132 _('Error:'),
133 "Should never happen. Total days should always be > 0")
87134
88 # we use account mapping here135 # we use account mapping here
89 if aml['account_id'][0] in mapping:136 if aml['account_id'][0] in mapping:
@@ -104,7 +151,7 @@
104 aml['analytic_account_id'] and aml['analytic_account_id'][0]151 aml['analytic_account_id'] and aml['analytic_account_id'][0]
105 or False,152 or False,
106 'total_days': total_days,153 'total_days': total_days,
107 'after_cutoff_days': after_cutoff_days,154 'prepaid_days': prepaid_days,
108 'amount': aml['credit'] - aml['debit'],155 'amount': aml['credit'] - aml['debit'],
109 'currency_id': cur_cutoff['company_currency_id'][0],156 'currency_id': cur_cutoff['company_currency_id'][0],
110 'cutoff_amount': cutoff_amount,157 'cutoff_amount': cutoff_amount,
@@ -120,7 +167,8 @@
120 cur_cutoff = self.read(167 cur_cutoff = self.read(
121 cr, uid, ids[0], [168 cr, uid, ids[0], [
122 'line_ids', 'source_journal_ids', 'cutoff_date', 'company_id',169 'line_ids', 'source_journal_ids', 'cutoff_date', 'company_id',
123 'type', 'company_currency_id'170 'type', 'company_currency_id', 'forecast', 'start_date',
171 'end_date',
124 ],172 ],
125 context=context)173 context=context)
126 src_journal_ids = cur_cutoff['source_journal_ids']174 src_journal_ids = cur_cutoff['source_journal_ids']
@@ -132,13 +180,22 @@
132 if cur_cutoff['line_ids']:180 if cur_cutoff['line_ids']:
133 line_obj.unlink(cr, uid, cur_cutoff['line_ids'], context=context)181 line_obj.unlink(cr, uid, cur_cutoff['line_ids'], context=context)
134182
183 if cur_cutoff['forecast']:
184 domain = [
185 ('start_date', '<=', cur_cutoff['end_date']),
186 ('end_date', '>=', cur_cutoff['start_date']),
187 ('journal_id', 'in', src_journal_ids)
188 ]
189 else:
190 domain = [
191 ('start_date', '!=', False),
192 ('journal_id', 'in', src_journal_ids),
193 ('end_date', '>', cutoff_date_str),
194 ('date', '<=', cutoff_date_str)
195 ]
196
135 # Search for account move lines in the source journals197 # Search for account move lines in the source journals
136 aml_ids = aml_obj.search(cr, uid, [198 aml_ids = aml_obj.search(cr, uid, domain, context=context)
137 ('start_date', '!=', False),
138 ('journal_id', 'in', src_journal_ids),
139 ('end_date', '>', cutoff_date_str),
140 ('date', '<=', cutoff_date_str)
141 ], context=context)
142 # Create mapping dict199 # Create mapping dict
143 mapping = mapping_obj._get_mapping_dict(200 mapping = mapping_obj._get_mapping_dict(
144 cr, uid, cur_cutoff['company_id'][0], cur_cutoff['type'],201 cr, uid, cur_cutoff['company_id'][0], cur_cutoff['type'],
@@ -188,6 +245,9 @@
188 'start_date': fields.date('Start Date', readonly=True),245 'start_date': fields.date('Start Date', readonly=True),
189 'end_date': fields.date('End Date', readonly=True),246 'end_date': fields.date('End Date', readonly=True),
190 'total_days': fields.integer('Total Number of Days', readonly=True),247 'total_days': fields.integer('Total Number of Days', readonly=True),
191 'after_cutoff_days': fields.integer(248 'prepaid_days': fields.integer(
192 'Number of Days after Cut-off Date', readonly=True),249 'Prepaid Days', readonly=True,
250 help="In regular mode, this is the number of days after the "
251 "cut-off date. In forecast mode, this is the number of days "
252 "between the start date and the end date."),
193 }253 }
194254
=== modified file 'account_cutoff_prepaid/account_cutoff_view.xml'
--- account_cutoff_prepaid/account_cutoff_view.xml 2013-10-15 19:35:48 +0000
+++ account_cutoff_prepaid/account_cutoff_view.xml 2016-05-13 13:23:12 +0000
@@ -1,7 +1,7 @@
1<?xml version="1.0" encoding="utf-8"?>1<?xml version="1.0" encoding="utf-8"?>
22
3<!--3<!--
4 Copyright (C) 2013 Akretion (http://www.akretion.com/)4 Copyright (C) 2013-2014 Akretion (http://www.akretion.com/)
5 @author Alexis de Lattre <alexis.delattre@akretion.com>5 @author Alexis de Lattre <alexis.delattre@akretion.com>
6 The licence is in the file __openerp__.py6 The licence is in the file __openerp__.py
7-->7-->
@@ -9,12 +9,57 @@
9<openerp>9<openerp>
10<data>10<data>
1111
12<!-- Tree view -->
13<record id="account_cutoff_tree" model="ir.ui.view">
14 <field name="name">account.cutoff.prepaid.tree</field>
15 <field name="model">account.cutoff</field>
16 <field name="inherit_id" ref="account_cutoff_base.account_cutoff_tree"/>
17 <field name="arch" type="xml">
18 <field name="cutoff_date" position="after">
19 <field name="forecast" invisible="'prepaid' not in context.get('type', '-')"/>
20 <field name="start_date" invisible="'prepaid' not in context.get('type', '-')"/>
21 <field name="end_date" invisible="'prepaid' not in context.get('type', '-')"/>
22 </field>
23 </field>
24</record>
25
12<!-- Form view -->26<!-- Form view -->
13<record id="account_cutoff_form" model="ir.ui.view">27<record id="account_cutoff_form" model="ir.ui.view">
14 <field name="name">account.cutoff.prepaid.form</field>28 <field name="name">account.cutoff.prepaid.form</field>
15 <field name="model">account.cutoff</field>29 <field name="model">account.cutoff</field>
16 <field name="inherit_id" ref="account_cutoff_base.account_cutoff_form"/>30 <field name="inherit_id" ref="account_cutoff_base.account_cutoff_form"/>
17 <field name="arch" type="xml">31 <field name="arch" type="xml">
32 <field name="cutoff_date" position="before">
33 <field name="forecast"
34 invisible="'prepaid' not in context.get('type', '-')"
35 on_change="forecast_onchange(forecast, context)"/>
36 <field name="start_date"
37 attrs="{'invisible': [('forecast', '=', False)], 'required': [('forecast', '=', True)]}"/>
38 <field name="end_date"
39 attrs="{'invisible': [('forecast', '=', False)], 'required': [('forecast', '=', True)]}"/>
40 </field>
41 <field name="cutoff_date" position="attributes">
42 <attribute name="attrs">{'invisible': [('forecast', '=', True)], 'required': [('forecast', '=', False)]}</attribute>
43 <attribute name="required">0</attribute>
44 </field>
45 <group name="accounting-params" position="attributes">
46 <attribute name="attrs">{'invisible': [('forecast', '=', True)]}</attribute>
47 </group>
48 <field name="cutoff_journal_id" position="attributes">
49 <attribute name="required">0</attribute>
50 <attribute name="attrs">{'required': [('forecast', '=', False)]}</attribute>
51 </field>
52 <field name="cutoff_account_id" position="attributes">
53 <attribute name="required">0</attribute>
54 <attribute name="attrs">{'required': [('forecast', '=', False)]}</attribute>
55 </field>
56 <field name="move_label" position="attributes">
57 <attribute name="required">0</attribute>
58 <attribute name="attrs">{'required': [('forecast', '=', False)]}</attribute>
59 </field>
60 <button name="create_move" position="attributes">
61 <attribute name="attrs">{'invisible': ['|', '|', ('line_ids', '=', False), ('state', '=', 'done'), ('forecast', '=', True)]}</attribute>
62 </button>
18 <button name="back2draft" position="after">63 <button name="back2draft" position="after">
19 <button class="oe_highlight" name="get_prepaid_lines" string="Re-Generate Lines" type="object" states="draft" invisible="'prepaid' not in context.get('type', '-')"/>64 <button class="oe_highlight" name="get_prepaid_lines" string="Re-Generate Lines" type="object" states="draft" invisible="'prepaid' not in context.get('type', '-')"/>
20 </button>65 </button>
@@ -41,7 +86,7 @@
41 </field>86 </field>
42 <field name="cutoff_amount" position="before">87 <field name="cutoff_amount" position="before">
43 <field name="total_days" invisible="'prepaid' not in context.get('type', '-')"/>88 <field name="total_days" invisible="'prepaid' not in context.get('type', '-')"/>
44 <field name="after_cutoff_days" invisible="'prepaid' not in context.get('type', '-')"/>89 <field name="prepaid_days" invisible="'prepaid' not in context.get('type', '-')"/>
45 </field>90 </field>
46 </field>91 </field>
47</record>92</record>
@@ -59,7 +104,7 @@
59 <field name="start_date" invisible="'prepaid' not in context.get('type', '-')"/>104 <field name="start_date" invisible="'prepaid' not in context.get('type', '-')"/>
60 <field name="end_date" invisible="'prepaid' not in context.get('type', '-')"/>105 <field name="end_date" invisible="'prepaid' not in context.get('type', '-')"/>
61 <field name="total_days" string="Days Total" invisible="'prepaid' not in context.get('type', '-')"/>106 <field name="total_days" string="Days Total" invisible="'prepaid' not in context.get('type', '-')"/>
62 <field name="after_cutoff_days" string="Days after Cut-off" invisible="'prepaid' not in context.get('type', '-')"/>107 <field name="prepaid_days" string="Days after Cut-off" invisible="'prepaid' not in context.get('type', '-')"/>
63 </field>108 </field>
64 </field>109 </field>
65</record>110</record>
66111
=== modified file 'account_cutoff_prepaid/account_invoice_view.xml'
--- account_cutoff_prepaid/account_invoice_view.xml 2013-09-09 21:28:50 +0000
+++ account_cutoff_prepaid/account_invoice_view.xml 2016-05-13 13:23:12 +0000
@@ -15,7 +15,10 @@
15 <field name="model">account.invoice</field>15 <field name="model">account.invoice</field>
16 <field name="inherit_id" ref="account.invoice_form" />16 <field name="inherit_id" ref="account.invoice_form" />
17 <field name="arch" type="xml">17 <field name="arch" type="xml">
18 <xpath expr="//field[@name='invoice_line']/tree/field[@name='account_analytic_id']" position="after">18 <!-- Don't attach on account_analytic_id with position="after"
19 to be compatible with the module sale_analytic_plans which
20 removes the field account_analytic_id from the invoice form view -->
21 <xpath expr="//field[@name='invoice_line']/tree/field[@name='quantity']" position="before">
19 <field name="start_date" />22 <field name="start_date" />
20 <field name="end_date" />23 <field name="end_date" />
21 </xpath>24 </xpath>
@@ -33,7 +36,7 @@
33 <field name="model">account.invoice</field>36 <field name="model">account.invoice</field>
34 <field name="inherit_id" ref="account.invoice_supplier_form" />37 <field name="inherit_id" ref="account.invoice_supplier_form" />
35 <field name="arch" type="xml">38 <field name="arch" type="xml">
36 <xpath expr="//field[@name='invoice_line']/tree/field[@name='account_analytic_id']" position="after">39 <xpath expr="//field[@name='invoice_line']/tree/field[@name='quantity']" position="before">
37 <field name="start_date" />40 <field name="start_date" />
38 <field name="end_date" />41 <field name="end_date" />
39 </xpath>42 </xpath>
4043
=== modified file 'account_cutoff_prepaid/i18n/account_cutoff_prepaid.pot'
--- account_cutoff_prepaid/i18n/account_cutoff_prepaid.pot 2013-12-24 15:31:15 +0000
+++ account_cutoff_prepaid/i18n/account_cutoff_prepaid.pot 2016-05-13 13:23:12 +0000
@@ -6,8 +6,8 @@
6msgstr ""6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-12-24 15:26+0000\n"9"POT-Creation-Date: 2014-03-09 00:05+0000\n"
10"PO-Revision-Date: 2013-12-24 15:26+0000\n"10"PO-Revision-Date: 2014-03-09 00:05+0000\n"
11"Last-Translator: <>\n"11"Last-Translator: <>\n"
12"Language-Team: \n"12"Language-Team: \n"
13"MIME-Version: 1.0\n"13"MIME-Version: 1.0\n"
@@ -21,6 +21,7 @@
21msgstr ""21msgstr ""
2222
23#. module: account_cutoff_prepaid23#. module: account_cutoff_prepaid
24#: field:account.cutoff,end_date:0
24#: field:account.cutoff.line,end_date:025#: field:account.cutoff.line,end_date:0
25#: field:account.invoice.line,end_date:026#: field:account.invoice.line,end_date:0
26#: field:account.move.line,end_date:027#: field:account.move.line,end_date:0
@@ -38,6 +39,16 @@
38msgstr ""39msgstr ""
3940
40#. module: account_cutoff_prepaid41#. module: account_cutoff_prepaid
42#: field:account.cutoff,forecast:0
43msgid "Forecast"
44msgstr ""
45
46#. module: account_cutoff_prepaid
47#: view:account.cutoff:0
48msgid "{'invisible': [('forecast', '=', True)], 'required': [('forecast', '=', False)]}"
49msgstr ""
50
51#. module: account_cutoff_prepaid
41#: field:res.company,default_prepaid_expense_account_id:052#: field:res.company,default_prepaid_expense_account_id:0
42msgid "Default Account for Prepaid Expense"53msgid "Default Account for Prepaid Expense"
43msgstr ""54msgstr ""
@@ -65,6 +76,11 @@
65msgstr ""76msgstr ""
6677
67#. module: account_cutoff_prepaid78#. module: account_cutoff_prepaid
79#: view:account.cutoff:0
80msgid "{'invisible': [('forecast', '=', True)]}"
81msgstr ""
82
83#. module: account_cutoff_prepaid
68#: field:account.cutoff.line,total_days:084#: field:account.cutoff.line,total_days:0
69msgid "Total Number of Days"85msgid "Total Number of Days"
70msgstr ""86msgstr ""
@@ -104,6 +120,11 @@
104msgstr ""120msgstr ""
105121
106#. module: account_cutoff_prepaid122#. module: account_cutoff_prepaid
123#: help:account.cutoff,forecast:0
124msgid "The Forecast mode allows the user to compute the prepaid revenue/expense between 2 dates in the future."
125msgstr ""
126
127#. module: account_cutoff_prepaid
107#: model:ir.model,name:account_cutoff_prepaid.model_account_cutoff128#: model:ir.model,name:account_cutoff_prepaid.model_account_cutoff
108msgid "Account Cut-off"129msgid "Account Cut-off"
109msgstr ""130msgstr ""
@@ -119,16 +140,6 @@
119msgstr ""140msgstr ""
120141
121#. module: account_cutoff_prepaid142#. module: account_cutoff_prepaid
122#: sql_constraint:account.cutoff:0
123msgid "A cut-off of the same type already exists with this cut-off date !"
124msgstr ""
125
126#. module: account_cutoff_prepaid
127#: field:account.cutoff.line,after_cutoff_days:0
128msgid "Number of Days after Cut-off Date"
129msgstr ""
130
131#. module: account_cutoff_prepaid
132#: model:product.template,name:account_cutoff_prepaid.product_insurance_contrat_product_template143#: model:product.template,name:account_cutoff_prepaid.product_insurance_contrat_product_template
133msgid "Car Insurance"144msgid "Car Insurance"
134msgstr ""145msgstr ""
@@ -141,8 +152,8 @@
141#: code:addons/account_cutoff_prepaid/account.py:94152#: code:addons/account_cutoff_prepaid/account.py:94
142#: code:addons/account_cutoff_prepaid/account.py:100153#: code:addons/account_cutoff_prepaid/account.py:100
143#: code:addons/account_cutoff_prepaid/account.py:144154#: code:addons/account_cutoff_prepaid/account.py:144
144#: code:addons/account_cutoff_prepaid/account_cutoff.py:85155#: code:addons/account_cutoff_prepaid/account_cutoff.py:132
145#: code:addons/account_cutoff_prepaid/account_cutoff.py:129156#: code:addons/account_cutoff_prepaid/account_cutoff.py:177
146#, python-format157#, python-format
147msgid "Error:"158msgid "Error:"
148msgstr ""159msgstr ""
@@ -170,7 +181,7 @@
170msgstr ""181msgstr ""
171182
172#. module: account_cutoff_prepaid183#. module: account_cutoff_prepaid
173#: code:addons/account_cutoff_prepaid/account_cutoff.py:129184#: code:addons/account_cutoff_prepaid/account_cutoff.py:177
174#, python-format185#, python-format
175msgid "You should set at least one Source Journal."186msgid "You should set at least one Source Journal."
176msgstr ""187msgstr ""
@@ -182,17 +193,32 @@
182msgstr ""193msgstr ""
183194
184#. module: account_cutoff_prepaid195#. module: account_cutoff_prepaid
196#: constraint:account.cutoff:0
197msgid "The start date is after the end date!"
198msgstr ""
199
200#. module: account_cutoff_prepaid
185#: code:addons/account_cutoff_prepaid/account.py:90201#: code:addons/account_cutoff_prepaid/account.py:90
186#, python-format202#, python-format
187msgid "Missing End Date for move line with Name '%s'."203msgid "Missing End Date for move line with Name '%s'."
188msgstr ""204msgstr ""
189205
190#. module: account_cutoff_prepaid206#. module: account_cutoff_prepaid
207#: help:account.cutoff.line,prepaid_days:0
208msgid "In regular mode, this is the number of days after the cut-off date. In forecast mode, this is the number of days between the start date and the end date."
209msgstr ""
210
211#. module: account_cutoff_prepaid
191#: model:ir.model,name:account_cutoff_prepaid.model_product_template212#: model:ir.model,name:account_cutoff_prepaid.model_product_template
192msgid "Product Template"213msgid "Product Template"
193msgstr ""214msgstr ""
194215
195#. module: account_cutoff_prepaid216#. module: account_cutoff_prepaid
217#: view:account.cutoff:0
218msgid "{'required': [('forecast', '=', False)]}"
219msgstr ""
220
221#. module: account_cutoff_prepaid
196#: model:ir.model,name:account_cutoff_prepaid.model_account_invoice_line222#: model:ir.model,name:account_cutoff_prepaid.model_account_invoice_line
197msgid "Invoice Line"223msgid "Invoice Line"
198msgstr ""224msgstr ""
@@ -224,6 +250,12 @@
224msgstr ""250msgstr ""
225251
226#. module: account_cutoff_prepaid252#. module: account_cutoff_prepaid
253#: sql_constraint:account.cutoff:0
254msgid "A cut-off of the same type already exists with the same date(s) !"
255msgstr ""
256
257#. module: account_cutoff_prepaid
258#: field:account.cutoff,start_date:0
227#: field:account.cutoff.line,start_date:0259#: field:account.cutoff.line,start_date:0
228#: field:account.invoice.line,start_date:0260#: field:account.invoice.line,start_date:0
229#: field:account.move.line,start_date:0261#: field:account.move.line,start_date:0
@@ -236,6 +268,11 @@
236msgstr ""268msgstr ""
237269
238#. module: account_cutoff_prepaid270#. module: account_cutoff_prepaid
271#: field:account.cutoff.line,prepaid_days:0
272msgid "Prepaid Days"
273msgstr ""
274
275#. module: account_cutoff_prepaid
239#: view:product.template:0276#: view:product.template:0
240msgid "Sales Properties"277msgid "Sales Properties"
241msgstr ""278msgstr ""
242279
=== added directory 'account_cutoff_prepaid/migrations'
=== added directory 'account_cutoff_prepaid/migrations/7.0.0.2'
=== added file 'account_cutoff_prepaid/migrations/7.0.0.2/pre-migration.py'
--- account_cutoff_prepaid/migrations/7.0.0.2/pre-migration.py 1970-01-01 00:00:00 +0000
+++ account_cutoff_prepaid/migrations/7.0.0.2/pre-migration.py 2016-05-13 13:23:12 +0000
@@ -0,0 +1,29 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2014 Akretion (http://www.akretion.com/)
5# @author: Alexis de Lattre <alexis.delattre@akretion.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
9# published by the Free Software Foundation, either version 3 of the
10# License, or (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
23def migrate(cr, version):
24 if not version:
25 return
26
27 cr.execute(
28 'ALTER TABLE "account_cutoff_line" RENAME "after_cutoff_days" '
29 'TO "prepaid_days"')

Subscribers

People subscribed via source and target branches