From c5a9314a0f34ffc334ae2283fb79029d3cb70aba Mon Sep 17 00:00:00 2001 From: Joel Grand-Guillaume Date: Mon, 26 Nov 2012 10:52:27 +0100 Subject: [PATCH 1/2] [FIX] Add a check on empty list to avoid a crash if no move lines in the related invoice. bzr revid: joel.grandguillaume@camptocamp.com-20121126095227-ubezcjc9q0mnr1gg --- addons/account_payment/account_invoice.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/account_payment/account_invoice.py b/addons/account_payment/account_invoice.py index 2ef894df4b5..750be5b3e96 100644 --- a/addons/account_payment/account_invoice.py +++ b/addons/account_payment/account_invoice.py @@ -33,8 +33,10 @@ class Invoice(osv.osv): def action_cancel(self, cr, uid, ids, context=None): payment_line_obj = self.pool.get('payment.line') for inv in self.browse(cr, uid, ids, context=context): - inv_mv_lines = [x.id for x in inv.move_id.line_id] - pl_line_ids = payment_line_obj.search(cr, uid, [('move_line_id','in',inv_mv_lines)], context=context) + pl_line_ids = False + if inv.move_id and inv.move_id.line_id: + inv_mv_lines = [x.id for x in inv.move_id.line_id] + pl_line_ids = payment_line_obj.search(cr, uid, [('move_line_id','in',inv_mv_lines)], context=context) if pl_line_ids: pay_line = payment_line_obj.browse(cr, uid, pl_line_ids, context=context) payment_order_name = ','.join(map(lambda x: x.order_id.reference, pay_line)) From 59bbb0206481256610d47f29bd8e3f42977b2d2a Mon Sep 17 00:00:00 2001 From: Joel Grand-Guillaume Date: Mon, 26 Nov 2012 10:58:34 +0100 Subject: [PATCH 2/2] [FIX] YAML test on account voucher : Create a second USD account for testing, avoiding one of the account constraint to raise. bzr revid: joel.grandguillaume@camptocamp.com-20121126095834-o29f5cwoffu2t0ic --- addons/account_voucher/test/case5_suppl_usd_usd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account_voucher/test/case5_suppl_usd_usd.yml b/addons/account_voucher/test/case5_suppl_usd_usd.yml index 3cae9667d84..2829c9ed440 100644 --- a/addons/account_voucher/test/case5_suppl_usd_usd.yml +++ b/addons/account_voucher/test/case5_suppl_usd_usd.yml @@ -4,7 +4,7 @@ - I create a cash account with currency USD - - !record {model: account.account, id: account_cash_usd_id}: + !record {model: account.account, id: account_cash_usd_id2}: currency_id: base.USD name: "cash account in usd" code: "Xcash usd" @@ -56,8 +56,8 @@ type: bank analytic_journal_id: account.sit sequence_id: account.sequence_bank_journal - default_debit_account_id: account_cash_usd_id - default_credit_account_id: account_cash_usd_id + default_debit_account_id: account_cash_usd_id2 + default_credit_account_id: account_cash_usd_id2 currency: base.USD company_id: base.main_company view_id: account.account_journal_bank_view