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

For example : 


class customModel1(models.Model):

    _inherit = 'sale.order'


​def action_confirm(self):

​# some code logic

​return super(customModel1, self).action_confirm


class customModel2(models.Model):

    _inherit = 'sale.order'


​def action_confirm(self):

​# some code logic

​return super(customModel2, self).action_confirm

Now I want to inherit this in customModel2 and do changes but it should not call customModel1 action_confirm function. Instead it should call main sale module action_confirm function.


What is best odoo approach to do this?

Avatar
Abbandona
Risposta migliore

Hello Sateesh Mathapati,

You cannot override an action's confirm method within a single file. If you write it in a single file, it must call the original action confirm method at the end.

You can achieve this by creating two different files and writing an action confirm method to call this method.

To achieve this, you can use two different files. Write the action confirm method in the first module and then specify the first module as a dependency in the manifest file of the second module. In the second module, call the action confirm method from the first module.

I hope you find this answer helpful.

Thanks & Regards,

Email: odoo@aktivsoftware.com          

Skype: kalpeshmaheshwari


Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
gen 24
2974
0
giu 22
2592
2
lug 25
654
1
lug 25
2169
1
feb 24
1645