Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4089 มุมมอง

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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 25
168
2
มิ.ย. 25
1685
0
มี.ค. 25
1558
0
ก.พ. 25
1201
3
ส.ค. 24
5898