[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
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -6,20 +6,24 @@
|
||||
<field name="name">mrp.production.tree</field>
|
||||
<field name="model">mrp.production</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree decoration-bf="message_needaction==True" default_order="date_planned_start desc" decoration-info="state=='confirmed'" decoration-danger="date_planned_start<current_date and state not in ('done','cancel')" decoration-muted="state in ('done','cancel')" string="Manufacturing Orders">
|
||||
<tree string="Manufacturing Orders" default_order="date_planned_start desc"
|
||||
decoration-bf="message_needaction==True" decoration-info="state=='confirmed'"
|
||||
decoration-danger="date_planned_start<current_date and state not in ('done','cancel')"
|
||||
decoration-muted="state in ('done','cancel')" multi_edit="1">
|
||||
<field name="message_needaction" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="date_planned_start" optional="show"/>
|
||||
<field name="product_id" optional="show"/>
|
||||
<field name="date_planned_start" readonly="1" optional="show"
|
||||
attrs="{'readonly': [('state', 'in', ['done', 'cancel'])]}"/>
|
||||
<field name="product_id" readonly="1" optional="show"/>
|
||||
<field name="product_uom_id" string="Unit of Measure" options="{'no_open':True,'no_create':True}" groups="uom.group_uom" optional="show"/>
|
||||
<field name="bom_id" optional="hide"/>
|
||||
<field name="bom_id" readonly="1" optional="hide"/>
|
||||
<field name="origin" optional="show"/>
|
||||
<field name="user_id" optional="hide"/>
|
||||
<field name="routing_id" groups="mrp.group_mrp_routings" optional="show"/>
|
||||
<field name="reservation_state" optional="show"/>
|
||||
<field name="product_qty" sum="Total Qty" string="Quantity" optional="show"/>
|
||||
<field name="product_qty" sum="Total Qty" string="Quantity" readonly="1" optional="show"/>
|
||||
<field name="state" optional="show"/>
|
||||
<field name="company_id" groups="base.group_multi_company" optional="show"/>
|
||||
<field name="company_id" readonly="1" groups="base.group_multi_company" optional="show"/>
|
||||
<field name="activity_exception_decoration" widget="activity_exception"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user