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

[IMP] stock: editable scrap order list view

Sets `date_done` and `state` fields as readonly in the model as they
must not be editable in the list view and they were already readonly
in form view.

Task #2078163
parent dc5254cb
No related branches found
No related tags found
No related merge requests found
......@@ -55,8 +55,9 @@ class StockScrap(models.Model):
scrap_qty = fields.Float('Quantity', default=1.0, required=True, states={'done': [('readonly', True)]})
state = fields.Selection([
('draft', 'Draft'),
('done', 'Done')], string='Status', default="draft", tracking=True)
date_done = fields.Datetime('Date')
('done', 'Done')],
string='Status', default="draft", readonly=True, tracking=True)
date_done = fields.Datetime('Date', readonly=True)
@api.onchange('picking_id')
def _onchange_picking_id(self):
......
......@@ -60,7 +60,7 @@
<field name="location_id" options="{'no_create': True, 'no_open': True}" groups="stock.group_stock_multi_locations" force_save="1"/>
<field name="scrap_location_id" options="{'no_create': True, 'no_open': True}" groups="stock.group_stock_multi_locations" force_save="1"/>
<field name="origin"/>
<field name="date_done" readonly="1" attrs="{'invisible': [('state', '=', 'draft')]}"/>
<field name="date_done" attrs="{'invisible': [('state', '=', 'draft')]}"/>
<field name="picking_id" attrs="{'invisible': [('picking_id', '=', False)]}"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
......@@ -117,16 +117,16 @@
<field name="name">stock.scrap.tree</field>
<field name="model">stock.scrap</field>
<field name="arch" type="xml">
<tree decoration-danger="state == 'draft'">
<tree multi_edit="1" decoration-danger="state == 'draft'">
<field name="name"/>
<field name="date_done"/>
<field name="product_id"/>
<field name="product_id" readonly="1"/>
<field name="scrap_qty"/>
<field name="product_uom_id" groups="uom.group_uom"/>
<field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
<field name="scrap_location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
<field name="state"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="company_id" readonly="1" groups="base.group_multi_company"/>
</tree>
</field>
</record>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment