From a4ecbdb90decf1d14ed65134aaf618b6c6a42645 Mon Sep 17 00:00:00 2001 From: svs-odoo Date: Tue, 1 Oct 2019 10:02:14 +0000 Subject: [PATCH] [IMP] mrp: editable mrp production list view Set also `origin` and `user_id` fields as readonly when the manufacturing order state is done or cancel. Task #2078163 --- addons/mrp/models/mrp_production.py | 2 ++ addons/mrp/views/mrp_production_views.xml | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index a03841a3b1b..67a4a60d03d 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -56,6 +56,7 @@ class MrpProduction(models.Model): 'Reference', copy=False, readonly=True, default=lambda x: _('New')) origin = fields.Char( 'Source', copy=False, + states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, help="Reference of the document that generated this production order request.") product_id = fields.Many2one( @@ -191,6 +192,7 @@ class MrpProduction(models.Model): help='Technical field to check when we can post') user_id = fields.Many2one( 'res.users', 'Responsible', default=lambda self: self.env.user, + states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, domain=lambda self: [('groups_id', 'in', self.env.ref('mrp.group_mrp_user').id)]) company_id = fields.Many2one( 'res.company', 'Company', default=lambda self: self.env.company, diff --git a/addons/mrp/views/mrp_production_views.xml b/addons/mrp/views/mrp_production_views.xml index 45e378810db..17eb2362377 100644 --- a/addons/mrp/views/mrp_production_views.xml +++ b/addons/mrp/views/mrp_production_views.xml @@ -6,20 +6,24 @@ mrp.production.tree mrp.production - + - - + + - + - + - +