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
=== modified file 'statement_voucher_killer/__openerp__.py'
--- statement_voucher_killer/__openerp__.py 2013-02-28 12:48:45 +0000
+++ statement_voucher_killer/__openerp__.py 2013-08-27 06:33:26 +0000
@@ -19,7 +19,7 @@
19#19#
20##############################################################################20##############################################################################
2121
22{'name': 'voucher killer',22{'name': 'Satement voucher killer',
23 'version': '1.0.0',23 'version': '1.0.0',
24 'category': 'other',24 'category': 'other',
25 'description': """25 'description': """
@@ -27,7 +27,15 @@
27#############################################################27#############################################################
2828
29When importing invoice or payment into a bank statement or a payment order, normally a29When importing invoice or payment into a bank statement or a payment order, normally a
30draft voucher is created on the line. This module will disable this voucher creation""",30draft voucher is created on the line. This module will disable this voucher creation.
31When importing payment line, date used to populate statement
32line will be take from imported line in this order:
33
34 * Date
35 * Maturity date
36 * Related statement date
37
38""",
31 'author': 'Camptocamp',39 'author': 'Camptocamp',
32 'website': 'http://www.camptocamp.com',40 'website': 'http://www.camptocamp.com',
33 'depends': ['account_voucher', 'account_payment'],41 'depends': ['account_voucher', 'account_payment'],
3442
=== modified file 'statement_voucher_killer/voucher.py'
--- statement_voucher_killer/voucher.py 2013-02-14 11:31:45 +0000
+++ statement_voucher_killer/voucher.py 2013-08-27 06:33:26 +0000
@@ -35,7 +35,7 @@
35 statement_id = context.get('statement_id', False)35 statement_id = context.get('statement_id', False)
36 if not statement_id:36 if not statement_id:
37 return {'type': 'ir.actions.act_window_close'}37 return {'type': 'ir.actions.act_window_close'}
38 data = self.read(cr, uid, ids, context=context)[0]38 data = self.read(cr, uid, ids, context=context)[0]
39 line_ids = data['line_ids']39 line_ids = data['line_ids']
40 if not line_ids:40 if not line_ids:
41 return {'type': 'ir.actions.act_window_close'}41 return {'type': 'ir.actions.act_window_close'}
@@ -61,7 +61,7 @@
61 if line.amount_currency:61 if line.amount_currency:
62 amount = currency_obj.compute(cr, uid, line.currency_id.id,62 amount = currency_obj.compute(cr, uid, line.currency_id.id,
63 statement.currency.id, line.amount_currency, context=ctx)63 statement.currency.id, line.amount_currency, context=ctx)
64 elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id):64 elif (line.invoice and line.invoice.currency_id.id != statement.currency.id):
65 amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id,65 amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id,
66 statement.currency.id, amount, context=ctx)66 statement.currency.id, amount, context=ctx)
6767
@@ -108,7 +108,7 @@
108108
109 for line in line_obj.browse(cr, uid, line_ids, context=context):109 for line in line_obj.browse(cr, uid, line_ids, context=context):
110 ctx = context.copy()110 ctx = context.copy()
111 ctx['date'] = line.ml_maturity_date # was value_date earlier,but this field exists no more now111 ctx['date'] = line.ml_maturity_date # Last value_date earlier,but this field exists no more now
112 amount = currency_obj.compute(cr, uid, line.currency.id,112 amount = currency_obj.compute(cr, uid, line.currency.id,
113 statement.currency.id, line.amount_currency, context=ctx)113 statement.currency.id, line.amount_currency, context=ctx)
114 if not line.move_line_id.id:114 if not line.move_line_id.id:
@@ -122,6 +122,7 @@
122 'account_id': line.move_line_id.account_id.id,122 'account_id': line.move_line_id.account_id.id,
123 'statement_id': statement.id,123 'statement_id': statement.id,
124 'ref': line.communication,124 'ref': line.communication,
125 'date': line.date or line.ml_maturity_date or statement.date,
125 }, context=context)126 }, context=context)
126127
127 line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id})128 line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id})

Subscribers

People subscribed via source and target branches