diff --git a/addons/product_expiry/models/stock_quant.py b/addons/product_expiry/models/stock_quant.py index 29a6fee3cba..91e0ad1fc8a 100644 --- a/addons/product_expiry/models/stock_quant.py +++ b/addons/product_expiry/models/stock_quant.py @@ -7,25 +7,9 @@ from odoo import api, fields, models class StockQuant(models.Model): _inherit = 'stock.quant' - expiration_date = fields.Datetime(related='lot_id.expiration_date', store=True, readonly=False) - removal_date = fields.Datetime(related='lot_id.removal_date', store=True, readonly=False) - use_expiration_date = fields.Boolean(related='product_id.use_expiration_date', readonly=True) - - @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 += ['expiration_date', 'removal_date'] - return res - - @api.model - def _get_inventory_fields_write(self): - """ Returns a list of fields user can edit when he want to edit a quant in `inventory_mode`. - """ - res = super()._get_inventory_fields_write() - res += ['expiration_date', 'removal_date'] - return res + expiration_date = fields.Datetime(related='lot_id.expiration_date', store=True) + removal_date = fields.Datetime(related='lot_id.removal_date', store=True) + use_expiration_date = fields.Boolean(related='product_id.use_expiration_date') @api.model def _get_removal_strategy_domain_order(self, domain, removal_strategy, qty): diff --git a/addons/product_expiry/views/stock_quant_views.xml b/addons/product_expiry/views/stock_quant_views.xml index 8d2a4744c98..e9b21cba8d0 100644 --- a/addons/product_expiry/views/stock_quant_views.xml +++ b/addons/product_expiry/views/stock_quant_views.xml @@ -23,10 +23,8 @@ - - + + @@ -39,8 +37,7 @@ + optional="hide" invisible="context.get('hide_removal_date')"/>