sale_order_batch_product: make Sale Order Lines Readonly when confirmed

This commit is contained in:
Niels Göttsch 2025-03-25 14:40:07 +01:00 committed by Niels Göttsch
parent 8c2e112f70
commit d3de601798
2 changed files with 3 additions and 1 deletions

View file

@ -16,6 +16,7 @@ class SaleOrderBatchProduct(models.Model):
copy=False, copy=False,
readonly=True, readonly=True,
) )
state = fields.Selection(related="batch_id.state")
product_id = fields.Many2one(comodel_name="product.product", required=True, readonly=True) product_id = fields.Many2one(comodel_name="product.product", required=True, readonly=True)
product_template_id = fields.Many2one( product_template_id = fields.Many2one(
"product.template", related="product_id.product_tmpl_id", string="Product Template" "product.template", related="product_id.product_tmpl_id", string="Product Template"

View file

@ -23,10 +23,11 @@
</group> </group>
<notebook> <notebook>
<page string="Sale Order Lines" name="order_line"> <page string="Sale Order Lines" name="order_line">
<field name="state" invisible="1"/>
<field <field
name="sale_order_line_ids" name="sale_order_line_ids"
widget="section_and_note_one2many" widget="section_and_note_one2many"
attrs="{'readonly': [('state', 'in', ('closed'))]}" attrs="{'readonly': [('state', '=', 'closed')]}"
> >
<tree editable="bottom" create="0"> <tree editable="bottom" create="0">
<field name="company_id" invisible="1"/> <field name="company_id" invisible="1"/>