Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2439 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
led 24
2981
0
čvn 22
2606
2
čvc 25
671
1
čvc 25
2177
1
úno 24
1647