[FIX] sale: add force_save to make sure SO is correct

Before the new views (SAAS15 and before), the 'readonly' modifier was
kind of weird: a field which was in a readonly state was not saved (the
field was not present in the RPC), UNLESS it is a subfield (for a
x2many).

With the new views, we changed the semantics, to make it more consistent:
fields in readonly state are never sent to the server. This is a much simpler
semantic, but it may introduce some problems, when we actually want to
save the record.  This is solved with a new attribute 'force_save',
where we explicitely have to declare which fields should be save, even
if they are in readonly mode.

In this commit, we simply add the missing force_save attribute to the
order line form view.  This allow the user to create a new SO, add an
order line with some invoice line, and save the result (without this,
the server complains about a missing product_id field)
This commit is contained in:
Géry Debongnie
2017-09-20 12:19:40 +02:00
parent 9f8efb9d16
commit a5ca63c83b
+1
View File
@@ -207,6 +207,7 @@
<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), ('procurement_ids', '!=', [])]}"
force_save="1"
/>
<field name="layout_category_id" groups="sale.group_sale_layout"/>
<field name="invoice_status" invisible="1"/>