Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: Overwriting a method in OCA module.

by "Kitti U." <kittiu@ecosoft.co.th> - 15/09/2015 11:02:30
Thank you Yanick, that would play nicely for my own project.

But as we are finding solution for OCA Project.

So, we will have 1 monkey patch addon for each Project? i.e., account-invoicing_monkeypatch, sale-workflow_monkeypatch, etc...

On Tue, Sep 15, 2015 at 3:38 PM, Yannick Vaucher <yannick.vaucher@camptocamp.com> wrote:
Yes, this in order to be able to have.

my_monkeypatch
my_addon_A

And later a new module needing to monkeypatch the same method
my_addon_B

With hooks for addons A and B in one my_monkeypatch so they play
nicely together.

Cheers,
Yannick Vaucher
Business Solutions Software Developer

Camptocamp SA
PSE A, CH-1015 Lausanne
Phone: +41 21 619 10 30
Office: +41 21 619 10 10
http://www.camptocamp.com/


On Tue, Sep 15, 2015 at 10:23 AM, Kitti U. <kittiu@ecosoft.co.th> wrote:
> May I confirm my understanding,
>
> Like, if I want to submit a new addon, I would end up with 2 addons instead
> of one?
>
> my_addon
> my_addon_monkeypatch
>
>
> On Tue, Sep 15, 2015 at 3:08 PM, Stefan Rijnhart <stefan@opener.am> wrote:
>>
>> On 15-09-15 09:38, Kitti U. wrote:
>> >
>> > 1. In module C, create a MonkeyPatch to module A with a new
>> > "hook_point". (just the hook point only). -> as the result we can
>> > think of module A as if it already have the hook_point.
>> >
>> > 2. In module C, we write method as if hook_point exists (now we can
>> > call super())
>> >
>>
>> Crystal clear! But I would follow Nhomar's practice of putting the
>> monkeypatch with the hooks in its own module, separated from the
>> module(s) that make use of those hooks.
>>
>> Cheers,
>> Stefan.
>>
>> _______________________________________________
>> Mailing-List: http://odoo-community.org/groups/oca-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
>
> _______________________________________________
> Mailing-List: http://odoo-community.org/groups/oca-contributors-15
> Post to: mailto:contributors@odoo-community.org
> Unsubscribe: http://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: http://odoo-community.org/groups/oca-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