[FIX] product_expiry: update quantity on hand

Before this commit, when the user tries to create a new quant, even if
the product doesn't use an expiration date, he/she will not be able to
create the quant.
The issue was as `removal_date` field is added by `product_expiry` in
the quant list view, the field is on the values used to create a new
quant but not in the list of accepted field for quant creation.
So, it raises an UserError.

task-2260085

closes odoo/odoo#51482

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
svs-odoo
2020-05-18 15:35:08 +00:00
parent 049745c5ff
commit 4ec07602aa
@@ -9,6 +9,14 @@ class StockQuant(models.Model):
removal_date = fields.Datetime(related='lot_id.removal_date', store=True, readonly=False)
@api.model
def _get_inventory_fields_create(self):
""" Returns a list of fields user can edit when he want to create a quant in `inventory_mode`.
"""
res = super()._get_inventory_fields_create()
res += ['removal_date']
return res
@api.model
def _get_removal_strategy_order(self, removal_strategy):
if removal_strategy == 'fefo':