Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Re: Overwriting a method in OCA module.
by
Ecosoft Co. Ltd., Kitti Upariphutthiphong
Hello.
I have tested the monkey patch for account_billing module, which will PR to account-payment.
However, I follow the example here using _register_hook from https://github.com/Therp/Therp-Addons/blob/7.0/mail_error/model/mail_mail_monkeypatch.py
as
It doesn't work. The expected overwritten method in account_voucher_hook_recompute_vline.py
is not being called ???
But if I use the same way as Nhomar, which is using normal _inherit way, it works as normal., but it wont't be as Stefan describeed
To preserve any existing inheritance, you could in such a module replace
the original method with the refactored version by applying it as a
monkeypatch in _register_hook. While it will still affect all databases
on the instance once the module is installed, it will not be preloaded
if the module is only in the module path and not installed on any
database. That trick is courtesy of Holger Brunn, BTW.
Many thanks,
Kitti U.
On Thu, Sep 17, 2015 at 9:52 PM, Stefan Rijnhart <stefan@opener.am> wrote:
On 16-09-15 21:22, Nhomar Hernandez wrote:<blockquote cite="mid:CAKtu5Y7J6vm05QTSsCzWxbK=ksptf8yWYF=-BD4UmLUO-Z=DBg@mail.gmail.com" type="cite">On Wed, Sep 16, 2015 at 7:53 AM, Kitti U. <kittiu@ecosoft.co.th> wrote:(i.e., account_voucher_monkeypatch)no **_monkeypatch on the name, a name that mention the monkeypatched method is more ellegant.I think it should be in a "Good Practice technique section".
+1-- Opener B.V. - Business solutions driven by open source collaboration Stefan Rijnhart - Consultant/developer mail: stefan@opener.am tel: +31 (0) 20 3090 139 web: https://opener.am_______________________________________________
Mailing-List: http://odoo-community.org/groups/oca-contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: http://odoo-community.org/groups?unsubscribe
Mobile: +66-(0)8-1841-7480
Your ERP Partner => www.ecosoft.co.th
Reference
-
Overwriting a method in OCA module.
by "Kitti U." <kittiu@ecosoft.co.th> - 11/09/2015 11:56:28 - 0-
Re: Overwriting a method in OCA module.
byEcosoft Co. Ltd., Kitti Upariphutthiphong -
Re: Overwriting a method in OCA module.
byEcosoft Co. Ltd., Kitti Upariphutthiphong -
Re: Overwriting a method in OCA module.
by "Kitti U." <kittiu@ecosoft.co.th> - 16/09/2015 14:44:11 - 0