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
2419 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
sty 24
2976
0
cze 22
2598
2
lip 25
661
1
lip 25
2170
1
lut 24
1646