[FIX] account: invoice tracebacks
When the company field is empty on an invoice, tracebacks occur. Fixes #14410 opw-694476
This commit is contained in:
@@ -49,7 +49,7 @@ class AccountInvoice(models.Model):
|
|||||||
self.amount_total = self.amount_untaxed + self.amount_tax
|
self.amount_total = self.amount_untaxed + self.amount_tax
|
||||||
amount_total_company_signed = self.amount_total
|
amount_total_company_signed = self.amount_total
|
||||||
amount_untaxed_signed = self.amount_untaxed
|
amount_untaxed_signed = self.amount_untaxed
|
||||||
if self.currency_id and self.currency_id != self.company_id.currency_id:
|
if self.currency_id and self.company_id and self.currency_id != self.company_id.currency_id:
|
||||||
currency_id = self.currency_id.with_context(date=self.date_invoice)
|
currency_id = self.currency_id.with_context(date=self.date_invoice)
|
||||||
amount_total_company_signed = currency_id.compute(self.amount_total, self.company_id.currency_id)
|
amount_total_company_signed = currency_id.compute(self.amount_total, self.company_id.currency_id)
|
||||||
amount_untaxed_signed = currency_id.compute(self.amount_untaxed, self.company_id.currency_id)
|
amount_untaxed_signed = currency_id.compute(self.amount_untaxed, self.company_id.currency_id)
|
||||||
@@ -1103,7 +1103,7 @@ class AccountInvoiceLine(models.Model):
|
|||||||
if self.invoice_line_tax_ids:
|
if self.invoice_line_tax_ids:
|
||||||
taxes = self.invoice_line_tax_ids.compute_all(price, currency, self.quantity, product=self.product_id, partner=self.invoice_id.partner_id)
|
taxes = self.invoice_line_tax_ids.compute_all(price, currency, self.quantity, product=self.product_id, partner=self.invoice_id.partner_id)
|
||||||
self.price_subtotal = price_subtotal_signed = taxes['total_excluded'] if taxes else self.quantity * price
|
self.price_subtotal = price_subtotal_signed = taxes['total_excluded'] if taxes else self.quantity * price
|
||||||
if self.invoice_id.currency_id and self.invoice_id.currency_id != self.invoice_id.company_id.currency_id:
|
if self.invoice_id.currency_id and self.invoice_id.company_id and self.invoice_id.currency_id != self.invoice_id.company_id.currency_id:
|
||||||
price_subtotal_signed = self.invoice_id.currency_id.compute(price_subtotal_signed, self.invoice_id.company_id.currency_id)
|
price_subtotal_signed = self.invoice_id.currency_id.compute(price_subtotal_signed, self.invoice_id.company_id.currency_id)
|
||||||
sign = self.invoice_id.type in ['in_refund', 'out_refund'] and -1 or 1
|
sign = self.invoice_id.type in ['in_refund', 'out_refund'] and -1 or 1
|
||||||
self.price_subtotal_signed = price_subtotal_signed * sign
|
self.price_subtotal_signed = price_subtotal_signed * sign
|
||||||
|
|||||||
Reference in New Issue
Block a user