Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4151 Widoki

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'


Awatar
Odrzuć
Najlepsza odpowiedź

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


Awatar
Odrzuć
Autor

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.

Powiązane posty Odpowiedzi Widoki Czynność
1
sie 25
392
2
cze 25
1816
0
mar 25
1686
0
lut 25
1324
3
sie 24
6048