diff --git a/addons/product_expiry/models/product_product.py b/addons/product_expiry/models/product_product.py index 964fa7820ba..9f70ba56b7f 100644 --- a/addons/product_expiry/models/product_product.py +++ b/addons/product_expiry/models/product_product.py @@ -4,6 +4,16 @@ from odoo import fields, models +class Product(models.Model): + _inherit = "product.product" + + def action_open_quants(self): + # Override to hide the `removal_date` column if not needed. + if not any(product.use_expiration_date for product in self): + self = self.with_context(hide_removal_date=True) + return super().action_open_quants() + + class ProductTemplate(models.Model): _inherit = 'product.template' diff --git a/addons/product_expiry/views/stock_quant_views.xml b/addons/product_expiry/views/stock_quant_views.xml index f6d8204b508..7415b66f371 100644 --- a/addons/product_expiry/views/stock_quant_views.xml +++ b/addons/product_expiry/views/stock_quant_views.xml @@ -37,8 +37,9 @@ removal_date < current_date or inventory_quantity < 0 - - + +