Odoo Help


Change product type with an onchange method

on 8/9/16, 4:35 AM 774 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?')

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

--Ahmed M.Elmubarak--

Ahmed M.Elmubarak
On 8/9/16, 5:14 AM


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.

on 8/9/16, 5:23 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/9/16, 4:35 AM
Seen: 774 times
Last updated: 8/22/16, 6:40 AM