minor fix

This commit is contained in:
wilson gomez 2021-12-09 14:43:12 -05:00
parent 8050a6cdbf
commit d8dc97c8e4

View file

@ -68,7 +68,8 @@ class Line(metaclass=PoolMeta):
digits=(16, Eval('default_uom_digits', 2))),
'on_change_with_stock_quantity')
@fields.depends('product')
@fields.depends('product', 'purchase',
'_parent_purchase.warehouse')
def on_change_with_stock_quantity(self, name=None):
if self.product:
context = {'stock_date_end': date.today()}
@ -82,6 +83,7 @@ class Line(metaclass=PoolMeta):
location_ids = [l.storage_location.id for l in locations if l.storage_location]
else:
location_ids = [self.purchase.warehouse.storage_location.id]
product_ids = [self.product.id]
quantity = 0
with Transaction().set_context(context):