summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ledoux <dle@odoo.com>2015-10-07 16:27:02 +0200
committerDenis Ledoux <dle@odoo.com>2015-10-07 16:30:18 +0200
commit422f3b5d8a8068eef9b7bfa7527e2e8f121aa2ab (patch)
tree0d3a0aea86c15aa5f3edfac41c128a2c210a4fa4
parenta5e737f79cd647643812749ea9b5287858703f47 (diff)
[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.
-rw-r--r--addons/sale/sale_view.xml6
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 60649e75dd6..9260202a14a 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -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"/>