Contributors mailing list archives


Re: Overwriting a method in OCA module.

Eska Yazilim, Levent Karakaş
- 12/09/2015 15:58:28
An example for nhomar's proposal is Juan's account_voucher_payline module which is used by account_check and account_voucher_withholding modules.

2015-09-12 1:37 GMT+03:00 Nhomar Hernandez <>:

On Fri, Sep 11, 2015 at 5:08 AM, Kitti U. <> wrote:
For example, in account_voucher.recompute_voucher_lines(). This is a lengthy function which make it difficult to hook it with my code. The only way to do is overwriting it.


What you should is (in order to propose a correct approach in a communitary way).

1.- Overwrite the method in a module which split (refactoring it) the mega method in several mini methods and/or hooks. (this is module1 and propose to OCA explaining why for stable-version).
2.- MAke the change on master or future version on core (just to ensure in future this will not be necesary or prepare yourself for the future).
3.- Then make your module2 dependant of module 1 to ensure your specific approach using your new algorithm.

Obviously this is a little more complex to manage and/or support but it left your set of changes ready for future and ready for deprecate the non-correct way of things due to incorrect base designs.

We on this specific model (account_voucher) overwrite a lot of things because as you said it is a really ugly / dirty method.

For v9 account_voucher is being less used (I am not agreed but it will) and then may be make a huge effort with step 2 is not necesary.


Nhomar Hernandez
CEO Vauxoo.
Twitter: @nhomar
Odoo Gold Partner
Móvil Venezuela:
+58 4144110269
Móvil México:
+52 1 4773933942

Post to: