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.
This commit is contained in:
Raphael Collet
2016-12-07 10:15:15 +01:00
committed by GitHub
parent 345755e271
commit fe02b79a65
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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):
+1 -1
View File
@@ -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.