Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: Overwriting a method in OCA module.

by
Ecosoft Co. Ltd., Kitti Upariphutthiphong
- 30/09/2015 08:23:06
Dear Stefan,

Thank you very much. That works! ;)

Kitti

On Tue, Sep 29, 2015 at 3:07 AM, Stefan Rijnhart <stefan@opener.am> 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.py

as 


It doesn't work. The expected overwritten method in account_voucher_hook_recompute_vline.py
is not being called ???


Hi Kitti U.,

I had to look twice myself, but with this change it works:

--- a/account_billing_hook_recompute_vline/account_voucher_hook_recompute_vline.py
+++ b/account_billing_hook_recompute_vline/account_voucher_hook_recompute_vline.py
@@ -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.

Regards,
Stefan.

-- 
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/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