[FIX] account_voucher : Wrong payment date when invoice is paid from bank statement, code forward-port from 6.1 revision 6966 (Ref : Case 592393)

bzr revid: skh@openerp.com-20130509063512-s5lgoqit9hdszd40
This commit is contained in:
Somesh Khare (OpenERP) 2013-05-09 12:05:12 +05:30
commit fdd7756ffc
2 changed files with 6 additions and 2 deletions

View File

@ -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)

View File

@ -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'}