Skip to Content
Menu
This question has been flagged
1 Reply
4191 Views

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'


Avatar
Discard
Best Answer

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 ...


Avatar
Discard
Author

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 Replies Views Activity
2
Sep 25
243
1
Aug 25
536
2
Jun 25
1975
0
Mar 25
1823
0
Feb 25
1406