From b46fa9e392e651a3143eb8d40336b8dd482a3e7f Mon Sep 17 00:00:00 2001 From: "nel@tinyerp.com" <> Date: Wed, 21 Jul 2010 20:37:19 +0200 Subject: [PATCH] [FIX] CODA IMPORT bzr revid: nel@tinyerp.com-20100721183719-kvtzdgo8vzc3fvdy --- addons/account/invoice.py | 4 +++- addons/account_coda/wizard/account_coda_import.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index bca5770accc..f5ebc5b3d3d 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -890,7 +890,9 @@ class account_invoice(osv.osv): new_move_name = self.pool.get('account.move').browse(cr, uid, move_id).name # make the invoice point to that move self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name}) - self.pool.get('account.move').post(cr, uid, [move_id]) + # Pass invoice in context in method post: used if you want to get the same + # account move reference when creating the same invoice after a cancelled one: + self.pool.get('account.move').post(cr, uid, [move_id], context={'invoice':inv}) self._log_event(cr, uid, ids) return True diff --git a/addons/account_coda/wizard/account_coda_import.py b/addons/account_coda/wizard/account_coda_import.py index 297534542b1..f62a307c3c5 100644 --- a/addons/account_coda/wizard/account_coda_import.py +++ b/addons/account_coda/wizard/account_coda_import.py @@ -208,7 +208,8 @@ class account_coda_import(osv.osv_memory): line=lines[value] reconcile_id = False if line['toreconcile']: - rec_id = move_line_obj.search(cr, uid, [('name', '=', line['name']), ('reconcile_id', '=', False), ('account_id.reconcile', '=', True)]) + name = line['name'][:3] + '/' + line['name'][3:7] + '/' + line['name'][7:] + rec_id = pool.get('account.move.line').search(cr, uid, [('name','=', name),('reconcile_id','=',False),('account_id.reconcile','=',True)]) if rec_id: reconcile_id = statement_reconcile_obj.create(cr, uid, { 'line_ids': [(6, 0, rec_id)] @@ -296,4 +297,4 @@ class account_coda_import(osv.osv_memory): account_coda_import() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: