Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
17137 Visualizações

There is a validation rule on BOM , such that the same product cannot be in a BOM more than once. I would like to allow this

(see question http://help.openerp.com/question/20560/bom-that-allows-for-repeating-the-same-product-or-show-the-assembly-of-the-product/ )

Is there an easy way to remove this validation / constraint? Will it screw up other things?

Thanks

Avatar
Cancelar
Melhor resposta

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
Cancelar
Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
0
mar. 15
3065
0
ago. 25
262
2
jul. 24
41
1
fev. 24
2698
3
dez. 23
2071