[FIX] account_voucher : Wrong payment date when invoice is paid from bank statement...
authorSomesh Khare (OpenERP) <skh@openerp.com>
Wed, 8 May 2013 06:18:41 +0000 (11:48 +0530)
committerSomesh Khare (OpenERP) <skh@openerp.com>
Wed, 8 May 2013 06:18:41 +0000 (11:48 +0530)
bzr revid: skh@openerp.com-20130508061841-mmpytzw9rk7v90ly

addons/account_voucher/account_voucher.py
addons/account_voucher/wizard/account_statement_from_invoice.py

index 4b4639d..fabd18b 100644 (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)
index fce251d..92d2ebf 100644 (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'}