Skip to content
Snippets Groups Projects
Commit e5d3f2a1 authored by svs-odoo's avatar svs-odoo
Browse files

[IMP] product_expiry: hide removal date on quant


When user goes on product's quants, hides the "Removal Date" field if
the product doesn't use expiration dates.
Also, set it as optional to be hide if the user wants.

closes odoo/odoo#39425

Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
parent 5ac04570
Branches
Tags
No related merge requests found
......@@ -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'
......
......@@ -37,8 +37,9 @@
removal_date &lt; current_date or inventory_quantity &lt; 0
</attribute>
</xpath>
<xpath expr="//field[@name='inventory_quantity']" position="before" >
<field name="removal_date"/>
<xpath expr="//field[@name='inventory_quantity']" position="before">
<field name="removal_date" optional="show"
invisible="context.get('hide_removal_date')"/>
</xpath>
</field>
</record>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment