Check hasattr untaxed_amount from invoice
create_invoice() not return untaxed_amount (function field) to check is amount is receivable or payable In case has not untaxed_amount, get from on_change_with_amount()
This commit is contained in:
parent
5b0fbd7685
commit
a573906195
7
sale.py
7
sale.py
|
@ -84,7 +84,12 @@ class Sale(metaclass=PoolMeta):
|
|||
if self.payment_type and self.payment_type.kind == 'both':
|
||||
return self.payment_type
|
||||
|
||||
if invoice.untaxed_amount >= ZERO:
|
||||
if hasattr(invoice, 'untaxed_amount'):
|
||||
untaxed_amount = invoice.untaxed_amount
|
||||
else:
|
||||
untaxed_amount = sum(l.on_change_with_amount() for l in invoice.lines)
|
||||
|
||||
if untaxed_amount >= ZERO:
|
||||
kind = 'receivable'
|
||||
name = 'customer_payment_type'
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue