diff options
| author | svs-odoo <svs@odoo.com> | 2020-05-18 15:35:08 +0000 |
|---|---|---|
| committer | svs-odoo <svs@odoo.com> | 2020-05-18 15:35:08 +0000 |
| commit | 4ec07602aaa349adb7ad99e04c33067375e8e734 (patch) | |
| tree | 0b00786a83b22f221a248bfb2154db82732c3682 /addons | |
| parent | 049745c5fffcd11894cd5f9b38078c993d2ef969 (diff) | |
[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>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/product_expiry/models/stock_quant.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/addons/product_expiry/models/stock_quant.py b/addons/product_expiry/models/stock_quant.py index af036fcdc3c..1a5ce2f6b17 100644 --- a/addons/product_expiry/models/stock_quant.py +++ b/addons/product_expiry/models/stock_quant.py @@ -10,6 +10,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': return 'removal_date, in_date, id' |
