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
1=== modified file 'account_cutoff_base/account_cutoff.py'
2--- account_cutoff_base/account_cutoff.py 2013-12-24 15:31:15 +0000
3+++ account_cutoff_base/account_cutoff.py 2016-05-13 13:23:12 +0000
4@@ -61,7 +61,7 @@
5
6 _columns = {
7 'cutoff_date': fields.date(
8- 'Cut-off Date', required=True, readonly=True,
9+ 'Cut-off Date', readonly=True,
10 states={'draft': [('readonly', False)]},
11 track_visibility='always'),
12 'type': fields.selection([
13@@ -75,7 +75,7 @@
14 'account.move', 'Cut-off Journal Entry', readonly=True),
15 'move_label': fields.char(
16 'Label of the Cut-off Journal Entry',
17- size=64, required=True, readonly=True,
18+ size=64, readonly=True,
19 states={'draft': [('readonly', False)]},
20 help="This label will be written in the 'Name' field of the "
21 "Cut-off Account Move Lines and in the 'Reference' field of "
22@@ -83,10 +83,9 @@
23 'cutoff_account_id': fields.many2one(
24 'account.account', 'Cut-off Account',
25 domain=[('type', '<>', 'view'), ('type', '<>', 'closed')],
26- required=True, readonly=True,
27- states={'draft': [('readonly', False)]}),
28+ readonly=True, states={'draft': [('readonly', False)]}),
29 'cutoff_journal_id': fields.many2one(
30- 'account.journal', 'Cut-off Account Journal', required=True,
31+ 'account.journal', 'Cut-off Account Journal',
32 readonly=True, states={'draft': [('readonly', False)]}),
33 'total_cutoff_amount': fields.function(
34 _compute_total_cutoff, type='float', string="Total Cut-off Amount",
35@@ -165,12 +164,15 @@
36 )]
37
38 def cutoff_date_onchange(
39- self, cr, uid, ids, type, cutoff_date, move_label):
40+ self, cr, uid, ids, type, cutoff_date, move_label, context=None):
41+ if context is None:
42+ context = {}
43 res = {'value': {}}
44 if type and cutoff_date:
45- context = {'type': type, 'cutoff_date': cutoff_date}
46+ ctx = context.copy()
47+ ctx.update({'type': type, 'cutoff_date': cutoff_date})
48 res['value']['move_label'] = self._default_move_label(
49- cr, uid, context=context)
50+ cr, uid, context=ctx)
51 return res
52
53 def back2draft(self, cr, uid, ids, context=None):
54
55=== modified file 'account_cutoff_base/account_cutoff_view.xml'
56--- account_cutoff_base/account_cutoff_view.xml 2013-10-15 19:35:48 +0000
57+++ account_cutoff_base/account_cutoff_view.xml 2016-05-13 13:23:12 +0000
58@@ -24,7 +24,7 @@
59 <header>
60 <button name="back2draft" string="Back to Draft" type="object" states="done" />
61 <!-- here, we have the 'get_lines' button that is supplied by the other cutoff modules -->
62- <button class="oe_highlight" name="create_move" string="Create Journal Entry" type="object" states="draft" attrs="{'invisible': ['|', ('line_ids', '=', False), ('state', '=', 'done')]}"/>
63+ <button class="oe_highlight" name="create_move" string="Create Journal Entry" type="object" attrs="{'invisible': ['|', ('line_ids', '=', False), ('state', '=', 'done')]}"/>
64 <field name="state" widget="statusbar" />
65 </header>
66 <sheet>
67@@ -35,15 +35,15 @@
68 </div>
69 <group name="top">
70 <group name="general-params">
71- <field name="cutoff_date" on_change="cutoff_date_onchange(type, cutoff_date, move_label)"/>
72+ <field name="cutoff_date" on_change="cutoff_date_onchange(type, cutoff_date, move_label, context)"/>
73 <field name="total_cutoff_amount" widget="monetary" options="{'currency_field': 'company_currency_id'}"/>
74 <field name="company_id" groups="base.group_multi_company" widget="selection" />
75 <field name="company_currency_id" invisible="1"/>
76 </group>
77 <group name="accounting-params">
78- <field name="cutoff_journal_id"/>
79- <field name="cutoff_account_id"/>
80- <field name="move_label"/>
81+ <field name="cutoff_journal_id" required="1"/>
82+ <field name="cutoff_account_id" required="1"/>
83+ <field name="move_label" required="1"/>
84 <field name="move_id"/>
85 </group>
86 </group>
87
88=== modified file 'account_cutoff_prepaid/__openerp__.py'
89--- account_cutoff_prepaid/__openerp__.py 2013-09-09 21:28:50 +0000
90+++ account_cutoff_prepaid/__openerp__.py 2016-05-13 13:23:12 +0000
91@@ -23,7 +23,7 @@
92
93 {
94 'name': 'Account Cut-off Prepaid',
95- 'version': '0.1',
96+ 'version': '0.2',
97 'category': 'Accounting & Finance',
98 'license': 'AGPL-3',
99 'summary': 'Prepaid Expense, Prepaid Revenue',
100
101=== modified file 'account_cutoff_prepaid/account_cutoff.py'
102--- account_cutoff_prepaid/account_cutoff.py 2013-12-24 15:31:15 +0000
103+++ account_cutoff_prepaid/account_cutoff.py 2016-05-13 13:23:12 +0000
104@@ -23,6 +23,7 @@
105
106 from openerp.osv import orm, fields
107 from openerp.tools.translate import _
108+from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
109 from datetime import datetime
110
111
112@@ -34,6 +35,13 @@
113 'account.journal', id1='cutoff_id', id2='journal_id',
114 string='Source Journals', readonly=True,
115 states={'draft': [('readonly', False)]}),
116+ 'forecast': fields.boolean(
117+ 'Forecast',
118+ readonly=True, states={'draft': [('readonly', False)]},
119+ help="The Forecast mode allows the user to compute "
120+ "the prepaid revenue/expense between 2 dates in the future."),
121+ 'start_date': fields.date('Start Date'),
122+ 'end_date': fields.date('End Date'),
123 }
124
125 def _get_default_source_journals(self, cr, uid, context=None):
126@@ -58,32 +66,71 @@
127 }
128
129 _sql_constraints = [(
130- 'date_type_company_uniq',
131- 'unique(cutoff_date, company_id, type)',
132- 'A cut-off of the same type already exists with this cut-off date !'
133+ 'date_type_forecast_company_uniq',
134+ 'unique(cutoff_date, company_id, type, forecast, start_date, end_date)',
135+ 'A cut-off of the same type already exists with the same date(s) !'
136 )]
137
138+ def _check_start_end_dates(self, cr, uid, ids):
139+ for prepaid in self.browse(cr, uid, ids):
140+ if prepaid.forecast and prepaid.start_date and prepaid.end_date \
141+ and prepaid.start_date > prepaid.end_date:
142+ return False
143+ return True
144+
145+ _constraints = [
146+ (_check_start_end_dates, "The start date is after the end date!",
147+ ['start_date', 'end_date', 'forecast']),
148+ ]
149+
150+ def forecast_onchange(self, cr, uid, ids, forecast, context=None):
151+ res = {'value': {}}
152+ line_ids = self.pool['account.cutoff.line'].search(
153+ cr, uid, [('parent_id', 'in', ids)], context=context)
154+ self.pool['account.cutoff.line'].unlink(
155+ cr, uid, line_ids, context=context)
156+ if forecast:
157+ res['value']['cutoff_date'] = False
158+ else:
159+ res['value']['start_date'] = False
160+ res['value']['end_date'] = False
161+ return res
162+
163 def _prepare_prepaid_lines(
164 self, cr, uid, ids, aml, cur_cutoff, mapping, context=None):
165- start_date = datetime.strptime(aml['start_date'], '%Y-%m-%d')
166- end_date = datetime.strptime(aml['end_date'], '%Y-%m-%d')
167- cutoff_date_str = cur_cutoff['cutoff_date']
168- cutoff_date = datetime.strptime(cutoff_date_str, '%Y-%m-%d')
169+ start_date = datetime.strptime(
170+ aml['start_date'], DEFAULT_SERVER_DATE_FORMAT)
171+ end_date = datetime.strptime(
172+ aml['end_date'], DEFAULT_SERVER_DATE_FORMAT)
173 # Here, we compute the amount of the cutoff
174 # That's the important part !
175 total_days = (end_date - start_date).days + 1
176- if aml['start_date'] > cutoff_date_str:
177- after_cutoff_days = total_days
178- cutoff_amount = -1 * (aml['credit'] - aml['debit'])
179+ if cur_cutoff['forecast']:
180+ out_days = 0
181+ forecast_start_date = datetime.strptime(
182+ cur_cutoff['start_date'], DEFAULT_SERVER_DATE_FORMAT)
183+ forecast_end_date = datetime.strptime(
184+ cur_cutoff['end_date'], DEFAULT_SERVER_DATE_FORMAT)
185+ if aml['end_date'] > cur_cutoff['end_date']:
186+ out_days += (end_date - forecast_end_date).days
187+ if aml['start_date'] < cur_cutoff['start_date']:
188+ out_days += (forecast_start_date - start_date).days
189+ prepaid_days = total_days - out_days
190 else:
191- after_cutoff_days = (end_date - cutoff_date).days
192- if total_days:
193- cutoff_amount = -1 * (aml['credit'] - aml['debit'])\
194- * after_cutoff_days / total_days
195+ cutoff_date_str = cur_cutoff['cutoff_date']
196+ cutoff_date = datetime.strptime(
197+ cutoff_date_str, DEFAULT_SERVER_DATE_FORMAT)
198+ if aml['start_date'] > cutoff_date_str:
199+ prepaid_days = total_days
200 else:
201- raise orm.except_orm(
202- _('Error:'),
203- "Should never happen. Total days should always be > 0")
204+ prepaid_days = (end_date - cutoff_date).days
205+ if total_days:
206+ cutoff_amount = (aml['debit'] - aml['credit'])\
207+ * prepaid_days / float(total_days)
208+ else:
209+ raise orm.except_orm(
210+ _('Error:'),
211+ "Should never happen. Total days should always be > 0")
212
213 # we use account mapping here
214 if aml['account_id'][0] in mapping:
215@@ -104,7 +151,7 @@
216 aml['analytic_account_id'] and aml['analytic_account_id'][0]
217 or False,
218 'total_days': total_days,
219- 'after_cutoff_days': after_cutoff_days,
220+ 'prepaid_days': prepaid_days,
221 'amount': aml['credit'] - aml['debit'],
222 'currency_id': cur_cutoff['company_currency_id'][0],
223 'cutoff_amount': cutoff_amount,
224@@ -120,7 +167,8 @@
225 cur_cutoff = self.read(
226 cr, uid, ids[0], [
227 'line_ids', 'source_journal_ids', 'cutoff_date', 'company_id',
228- 'type', 'company_currency_id'
229+ 'type', 'company_currency_id', 'forecast', 'start_date',
230+ 'end_date',
231 ],
232 context=context)
233 src_journal_ids = cur_cutoff['source_journal_ids']
234@@ -132,13 +180,22 @@
235 if cur_cutoff['line_ids']:
236 line_obj.unlink(cr, uid, cur_cutoff['line_ids'], context=context)
237
238+ if cur_cutoff['forecast']:
239+ domain = [
240+ ('start_date', '<=', cur_cutoff['end_date']),
241+ ('end_date', '>=', cur_cutoff['start_date']),
242+ ('journal_id', 'in', src_journal_ids)
243+ ]
244+ else:
245+ domain = [
246+ ('start_date', '!=', False),
247+ ('journal_id', 'in', src_journal_ids),
248+ ('end_date', '>', cutoff_date_str),
249+ ('date', '<=', cutoff_date_str)
250+ ]
251+
252 # Search for account move lines in the source journals
253- aml_ids = aml_obj.search(cr, uid, [
254- ('start_date', '!=', False),
255- ('journal_id', 'in', src_journal_ids),
256- ('end_date', '>', cutoff_date_str),
257- ('date', '<=', cutoff_date_str)
258- ], context=context)
259+ aml_ids = aml_obj.search(cr, uid, domain, context=context)
260 # Create mapping dict
261 mapping = mapping_obj._get_mapping_dict(
262 cr, uid, cur_cutoff['company_id'][0], cur_cutoff['type'],
263@@ -188,6 +245,9 @@
264 'start_date': fields.date('Start Date', readonly=True),
265 'end_date': fields.date('End Date', readonly=True),
266 'total_days': fields.integer('Total Number of Days', readonly=True),
267- 'after_cutoff_days': fields.integer(
268- 'Number of Days after Cut-off Date', readonly=True),
269+ 'prepaid_days': fields.integer(
270+ 'Prepaid Days', readonly=True,
271+ help="In regular mode, this is the number of days after the "
272+ "cut-off date. In forecast mode, this is the number of days "
273+ "between the start date and the end date."),
274 }
275
276=== modified file 'account_cutoff_prepaid/account_cutoff_view.xml'
277--- account_cutoff_prepaid/account_cutoff_view.xml 2013-10-15 19:35:48 +0000
278+++ account_cutoff_prepaid/account_cutoff_view.xml 2016-05-13 13:23:12 +0000
279@@ -1,7 +1,7 @@
280 <?xml version="1.0" encoding="utf-8"?>
281
282 <!--
283- Copyright (C) 2013 Akretion (http://www.akretion.com/)
284+ Copyright (C) 2013-2014 Akretion (http://www.akretion.com/)
285 @author Alexis de Lattre <alexis.delattre@akretion.com>
286 The licence is in the file __openerp__.py
287 -->
288@@ -9,12 +9,57 @@
289 <openerp>
290 <data>
291
292+<!-- Tree view -->
293+<record id="account_cutoff_tree" model="ir.ui.view">
294+ <field name="name">account.cutoff.prepaid.tree</field>
295+ <field name="model">account.cutoff</field>
296+ <field name="inherit_id" ref="account_cutoff_base.account_cutoff_tree"/>
297+ <field name="arch" type="xml">
298+ <field name="cutoff_date" position="after">
299+ <field name="forecast" invisible="'prepaid' not in context.get('type', '-')"/>
300+ <field name="start_date" invisible="'prepaid' not in context.get('type', '-')"/>
301+ <field name="end_date" invisible="'prepaid' not in context.get('type', '-')"/>
302+ </field>
303+ </field>
304+</record>
305+
306 <!-- Form view -->
307 <record id="account_cutoff_form" model="ir.ui.view">
308 <field name="name">account.cutoff.prepaid.form</field>
309 <field name="model">account.cutoff</field>
310 <field name="inherit_id" ref="account_cutoff_base.account_cutoff_form"/>
311 <field name="arch" type="xml">
312+ <field name="cutoff_date" position="before">
313+ <field name="forecast"
314+ invisible="'prepaid' not in context.get('type', '-')"
315+ on_change="forecast_onchange(forecast, context)"/>
316+ <field name="start_date"
317+ attrs="{'invisible': [('forecast', '=', False)], 'required': [('forecast', '=', True)]}"/>
318+ <field name="end_date"
319+ attrs="{'invisible': [('forecast', '=', False)], 'required': [('forecast', '=', True)]}"/>
320+ </field>
321+ <field name="cutoff_date" position="attributes">
322+ <attribute name="attrs">{'invisible': [('forecast', '=', True)], 'required': [('forecast', '=', False)]}</attribute>
323+ <attribute name="required">0</attribute>
324+ </field>
325+ <group name="accounting-params" position="attributes">
326+ <attribute name="attrs">{'invisible': [('forecast', '=', True)]}</attribute>
327+ </group>
328+ <field name="cutoff_journal_id" position="attributes">
329+ <attribute name="required">0</attribute>
330+ <attribute name="attrs">{'required': [('forecast', '=', False)]}</attribute>
331+ </field>
332+ <field name="cutoff_account_id" position="attributes">
333+ <attribute name="required">0</attribute>
334+ <attribute name="attrs">{'required': [('forecast', '=', False)]}</attribute>
335+ </field>
336+ <field name="move_label" position="attributes">
337+ <attribute name="required">0</attribute>
338+ <attribute name="attrs">{'required': [('forecast', '=', False)]}</attribute>
339+ </field>
340+ <button name="create_move" position="attributes">
341+ <attribute name="attrs">{'invisible': ['|', '|', ('line_ids', '=', False), ('state', '=', 'done'), ('forecast', '=', True)]}</attribute>
342+ </button>
343 <button name="back2draft" position="after">
344 <button class="oe_highlight" name="get_prepaid_lines" string="Re-Generate Lines" type="object" states="draft" invisible="'prepaid' not in context.get('type', '-')"/>
345 </button>
346@@ -41,7 +86,7 @@
347 </field>
348 <field name="cutoff_amount" position="before">
349 <field name="total_days" invisible="'prepaid' not in context.get('type', '-')"/>
350- <field name="after_cutoff_days" invisible="'prepaid' not in context.get('type', '-')"/>
351+ <field name="prepaid_days" invisible="'prepaid' not in context.get('type', '-')"/>
352 </field>
353 </field>
354 </record>
355@@ -59,7 +104,7 @@
356 <field name="start_date" invisible="'prepaid' not in context.get('type', '-')"/>
357 <field name="end_date" invisible="'prepaid' not in context.get('type', '-')"/>
358 <field name="total_days" string="Days Total" invisible="'prepaid' not in context.get('type', '-')"/>
359- <field name="after_cutoff_days" string="Days after Cut-off" invisible="'prepaid' not in context.get('type', '-')"/>
360+ <field name="prepaid_days" string="Days after Cut-off" invisible="'prepaid' not in context.get('type', '-')"/>
361 </field>
362 </field>
363 </record>
364
365=== modified file 'account_cutoff_prepaid/account_invoice_view.xml'
366--- account_cutoff_prepaid/account_invoice_view.xml 2013-09-09 21:28:50 +0000
367+++ account_cutoff_prepaid/account_invoice_view.xml 2016-05-13 13:23:12 +0000
368@@ -15,7 +15,10 @@
369 <field name="model">account.invoice</field>
370 <field name="inherit_id" ref="account.invoice_form" />
371 <field name="arch" type="xml">
372- <xpath expr="//field[@name='invoice_line']/tree/field[@name='account_analytic_id']" position="after">
373+ <!-- Don't attach on account_analytic_id with position="after"
374+ to be compatible with the module sale_analytic_plans which
375+ removes the field account_analytic_id from the invoice form view -->
376+ <xpath expr="//field[@name='invoice_line']/tree/field[@name='quantity']" position="before">
377 <field name="start_date" />
378 <field name="end_date" />
379 </xpath>
380@@ -33,7 +36,7 @@
381 <field name="model">account.invoice</field>
382 <field name="inherit_id" ref="account.invoice_supplier_form" />
383 <field name="arch" type="xml">
384- <xpath expr="//field[@name='invoice_line']/tree/field[@name='account_analytic_id']" position="after">
385+ <xpath expr="//field[@name='invoice_line']/tree/field[@name='quantity']" position="before">
386 <field name="start_date" />
387 <field name="end_date" />
388 </xpath>
389
390=== modified file 'account_cutoff_prepaid/i18n/account_cutoff_prepaid.pot'
391--- account_cutoff_prepaid/i18n/account_cutoff_prepaid.pot 2013-12-24 15:31:15 +0000
392+++ account_cutoff_prepaid/i18n/account_cutoff_prepaid.pot 2016-05-13 13:23:12 +0000
393@@ -6,8 +6,8 @@
394 msgstr ""
395 "Project-Id-Version: OpenERP Server 7.0\n"
396 "Report-Msgid-Bugs-To: \n"
397-"POT-Creation-Date: 2013-12-24 15:26+0000\n"
398-"PO-Revision-Date: 2013-12-24 15:26+0000\n"
399+"POT-Creation-Date: 2014-03-09 00:05+0000\n"
400+"PO-Revision-Date: 2014-03-09 00:05+0000\n"
401 "Last-Translator: <>\n"
402 "Language-Team: \n"
403 "MIME-Version: 1.0\n"
404@@ -21,6 +21,7 @@
405 msgstr ""
406
407 #. module: account_cutoff_prepaid
408+#: field:account.cutoff,end_date:0
409 #: field:account.cutoff.line,end_date:0
410 #: field:account.invoice.line,end_date:0
411 #: field:account.move.line,end_date:0
412@@ -38,6 +39,16 @@
413 msgstr ""
414
415 #. module: account_cutoff_prepaid
416+#: field:account.cutoff,forecast:0
417+msgid "Forecast"
418+msgstr ""
419+
420+#. module: account_cutoff_prepaid
421+#: view:account.cutoff:0
422+msgid "{'invisible': [('forecast', '=', True)], 'required': [('forecast', '=', False)]}"
423+msgstr ""
424+
425+#. module: account_cutoff_prepaid
426 #: field:res.company,default_prepaid_expense_account_id:0
427 msgid "Default Account for Prepaid Expense"
428 msgstr ""
429@@ -65,6 +76,11 @@
430 msgstr ""
431
432 #. module: account_cutoff_prepaid
433+#: view:account.cutoff:0
434+msgid "{'invisible': [('forecast', '=', True)]}"
435+msgstr ""
436+
437+#. module: account_cutoff_prepaid
438 #: field:account.cutoff.line,total_days:0
439 msgid "Total Number of Days"
440 msgstr ""
441@@ -104,6 +120,11 @@
442 msgstr ""
443
444 #. module: account_cutoff_prepaid
445+#: help:account.cutoff,forecast:0
446+msgid "The Forecast mode allows the user to compute the prepaid revenue/expense between 2 dates in the future."
447+msgstr ""
448+
449+#. module: account_cutoff_prepaid
450 #: model:ir.model,name:account_cutoff_prepaid.model_account_cutoff
451 msgid "Account Cut-off"
452 msgstr ""
453@@ -119,16 +140,6 @@
454 msgstr ""
455
456 #. module: account_cutoff_prepaid
457-#: sql_constraint:account.cutoff:0
458-msgid "A cut-off of the same type already exists with this cut-off date !"
459-msgstr ""
460-
461-#. module: account_cutoff_prepaid
462-#: field:account.cutoff.line,after_cutoff_days:0
463-msgid "Number of Days after Cut-off Date"
464-msgstr ""
465-
466-#. module: account_cutoff_prepaid
467 #: model:product.template,name:account_cutoff_prepaid.product_insurance_contrat_product_template
468 msgid "Car Insurance"
469 msgstr ""
470@@ -141,8 +152,8 @@
471 #: code:addons/account_cutoff_prepaid/account.py:94
472 #: code:addons/account_cutoff_prepaid/account.py:100
473 #: code:addons/account_cutoff_prepaid/account.py:144
474-#: code:addons/account_cutoff_prepaid/account_cutoff.py:85
475-#: code:addons/account_cutoff_prepaid/account_cutoff.py:129
476+#: code:addons/account_cutoff_prepaid/account_cutoff.py:132
477+#: code:addons/account_cutoff_prepaid/account_cutoff.py:177
478 #, python-format
479 msgid "Error:"
480 msgstr ""
481@@ -170,7 +181,7 @@
482 msgstr ""
483
484 #. module: account_cutoff_prepaid
485-#: code:addons/account_cutoff_prepaid/account_cutoff.py:129
486+#: code:addons/account_cutoff_prepaid/account_cutoff.py:177
487 #, python-format
488 msgid "You should set at least one Source Journal."
489 msgstr ""
490@@ -182,17 +193,32 @@
491 msgstr ""
492
493 #. module: account_cutoff_prepaid
494+#: constraint:account.cutoff:0
495+msgid "The start date is after the end date!"
496+msgstr ""
497+
498+#. module: account_cutoff_prepaid
499 #: code:addons/account_cutoff_prepaid/account.py:90
500 #, python-format
501 msgid "Missing End Date for move line with Name '%s'."
502 msgstr ""
503
504 #. module: account_cutoff_prepaid
505+#: help:account.cutoff.line,prepaid_days:0
506+msgid "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."
507+msgstr ""
508+
509+#. module: account_cutoff_prepaid
510 #: model:ir.model,name:account_cutoff_prepaid.model_product_template
511 msgid "Product Template"
512 msgstr ""
513
514 #. module: account_cutoff_prepaid
515+#: view:account.cutoff:0
516+msgid "{'required': [('forecast', '=', False)]}"
517+msgstr ""
518+
519+#. module: account_cutoff_prepaid
520 #: model:ir.model,name:account_cutoff_prepaid.model_account_invoice_line
521 msgid "Invoice Line"
522 msgstr ""
523@@ -224,6 +250,12 @@
524 msgstr ""
525
526 #. module: account_cutoff_prepaid
527+#: sql_constraint:account.cutoff:0
528+msgid "A cut-off of the same type already exists with the same date(s) !"
529+msgstr ""
530+
531+#. module: account_cutoff_prepaid
532+#: field:account.cutoff,start_date:0
533 #: field:account.cutoff.line,start_date:0
534 #: field:account.invoice.line,start_date:0
535 #: field:account.move.line,start_date:0
536@@ -236,6 +268,11 @@
537 msgstr ""
538
539 #. module: account_cutoff_prepaid
540+#: field:account.cutoff.line,prepaid_days:0
541+msgid "Prepaid Days"
542+msgstr ""
543+
544+#. module: account_cutoff_prepaid
545 #: view:product.template:0
546 msgid "Sales Properties"
547 msgstr ""
548
549=== added directory 'account_cutoff_prepaid/migrations'
550=== added directory 'account_cutoff_prepaid/migrations/7.0.0.2'
551=== added file 'account_cutoff_prepaid/migrations/7.0.0.2/pre-migration.py'
552--- account_cutoff_prepaid/migrations/7.0.0.2/pre-migration.py 1970-01-01 00:00:00 +0000
553+++ account_cutoff_prepaid/migrations/7.0.0.2/pre-migration.py 2016-05-13 13:23:12 +0000
554@@ -0,0 +1,29 @@
555+# -*- coding: utf-8 -*-
556+##############################################################################
557+#
558+# Copyright (C) 2014 Akretion (http://www.akretion.com/)
559+# @author: Alexis de Lattre <alexis.delattre@akretion.com>
560+#
561+# This program is free software: you can redistribute it and/or modify
562+# it under the terms of the GNU Affero General Public License as
563+# published by the Free Software Foundation, either version 3 of the
564+# License, or (at your option) any later version.
565+#
566+# This program is distributed in the hope that it will be useful,
567+# but WITHOUT ANY WARRANTY; without even the implied warranty of
568+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
569+# GNU Affero General Public License for more details.
570+#
571+# You should have received a copy of the GNU Affero General Public License
572+# along with this program. If not, see <http://www.gnu.org/licenses/>.
573+#
574+##############################################################################
575+
576+
577+def migrate(cr, version):
578+ if not version:
579+ return
580+
581+ cr.execute(
582+ 'ALTER TABLE "account_cutoff_line" RENAME "after_cutoff_days" '
583+ 'TO "prepaid_days"')

Subscribers

People subscribed via source and target branches