From fe895af798305540886f7e5425fd8bbb4545f364 Mon Sep 17 00:00:00 2001 From: Vincent Renaville Date: Fri, 23 Aug 2013 08:43:12 +0200 Subject: [PATCH 1/4] [FIX] add date of payment line instead of taking current date by default --- statement_voucher_killer/voucher.py | 1 + 1 file changed, 1 insertion(+) diff --git a/statement_voucher_killer/voucher.py b/statement_voucher_killer/voucher.py index b35f8159..9b25e9da 100644 --- a/statement_voucher_killer/voucher.py +++ b/statement_voucher_killer/voucher.py @@ -122,6 +122,7 @@ class AccountPaymentPopulateStatement(orm.TransientModel): 'account_id': line.move_line_id.account_id.id, 'statement_id': statement.id, 'ref': line.communication, + 'date': line.date, }, context=context) line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id}) From 2d96df888106bd167a3645eb5a7c663ccba1d09c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Aug 2013 08:13:17 +0200 Subject: [PATCH 2/4] [PEP8] --- statement_voucher_killer/voucher.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/statement_voucher_killer/voucher.py b/statement_voucher_killer/voucher.py index 9b25e9da..9b38772c 100644 --- a/statement_voucher_killer/voucher.py +++ b/statement_voucher_killer/voucher.py @@ -35,7 +35,7 @@ class AccountStatementFromInvoiceLines(orm.TransientModel): statement_id = context.get('statement_id', False) if not statement_id: return {'type': 'ir.actions.act_window_close'} - data = self.read(cr, uid, ids, context=context)[0] + data = self.read(cr, uid, ids, context=context)[0] line_ids = data['line_ids'] if not line_ids: return {'type': 'ir.actions.act_window_close'} @@ -61,7 +61,7 @@ class AccountStatementFromInvoiceLines(orm.TransientModel): if line.amount_currency: amount = currency_obj.compute(cr, uid, line.currency_id.id, statement.currency.id, line.amount_currency, context=ctx) - elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id): + elif (line.invoice and line.invoice.currency_id.id != statement.currency.id): amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id, statement.currency.id, amount, context=ctx) @@ -108,7 +108,7 @@ class AccountPaymentPopulateStatement(orm.TransientModel): for line in line_obj.browse(cr, uid, line_ids, context=context): ctx = context.copy() - ctx['date'] = line.ml_maturity_date # was value_date earlier,but this field exists no more now + ctx['date'] = line.ml_maturity_date # Last value_date earlier,but this field exists no more now amount = currency_obj.compute(cr, uid, line.currency.id, statement.currency.id, line.amount_currency, context=ctx) if not line.move_line_id.id: From a0eda5d15cb6f9ada9240631330bb477c80c064c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Aug 2013 08:20:04 +0200 Subject: [PATCH 3/4] [IMP] if no date on statement line, statement try to use ml_maturity_date or satement date --- statement_voucher_killer/voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statement_voucher_killer/voucher.py b/statement_voucher_killer/voucher.py index 9b38772c..6cc27608 100644 --- a/statement_voucher_killer/voucher.py +++ b/statement_voucher_killer/voucher.py @@ -122,7 +122,7 @@ class AccountPaymentPopulateStatement(orm.TransientModel): 'account_id': line.move_line_id.account_id.id, 'statement_id': statement.id, 'ref': line.communication, - 'date': line.date, + 'date': line.date or line.ml_maturity_date or statement.date, }, context=context) line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id}) From 54def1b6f1587f5f629a0bb367e1a1140db80737 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Aug 2013 08:29:57 +0200 Subject: [PATCH 4/4] [IMP] module description --- statement_voucher_killer/__openerp__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/statement_voucher_killer/__openerp__.py b/statement_voucher_killer/__openerp__.py index c29d760b..2460cd9a 100644 --- a/statement_voucher_killer/__openerp__.py +++ b/statement_voucher_killer/__openerp__.py @@ -19,7 +19,7 @@ # ############################################################################## -{'name': 'voucher killer', +{'name': 'Satement voucher killer', 'version': '1.0.0', 'category': 'other', 'description': """ @@ -27,7 +27,15 @@ Prevent voucher creation when importing lines into statement. ############################################################# When importing invoice or payment into a bank statement or a payment order, normally a -draft voucher is created on the line. This module will disable this voucher creation""", +draft voucher is created on the line. This module will disable this voucher creation. +When importing payment line, date used to populate statement +line will be take from imported line in this order: + + * Date + * Maturity date + * Related statement date + +""", 'author': 'Camptocamp', 'website': 'http://www.camptocamp.com', 'depends': ['account_voucher', 'account_payment'],