From fe02b79a651a750ad8d97c50bfd9bf83ab42a9da Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 7 Dec 2016 10:15:15 +0100 Subject: [PATCH] Fix @constrains parameters (#14607) * [FIX] base: @constrains parameter on `ir.ui.view._check_xml` The constraint is never checked because the parameters `arch` and `arch_base` are not stored. Use `arch_db` to make the constraint work. * [FIX] stock: @constrains parameter on `stock.warehouse.orderpoint._check_product_uom` The constraint parameter `product_uom` is not stored. --- addons/stock/models/stock_warehouse.py | 2 +- openerp/addons/base/ir/ir_ui_view.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_warehouse.py b/addons/stock/models/stock_warehouse.py index 3fee34a4ee8..a580f071848 100644 --- a/addons/stock/models/stock_warehouse.py +++ b/addons/stock/models/stock_warehouse.py @@ -791,7 +791,7 @@ class Orderpoint(models.Model): ('qty_multiple_check', 'CHECK( qty_multiple >= 0 )', 'Qty Multiple must be greater than or equal to zero.'), ] - @api.constrains('product_id', 'product_uom') + @api.constrains('product_id') def _check_product_uom(self): ''' Check if the UoM has the same category as the product standard UoM ''' if any(orderpoint.product_id.uom_id.category_id != orderpoint.product_uom.category_id for orderpoint in self): diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index cbef198c820..254cfc416f9 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -271,7 +271,7 @@ actual arch. self.raise_view_error(message, self.id) return True - @api.constrains('arch', 'arch_base') + @api.constrains('arch_db') def _check_xml(self): # Sanity checks: the view should not break anything upon rendering! # Any exception raised below will cause a transaction rollback.