summaryrefslogtreecommitdiff
path: root/addons/product_expiry
diff options
context:
space:
mode:
authorsvs-odoo <svs@odoo.com>2020-01-02 11:02:53 +0000
committersvs-odoo <svs@odoo.com>2020-01-06 19:46:04 +0000
commitd67b1471a3724bc42b197c5b9cac633ccd518b33 (patch)
tree839616accc95d32b31e9890880baad5748be199a /addons/product_expiry
parenteb3257ef21aff01e9b2b745fb5281f6edf0f9234 (diff)
[FIX] product_expiry: editable expiration_date
Before this commit, in the move line view, the field `expiration_date` was readonly even when it must be editable. It was because the condition who defines if the field is readonly or not was wrong. Also, removed the field `expiration_date_readonly` as it mainly referred to `picking_type_use_existing_lots`, and use this latter instead. task-2166230 X-original-commit: f1b8426919dc049df447d50ed3ac365eec2897c3
Diffstat (limited to 'addons/product_expiry')
-rw-r--r--addons/product_expiry/models/stock_move_line.py6
-rw-r--r--addons/product_expiry/views/stock_move_views.xml8
2 files changed, 4 insertions, 10 deletions
diff --git a/addons/product_expiry/models/stock_move_line.py b/addons/product_expiry/models/stock_move_line.py
index 569e8c03034..db8956563d2 100644
--- a/addons/product_expiry/models/stock_move_line.py
+++ b/addons/product_expiry/models/stock_move_line.py
@@ -9,16 +9,10 @@ from odoo import api, fields, models
class StockMoveLine(models.Model):
_inherit = "stock.move.line"
- expiration_date_readonly = fields.Boolean(compute='_compute_expiration_date_readonly')
expiration_date = fields.Datetime(string='Expiration Date',
help='This is the date on which the goods with this Serial Number may'
' become dangerous and must not be consumed.')
- @api.depends('picking_id', 'product_id')
- def _compute_expiration_date_readonly(self):
- for line in self:
- line.expiration_date_readonly = bool(not line.picking_id.picking_type_id.use_existing_lots and line.product_id.use_expiration_date)
-
@api.onchange('product_id', 'product_uom_id')
def onchange_product_id(self):
res = super(StockMoveLine, self).onchange_product_id()
diff --git a/addons/product_expiry/views/stock_move_views.xml b/addons/product_expiry/views/stock_move_views.xml
index 79fe265aaad..98f62fe6764 100644
--- a/addons/product_expiry/views/stock_move_views.xml
+++ b/addons/product_expiry/views/stock_move_views.xml
@@ -18,10 +18,10 @@
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='lot_name']" position="after" >
- <field name="expiration_date_readonly" invisible="1"/>
+ <field name="picking_type_use_existing_lots" invisible="1"/>
<field name="expiration_date" force_save="1" attrs="{
'column_invisible': ['|', ('parent.use_expiration_date', '!=', True), ('parent.picking_code', '!=', 'incoming')],
- 'readonly': [('expiration_date_readonly', '=', True)],
+ 'readonly': [('picking_type_use_existing_lots', '=', True)],
}"/>
</xpath>
</field>
@@ -33,10 +33,10 @@
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='lot_name']" position="after">
- <field name="expiration_date_readonly" invisible="1"/>
+ <field name="picking_type_use_existing_lots" invisible="1"/>
<field name="expiration_date" force_save="1" attrs="{
'column_invisible': [('parent.picking_type_code', '!=', 'incoming')],
- 'readonly': [('expiration_date_readonly', '=', True)],
+ 'readonly': [('picking_type_use_existing_lots', '=', True)],
}"/>
</xpath>
</field>