Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
4271 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Autore

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.

Post correlati Risposte Visualizzazioni Attività
2
set 25
457
1
ago 25
626
2
giu 25
2124
0
mar 25
1997
0
feb 25
1520