Merge lp:~camptocamp/banking-addons/bank-statement-reconcile-payment_line_date into lp:banking-addons/bank-statement-reconcile-70

Proposed by Vincent Renaville@camptocamp
Status: Merged
Merged at revision: 100
Proposed branch: lp:~camptocamp/banking-addons/bank-statement-reconcile-payment_line_date
Merge into: lp:banking-addons/bank-statement-reconcile-70
Diff against target: 68 lines (+14/-5)
2 files modified
statement_voucher_killer/__openerp__.py (+10/-2)
statement_voucher_killer/voucher.py (+4/-3)
To merge this branch: bzr merge lp:~camptocamp/banking-addons/bank-statement-reconcile-payment_line_date
Reviewer Review Type Date Requested Status
Romain Deheele - Camptocamp (community) code review and test rev99 Approve
Stéphane Bidoul (Acsone) (community) code review rev99, test rev96 Approve
Banking Addons Core Editors Pending
Review via email: mp+181720@code.launchpad.net

Description of the change

[FIX] add date of payment line instead of taking current date by default

To post a comment you must log in.
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

[not tested in detail, so apologies if it's a dumb question]

Is this change made necessary by the suppression of the voucher?

Otherwise if it's independent of voucher_killer, would it not be better to submit it as a bug and patch the OCB branch?

-sbi

review: Needs Information (code review, no test)
Revision history for this message
Frederic Clementi - Camptocamp (frederic-clementi) wrote :

Yes Stéphane, this fix is necessary because of voucher_killer and account_payment module is dependant from account_voucher...
So difficult to report a bug.

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Hi Frédéric,

I understand it is difficult to report as a bug.

I did a quick test and IMHO, proposing the payment line date as default is indeed an improvement to the default behaviour. I suggest documenting it as a feature of the module in __openerp__.py.

I also noticed that if line.date is null (which is allowed), it is not possible to add the payment line to the statement. I suggest writing something such as 'date': line.date or line.ml_maturity_date or time.strftime('%Y-%m-%d'),

-sbi

review: Needs Fixing
97. By Nicolas Bessi - Camptocamp

[PEP8]

98. By Nicolas Bessi - Camptocamp

[IMP] if no date on statement line, statement try to use ml_maturity_date or satement date

99. By Nicolas Bessi - Camptocamp

[IMP] module description

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

Hello

I have just done required modification. I also used the statement date as default fallback date instead of "now".

Regards

Nicolas

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

LGTM

review: Approve (code review rev99, test rev96)
Revision history for this message
Romain Deheele - Camptocamp (romaindeheele) wrote :

LGTM too

review: Approve (code review and test rev99)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'statement_voucher_killer/__openerp__.py'
2--- statement_voucher_killer/__openerp__.py 2013-02-28 12:48:45 +0000
3+++ statement_voucher_killer/__openerp__.py 2013-08-27 06:33:26 +0000
4@@ -19,7 +19,7 @@
5 #
6 ##############################################################################
7
8-{'name': 'voucher killer',
9+{'name': 'Satement voucher killer',
10 'version': '1.0.0',
11 'category': 'other',
12 'description': """
13@@ -27,7 +27,15 @@
14 #############################################################
15
16 When importing invoice or payment into a bank statement or a payment order, normally a
17-draft voucher is created on the line. This module will disable this voucher creation""",
18+draft voucher is created on the line. This module will disable this voucher creation.
19+When importing payment line, date used to populate statement
20+line will be take from imported line in this order:
21+
22+ * Date
23+ * Maturity date
24+ * Related statement date
25+
26+""",
27 'author': 'Camptocamp',
28 'website': 'http://www.camptocamp.com',
29 'depends': ['account_voucher', 'account_payment'],
30
31=== modified file 'statement_voucher_killer/voucher.py'
32--- statement_voucher_killer/voucher.py 2013-02-14 11:31:45 +0000
33+++ statement_voucher_killer/voucher.py 2013-08-27 06:33:26 +0000
34@@ -35,7 +35,7 @@
35 statement_id = context.get('statement_id', False)
36 if not statement_id:
37 return {'type': 'ir.actions.act_window_close'}
38- data = self.read(cr, uid, ids, context=context)[0]
39+ data = self.read(cr, uid, ids, context=context)[0]
40 line_ids = data['line_ids']
41 if not line_ids:
42 return {'type': 'ir.actions.act_window_close'}
43@@ -61,7 +61,7 @@
44 if line.amount_currency:
45 amount = currency_obj.compute(cr, uid, line.currency_id.id,
46 statement.currency.id, line.amount_currency, context=ctx)
47- elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id):
48+ elif (line.invoice and line.invoice.currency_id.id != statement.currency.id):
49 amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id,
50 statement.currency.id, amount, context=ctx)
51
52@@ -108,7 +108,7 @@
53
54 for line in line_obj.browse(cr, uid, line_ids, context=context):
55 ctx = context.copy()
56- ctx['date'] = line.ml_maturity_date # was value_date earlier,but this field exists no more now
57+ ctx['date'] = line.ml_maturity_date # Last value_date earlier,but this field exists no more now
58 amount = currency_obj.compute(cr, uid, line.currency.id,
59 statement.currency.id, line.amount_currency, context=ctx)
60 if not line.move_line_id.id:
61@@ -122,6 +122,7 @@
62 'account_id': line.move_line_id.account_id.id,
63 'statement_id': statement.id,
64 'ref': line.communication,
65+ 'date': line.date or line.ml_maturity_date or statement.date,
66 }, context=context)
67
68 line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id})

Subscribers

People subscribed via source and target branches