[FIX] sale: prevent the change of product of a SO line when there are procurements

When adding a line to a confirmed sale order,
the procurements are automatically created, with
this product.

Therefore, the product of the line should no longer be changed,
as otherwise, the product on the procurement would no longer
be the same product than on the sale order line.

To be able to change the product of a line on a
confirmed sale order, you must therefore first
delete all procurements.
This commit is contained in:
Denis Ledoux
2015-10-07 16:30:18 +02:00
parent a5e737f79c
commit 422f3b5d8a
+4 -2
View File
@@ -186,11 +186,12 @@
<group>
<field name="product_id"
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}"
attrs="{'readonly': [('qty_invoiced', '&gt;', 0)]}"
attrs="{'readonly': ['|', ('qty_invoiced', '&gt;', 0), ('procurement_ids', '!=', [])]}"
/>
<field name="invoice_status" invisible="1"/>
<field name="qty_to_invoice" invisible="1"/>
<field name="qty_delivered_updateable" invisible="1"/>
<field name="procurement_ids" invisible="1"/>
<label for="product_uom_qty" string="Ordered Quantity"/>
<div>
<field
@@ -235,7 +236,7 @@
<tree string="Sales Order Lines" editable="bottom" decoration-info="invoice_status=='to invoice'">
<field name="sequence" widget="handle"/>
<field name="product_id"
attrs="{'readonly': [('qty_invoiced', '&gt;', 0)]}"
attrs="{'readonly': ['|', ('qty_invoiced', '&gt;', 0), ('procurement_ids', '!=', [])]}"
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}"
/>
<field name="name"/>
@@ -259,6 +260,7 @@
<field name="discount" groups="sale.group_discount_per_so_line"/>
<field name="price_subtotal" widget="monetary"/>
<field name="qty_delivered_updateable" invisible="1"/>
<field name="procurement_ids" invisible="1"/>
<field name="state" invisible="1"/>
<field name="invoice_status" invisible="1"/>
<field name="customer_lead" invisible="1"/>