From 21047bc3f68dd0ad7638e785170971dae24745bb Mon Sep 17 00:00:00 2001 From: "Somesh Khare (OpenERP)" Date: Wed, 8 May 2013 11:48:41 +0530 Subject: [PATCH 1/2] [FIX] account_voucher : Wrong payment date when invoice is paid from bank statement (Ref : Case 592393) bzr revid: skh@openerp.com-20130508061841-mmpytzw9rk7v90ly --- addons/account_voucher/account_voucher.py | 6 +++++- .../wizard/account_statement_from_invoice.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 4b4639daeb6..fabd18bdbbe 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1582,7 +1582,11 @@ class account_bank_statement(osv.osv): bank_st_line_obj = self.pool.get('account.bank.statement.line') st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context) if st_line.voucher_id: - voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context) + voucher_obj.write(cr, uid, [st_line.voucher_id.id], + {'number': next_number, + 'date': st_line.date, + 'period_id': st_line.statement_id.period_id.id}, + context=context) if st_line.voucher_id.state == 'cancel': voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context) wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr) diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py index fce251df175..92d2ebf9173 100644 --- a/addons/account_voucher/wizard/account_statement_from_invoice.py +++ b/addons/account_voucher/wizard/account_statement_from_invoice.py @@ -119,7 +119,7 @@ class account_statement_from_invoice_lines(osv.osv_memory): 'statement_id': statement_id, 'ref': line.ref, 'voucher_id': voucher_id, - 'date': time.strftime('%Y-%m-%d'), + 'date': statement.date, }, context=context) return {'type': 'ir.actions.act_window_close'} From da6e1fcc6b6bea2a7e6c58d55a31c12e8135c575 Mon Sep 17 00:00:00 2001 From: Niels Huylebroeck Date: Wed, 8 May 2013 18:09:10 +0200 Subject: [PATCH 2/2] [FIX] account_voucher: when importing invoices the payment date should be set to the statement date instead of being set to the original invoice date lp bug: https://launchpad.net/bugs/1127198 fixed bzr revid: nh@agaplan.eu-20130508160910-xk1pljvn1aco8417 --- .../account_voucher/wizard/account_statement_from_invoice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py index fce251df175..289a110fdbd 100644 --- a/addons/account_voucher/wizard/account_statement_from_invoice.py +++ b/addons/account_voucher/wizard/account_statement_from_invoice.py @@ -94,7 +94,7 @@ class account_statement_from_invoice_lines(osv.osv_memory): 'account_id': result['value'].get('account_id', statement.journal_id.default_credit_account_id.id), 'company_id': statement.company_id.id, 'currency_id': statement.currency.id, - 'date': line.date, + 'date': statement.date, 'amount': sign*amount, 'payment_rate': result['value']['payment_rate'], 'payment_rate_currency_id': result['value']['payment_rate_currency_id'], @@ -119,7 +119,7 @@ class account_statement_from_invoice_lines(osv.osv_memory): 'statement_id': statement_id, 'ref': line.ref, 'voucher_id': voucher_id, - 'date': time.strftime('%Y-%m-%d'), + 'date': statement.date, }, context=context) return {'type': 'ir.actions.act_window_close'}