[FIX] purchase: po line and force_save

Two fiels are set readonly according to the status of the purchase
order: product_id and product_uom_id. They become readonly once the
purchase order is confirmed, but according to the options a user is
still able to add purchase order line. Make sure to always send the
required fields to the server.

Fixes #21519
This commit is contained in:
Simon Lejeune
2017-12-12 10:52:54 +01:00
parent 63b4e2342e
commit b610e2a812
+2 -2
View File
@@ -210,7 +210,7 @@
<field name="currency_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="sequence" widget="handle"/>
<field name="product_id" attrs="{'readonly': [('state', 'in', ('purchase', 'to approve','done', 'cancel'))]}" context="{'partner_id':parent.partner_id, 'quantity':product_qty,'uom':product_uom, 'company_id': parent.company_id}"/>
<field name="product_id" attrs="{'readonly': [('state', 'in', ('purchase', 'to approve','done', 'cancel'))]}" context="{'partner_id':parent.partner_id, 'quantity':product_qty,'uom':product_uom, 'company_id': parent.company_id}" force_save="1"/>
<field name="name"/>
<field name="date_planned"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
@@ -219,7 +219,7 @@
<field name="product_qty"/>
<field name="qty_received" invisible="not context.get('show_purchase', True)"/>
<field name="qty_invoiced" invisible="not context.get('show_purchase', True)"/>
<field name="product_uom" groups="product.group_uom" attrs="{'readonly': [('state', 'in', ('purchase', 'done', 'cancel'))]}"/>
<field name="product_uom" groups="product.group_uom" attrs="{'readonly': [('state', 'in', ('purchase', 'done', 'cancel'))]}" force_save="1"/>
<field name="price_unit"/>
<field name="taxes_id" widget="many2many_tags" domain="[('type_tax_use','=','purchase')]" context="{'default_type_tax_use': 'purchase'}" options="{'no_create': True}"/>
<field name="price_subtotal" widget="monetary"/>