1
0
Fork 0
mirror of synced 2023-12-13 21:20:09 +01:00

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:
Raimon Esteve 2022-08-18 11:19:04 +02:00
parent f28136cd5d
commit e3b56c4a8f

View file

@ -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: