Contributors mailing list archives
Re: Overwriting a method in OCA module.by
Ecosoft Co. Ltd., Kitti Upariphutthiphong
Thank you very much. That works! ;)
On Tue, Sep 29, 2015 at 3:07 AM, Stefan Rijnhart <firstname.lastname@example.org> wrote:
On 28-09-15 05:23, Kitti U. wrote:<blockquote cite="mid:CAKNFPG7XQUWFVLVSNc0eJkxPvFZo5ca2ke=d1_1KEBAB=h4uSA@mail.gmail.com" type="cite">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.pyashttps://github.com/kittiu/account-payment/blob/8.0/account_billing_hook_recompute_vline/account_voucher_hook_recompute_vline.py#L203-L205It doesn't work. The expected overwritten method in account_voucher_hook_recompute_vline.pyis not being called ???
Hi Kitti U.,
I had to look twice myself, but with this change it works:
@@ -19,7 +19,7 @@
from openerp import models
-from openerp.addons.account_voucher import account_voucher
+from openerp.addons.account_voucher.account_voucher import account_voucher
def recompute_voucher_lines(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
You were importing the account_voucher.py, but we want the account_voucher object in this file.
Stefan.-- Opener B.V. - Business solutions driven by open source collaboration Stefan Rijnhart - Consultant/developer mail: email@example.com tel: +31 (0) 20 3090 139 web: https://opener.am