[FIX] account_voucher: force date and period update on voucher when confirming bank statement + take statement date as default statement line date

bzr revid: rha@tinyerp.com-20120502132443-f8hqcr9lq053lu1t
This commit is contained in:
Rifakat
2012-05-02 18:54:43 +05:30
parent 90f82f4efe
commit 64bbf7eefb
+5 -1
View File
@@ -1421,7 +1421,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)