From 5c768d51d39ff812e71652c98da23648534e5d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Miguel=20Pardo=20Salar?= Date: Tue, 1 Jun 2021 18:36:55 +0200 Subject: [PATCH] Fixed bug This commit refs #18386 --- sale.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sale.py b/sale.py index 95fe8a3..bd05609 100644 --- a/sale.py +++ b/sale.py @@ -6,9 +6,6 @@ from trytond.pool import PoolMeta, Pool from trytond.pyson import Eval from trytond.transaction import Transaction -__all__ = ['Sale', 'SaleCreditLimit', 'CostType', 'CostTemplate', - 'CostSale', 'CostSale2'] - class Sale(metaclass=PoolMeta): __name__ = 'sale.sale' @@ -120,9 +117,11 @@ class CostSale2(metaclass=PoolMeta): @fields.depends('formula', 'document', 'invoice_party', 'apply_method') def _load_invoice_party(self): - if 'carrier_amount' in self.formula and self.document and \ - self.document.loads and self.apply_method == 'invoice_in' and \ - not self.invoice_party and self.document.loads[0].load.carrier: + if (self.formula and 'carrier_amount' in self.formula and + self.document and self.document.loads and + self.apply_method == 'invoice_in' and + not self.invoice_party and + self.document.loads[0].load.carrier): self.invoice_party = self.document.loads[0].load.carrier.party @fields.depends(methods=['_load_invoice_party'])