Contributors mailing list archives
contributors@odoo-community.org
Browse archives
How to write hook addon properly.
by
Ecosoft Co. Ltd., Kitti Upariphutthiphong
Dear all
I am looking for the right way to write a hook addon when working with OCA modules.
I found the sample from Eficent in https://github.com/OCA/sale-workflow/tree/11.0/sale_order_action_invoice_create_hook
I see that, it is doing things like this in hooks.py
def post_load_hook(): | |
def new_action_invoice_create(self, grouped=False, final=False): | |
if not hasattr(self, '_get_invoice_group_key'): | |
return self.action_invoice_create_original(grouped=grouped, | |
final=final) | |
From what I see, since this module is being installed, the new_action_invoice_create() will be used always anyway. I am trying to understand why we would need to do this, instead of directly overwrite method with hook point ?
Thank you for your support.
Kitti U.
Follow-Ups
-
Re: How to write hook addon properly.
by Richard deMeester <richard.demeester@willdooit.com> - 11/03/2019 23:48:36 - 0 -
Re: How to write hook addon properly.
byEcosoft Co. Ltd., Kitti Upariphutthiphong -
Re: How to write hook addon properly.
byEcosoft Co. Ltd., Kitti Upariphutthiphong -
Re: How to write hook addon properly.
by Richard deMeester <richard.demeester@willdooit.com> - 07/03/2019 23:44:59 - 2 -
Re: How to write hook addon properly.
byEcosoft Co. Ltd., Kitti Upariphutthiphong -
Re: How to write hook addon properly.
byForgeFlow, S.L., Jordi Ballester Alomar