Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
2190 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Jan. 24
2668
0
Juni 22
2374
2
Juli 25
323
1
Juli 25
1653
1
Feb. 24
1410