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:
@@ -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):
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user