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

Hi, i'm trying to make products packs, so I made a boolean button in the product to check if the product is a pack, now i want to make an onchange to change the type of the prodcut to service if pack checkbox is true. I'm trying with this but is not working.


class product_template(models.Model):
_inherit = 'product.template'
    pack = fields.Boolean('Pack?')

api.onchange('pack')
def _onchange_pack(self):
    if self.pack:
        self.type = 'service'


アバター
破棄
最善の回答

Hi,

Try to make the on change function in the product.product model. Also it will be helpful if you put the error msg and your version ...


アバター
破棄
著作者

I don't have any error, it does nothing, is in V8. I'll try to do it in the product.product and see if it works.

関連投稿 返信 ビュー 活動
2
6月 25
1606
0
3月 25
1472
0
2月 25
1128
3
8月 24
5823
1
4月 24
33