return product when parcel has product

This commit is contained in:
Raimon Esteve 2022-11-11 12:32:57 +01:00
parent 7365d9bb4a
commit 012564fc44
1 changed files with 1 additions and 2 deletions

View File

@ -174,9 +174,8 @@ class AgronomicsContractLine(ModelSQL, ModelView):
@fields.depends('parcel')
def on_change_with_product(self, name=None):
if self.parcel:
if self.parcel and self.parcel.product:
return self.parcel.product.id
return None
@fields.depends('product', methods=['on_change_with_product'])
def on_change_with_unit(self, name=None):