Test purchase/sale is filled before using it

issue9770
review300771002
This commit is contained in:
Cédric Krier
2020-10-30 00:10:37 +01:00
parent 2111145bcc
commit b44af7b1bf
+3 -1
View File
@@ -1244,7 +1244,9 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
@fields.depends('purchase', 'company', '_parent_purchase.party',)
def _get_product_supplier_pattern(self):
return {
'party': self.purchase.party.id if self.purchase.party else -1,
'party': (
self.purchase.party.id
if self.purchase and self.purchase.party else -1),
'company': (self.company.id if self.company else -1),
}