콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
2252 화면

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?

아바타
취소
베스트 답변

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


아바타
취소
관련 게시물 답글 화면 활동
1
1월 24
2725
0
6월 22
2449
2
7월 25
457
1
7월 25
1748
1
2월 24
1473