[FIX] account_voucher: force date and period update on voucher when confirming bank...
authorRifakat <rha@tinyerp.com>
Wed, 2 May 2012 13:24:43 +0000 (18:54 +0530)
committerRifakat <rha@tinyerp.com>
Wed, 2 May 2012 13:24:43 +0000 (18:54 +0530)
bzr revid: rha@tinyerp.com-20120502132443-f8hqcr9lq053lu1t

addons/account_voucher/account_voucher.py

index 5b9726c..88e00f7 100644 (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)