Help

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

How to remove a validation / constraint?

Avatar
odoo
Avatar
Discard
2 Answers
0
Avatar
odoo
Best Answer

Hi,

the only way to manage your case this is a comment line of Python code :

in file mrp/mrp.py line 264 :

  262.  _constraints = [
  263.   (_check_recursion, 'Error ! You cannot create recursive BoM.', ['parent_id']),
  264.  #(_check_product, 'BoM line product should not be same as BoM product.', ['product_id']),
         ]

but it is not professional, the best way is to create a new module to do that

Avatar
Discard
0
Avatar
odoo
Best Answer

To redefine a python constraint, you can override it by setting the same method function name:

In a module puts:

 

    class mrp_bom(orm.Model):

        _inherit = 'mrp.bom'

 

        def _check_product(self, cr, uid, ids, context=None):

            return True

 

        _constraints = [(_check_product, 'Override of _check_product constraint', ['product_id'])]

 

Avatar
Discard