Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Re: Overwriting a method in OCA module.
byThe method you are talking about is indeed sucky. I just finished some work on it myself.
However a complete over ride is rarely absolutely necessary IMO.
You can call super and massage all the results. However I accept that this method has side effects with this function as it unlink all existing lines. However no_recompute_voucher_lines manages this by caching input.
Or
You can assign your function directly to parent which will preserve inheritance.
E.g openerp.......recompute_voucher_lines = mynewfunc
Has its own problems but better than current proposal provided you honour the function signature and return.
Sent from TypeMail
IMHO I think it is good to avoid complete overrides where possible. However, due to the general lack of modularity and extendability of many Odoo methods this can not always be avoided. And PR's to improve the Odoo standard code can take a really long time to be taken up by Odoo. If they will accept them anyway. Kind regards, Ronald Op 11-09-15 om 15:37 schreef Mignon, Laurent: > IMO, we should disallow this kind of 'full' override without call to > super. This kind of override breaks the inheritance chains. Since we > don't have the control on the order in which the inheritance chain is > build by odoo when two modules extends the same one, this kind of > override will silently break some functionalities. IMO it's better to > make a PR to Odoo to improve the modularity of the method to extend an > base the new method on this PR. > > On Fri, Sep 11, 2015 at 1:38 PM, Lionel Sausin <ls@numerigraphe.com > <mailto:ls@numerigraphe.com>> wrote: > > If you have no other choice it's better that nothing I guess. > Please take care to clearly indicate why you are doing this in the code > comments of your module, and explain in the README that your module is > incompatible with other modules which change the same method. > Ideally, you could also make a PR for Odoo master to add the "hooks" you > miss, so that in the next version you remove the limitation from your > module. > > > _______________________________________________ > Mailing-List: http://odoo-community.org/groups/oca-contributors-15 > Post to: mailto:contributors@odoo-community.org > <mailto:contributors@odoo-community.org> > Unsubscribe: http://odoo-community.org/groups?unsubscribe > > > > > -- > *Laurent Mignon* > Senior software engineer > > Tel: +352 20 21 10 20 32 > Fax: +352 20 21 10 21 > Email: laurent.mignon@acsone.eu <mailto:laurent.mignon@acsone.eu> > > Acsone SA, Succursale de Luxembourg > 22, Zone Industrielle > > | L-8287 Kehlen, Luxembourg > TVA LU24733605 > | RCS B160400 > > > Acsone sa/nv > Boulevard de la Woluwe 56, b4 Woluwedal > | B-1200 Bruxelles - Brussel > RPM Bruxelles 0835.207.216 RPR Brussel > > www.acsone.eu > > > _______________________________________________ > 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
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