fix default_get to ensure product_qty is not set

This commit is contained in:
Yannick Vaucher
2014-09-03 16:20:08 +02:00
committed by Alexandre Fayolle
parent 2cec2e50ff
commit b664229bb9

View File

@@ -59,6 +59,17 @@ class StockReservation(models.Model):
select=1)
date_validity = fields.Date('Validity Date')
@api.model
def default_get(self, fields_list):
"""
Ensure default value of computed field `product_qty` is not set
as it would raise an error
"""
res = super(StockReservation, self).default_get(fields_list)
if 'product_qty' in res:
del res['product_qty']
return res
@api.model
def get_location_from_ref(self, ref):
""" Get a location from a xmlid if allowed