Mercurial > hgweb > health
changeset 5162:caa01afaaaeb
health_insurance: Fix bug #62598: Payment term search stops in party
| author | Luis Falcon <falcon@gnuhealth.org> |
|---|---|
| date | Wed, 08 Jun 2022 18:54:46 +0100 |
| parents | 227cc26317f7 |
| children | 2120f026ab26 |
| files | tryton/health_insurance/wizard/wizard_health_insurance.py |
| diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health_insurance/wizard/wizard_health_insurance.py +++ b/tryton/health_insurance/wizard/wizard_health_insurance.py @@ -151,13 +151,21 @@ invoice_data['invoice_address'] = party_address.id invoice_data['reference'] = service.name - if not party.customer_payment_term: + """ Look for the payment term in the following order: + * Party + * Default payment term in accounting config + * Raise an error if there is no payment term + """ + if (party.customer_payment_term): + invoice_data['payment_term'] = party.customer_payment_term.id + elif (acct_config.default_customer_payment_term): + invoice_data['payment_term'] = \ + acct_config.default_customer_payment_term.id + else: raise NoPaymentTerm( gettext('health_insurance.msg_no_payment_term') ) - invoice_data['payment_term'] = party.customer_payment_term.id - # Invoice Lines seq = 0 invoice_lines = []
