From fb041a6ae624730afd70df87bc7d13741f08d8cb Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Sat, 15 Dec 2012 16:19:49 +0100 Subject: [PATCH] [FIX] Backport of fix for OPW 574251, Vouchers get today's date or associated invoice's date --- account_banking/account_banking.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/account_banking/account_banking.py b/account_banking/account_banking.py index ed1b1e495..039e8e062 100644 --- a/account_banking/account_banking.py +++ b/account_banking/account_banking.py @@ -410,13 +410,19 @@ class account_bank_statement(osv.osv): 'account.bank.statement.line') st_line = account_bank_statement_line_obj.browse( cr, uid, st_line_id, context=context) + period_id = self._get_period( + cr, uid, st_line.date, context=context) # AB # Start account voucher # Post the voucher and update links between statement and moves if st_line.voucher_id: voucher_pool = self.pool.get('account.voucher') wf_service = netsvc.LocalService("workflow") voucher_pool.write( - cr, uid, [st_line.voucher_id.id], {'number': st_line_number}, context=context) + cr, uid, [st_line.voucher_id.id], { + 'number': st_line_number, + 'date': st_line.date, + 'period_id': period_id, # AB + }, context=context) if st_line.voucher_id.state == 'cancel': voucher_pool.action_cancel_draft( cr, uid, [st_line.voucher_id.id], context=context) @@ -443,8 +449,6 @@ class account_bank_statement(osv.osv): context.update({'date': st_line.date}) ctxt = context.copy() # AB ctxt['company_id'] = st_line.company_id.id # AB - period_id = self._get_period( - cr, uid, st_line.date, context=ctxt) # AB move_id = account_move_obj.create(cr, uid, { 'journal_id': st.journal_id.id,