summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Van Malder <jvm@odoo.com>2020-01-02 12:56:39 +0000
committerJason Van Malder <jvm@odoo.com>2020-01-06 16:23:02 +0000
commitb6714ee01d01c21d14d4e9c18cf7e3beffd88945 (patch)
tree97d43805b353d459ca8a79d4a73234c680398412
parentc411bdfe4dff6174cbe58ae3c29204ba8c9b1ea4 (diff)
[FIX] purchase: prevent changes when a line has an invoice
Issue from rim: In runbot 12.3 - Go to Purchase - Create a PO with one product line: qty 1 / unit price 1000 - Validate the PO and create the Invoice => DON'T VALIDATE THE INVOICE YET - Go back to the PO, change the unit price to 2000 - Go back to the invoice, validate it ==> the PO is marked as "fully invoiced" because the qty "1 unit" is counted as "invoiced" => we should not be able to change the price of a line that has already been invoiced, even in draft Cause It seems that in all the PO's invoices state, we can edit a PO line. No restriction? Solution Set the line price column to read only when they have a linked invoice. OPW-2161477 closes odoo/odoo#42797 X-original-commit: b31c04040a2d7fe83741dec2d3a622487b7e46c3 Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
-rw-r--r--addons/purchase/views/purchase_views.xml3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/purchase/views/purchase_views.xml b/addons/purchase/views/purchase_views.xml
index 5f177bf3773..3926f06e75e 100644
--- a/addons/purchase/views/purchase_views.xml
+++ b/addons/purchase/views/purchase_views.xml
@@ -186,6 +186,7 @@
<field name="state" invisible="1"/>
<field name="product_type" invisible="1"/>
<field name="product_uom_category_id" invisible="1"/>
+ <field name="invoice_lines" invisible="1"/>
<field name="sequence" widget="handle"/>
<field
name="product_id"
@@ -210,7 +211,7 @@
'required': [('display_type', '=', False)]
}"
force_save="1" optional="show"/>
- <field name="price_unit"/>
+ <field name="price_unit" attrs="{'readonly': [('invoice_lines', '!=', [])]}"/>
<field name="taxes_id" widget="many2many_tags" domain="[('type_tax_use','=','purchase'), ('company_id', '=', parent.company_id)]" context="{'default_type_tax_use': 'purchase', 'search_view_ref': 'account.account_tax_view_search'}" options="{'no_create': True}" optional="show"/>
<field name="price_subtotal" widget="monetary"/>
</tree>