コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
17147 ビュー

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

アバター
破棄
最善の回答

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

アバター
破棄
最善の回答

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'])]

 

アバター
破棄
関連投稿 返信 ビュー 活動
0
3月 15
3078
0
8月 25
274
2
7月 24
41
1
2月 24
2708
3
12月 23
2074