Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: Overwriting a method in OCA module.

by
Vauxoo, Nhomar Hernández
- 12/09/2015 00:23:47

On Fri, Sep 11, 2015 at 5:08 AM, Kitti U. <kittiu@ecosoft.co.th> 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.

Hello.

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.

Regards.


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

Reference