Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Re: Overwriting a method in OCA module.
by
MoaHub, Graeme Gellatly
Stefan, Kitti et al,
Here is some non-working code which is very close to behaving to allow for upstream changes which I thought I'd share.import openerp.addons.account.report.account_financial_report as parentThe principle of it is that we take a hash of the original function when we create the code and create log output if that hash changes. If upon reviewing the code we make changes (or not) then the new hash can also be added.
import hashlib
import inspect
import logging
# VALID_HASHES = [
# '123',
# ]
#
# h = hashlib.sha224(inspect.getsourcelines(''.join(
# parent.report_account_common.get_lines)[0])).hexdigest()
# if h not in VALID_HASHES:
# _logger.critical('Parent Function get_lines has changed or not '
# 'known to be compatible with this version. Got: %s, Expected 123' % h)
On Wed, Sep 16, 2015 at 3:53 AM, Nhomar Hernandez <nhomar@vauxoo.com> wrote:
On Tue, Sep 15, 2015 at 4:07 AM, Kitti U. <kittiu@ecosoft.co.th> wrote:So, we will have 1 monkey patch addon for each Project? i.e., account-invoicing_monkeypatch, sale-workflow_monkeypatch, etc...Hello Kitty.The monkey patch can be by functionality even by method.The point of th monkey patch is that with simple correct the py file you will use quickly the original one in seconds.And don't forget make alwas the PR to odoo/odoo itlesf in order to ensure in some moment do not need the monkey patch.We apply this monkey patches temporarly when issues comes fron OPW also.We called the "*_unfuck" modules.You can find a placeholder here:
https://github.com/Vauxoo/addons-vauxoo/commits/8.0/account_bank_statement_unfuckedWhich if you look in the blame for the model/*.py it is empty just because we just receive the patch on odoo/odoo some weeks ago!. But the module stais there doing nothing until we make a major release, and everything was moves smothly.I hope it helps.
--Nhomar HernandezCEO Vauxoo.Site: http://vauxoo.comTwitter: @nhomarBlog: http://geronimo.com.veLPUser: http://launchpad.net/~nhomarOdoo Gold Partner_______________________________________________
Mailing-List: http://odoo-community.org/groups/oca-contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: http://odoo-community.org/groups?unsubscribe
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