mirror of
https://gitlab.com/datalifeit/trytond-aeat_sii
synced 2023-12-13 20:30:37 +01:00
Fix problem when control if invoice is a credit not and the field to take information is invoice tax
This commit is contained in:
parent
5596207c1f
commit
be9baab833
|
@ -27,8 +27,14 @@ def _amount_getter(field_name):
|
||||||
def is_credit_note(invoice):
|
def is_credit_note(invoice):
|
||||||
return (invoice.type in {'in_credit_note', 'out_credit_note'})
|
return (invoice.type in {'in_credit_note', 'out_credit_note'})
|
||||||
|
|
||||||
def amount_getter(self, invoice):
|
def amount_getter(self, field):
|
||||||
val = attrgetter(field_name)(invoice)
|
pool = Pool()
|
||||||
|
InvoiceTax = pool.get('account.invoice.tax')
|
||||||
|
if isinstance(field, InvoiceTax):
|
||||||
|
invoice = field.invoice
|
||||||
|
else:
|
||||||
|
invoice = field
|
||||||
|
val = attrgetter(field_name)(field)
|
||||||
return val if val is None or not is_credit_note(invoice) else -val
|
return val if val is None or not is_credit_note(invoice) else -val
|
||||||
return amount_getter
|
return amount_getter
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue