From f6187df18c01c52c77c2d8e7f77864e77af69e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 6 Dec 2012 19:31:04 +0100 Subject: [PATCH] Add missing test on code before using it issue2913 review594007 --- invoice.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/invoice.py b/invoice.py index ddf979d05a..a30cb2a30f 100644 --- a/invoice.py +++ b/invoice.py @@ -1927,15 +1927,19 @@ class InvoiceTax(ModelSQL, ModelView): else: invoice_type = 'out_invoice' if invoice_type in ('out_invoice', 'in_invoice'): - changes['base_code'] = tax.invoice_base_code.id + changes['base_code'] = (tax.invoice_base_code.id + if tax.invoice_base_code else None) changes['base_sign'] = tax.invoice_base_sign - changes['tax_code'] = tax.invoice_tax_code.id + changes['tax_code'] = (tax.invoice_tax_code.id + if tax.invoice_tax_code else None) changes['tax_sign'] = tax.invoice_tax_sign changes['account'] = tax.invoice_account.id else: - changes['base_code'] = tax.credit_note_base_code.id + changes['base_code'] = (tax.credit_note_base_code.id + if tax.credit_note_base_code else None) changes['base_sign'] = tax.credit_note_base_sign - changes['tax_code'] = tax.credit_note_tax_code.id + changes['tax_code'] = (tax.credit_note_tax_code.id + if tax.credit_note_tax_code else None) changes['tax_sign'] = tax.credit_note_tax_sign changes['account'] = tax.credit_note_account.id return changes