Community mailing list archives

community@mail.odoo.com

Re: Edit in orm

by
Numa Extreme Systems, Gustavo Marino
- 01/20/2015 13:33:22
Just use monkey-patching
Let say

from openerp import models

old_fields_get = models.Model.fields_get
def new_fields_get(self):
   ...

models.Model.fields_get = new_fields_get


Be careful: due to a questionable design decision, once you put your module in the addons path, it will be loaded EVEN IF IT IS NOT INSTALLED (see web initialization, every module is loaded at the very beginning). So, if your module is not prepared to be called even when not installed you will get very strange consequences, and given the fact the orm is used to initiallly load all modules, it could lead to a not usable system

If you are careful, it will work




Gustavo Adrian Marino

 

Mobile:  +54 911 5498 2515

Email: gamarino@numaes.com

Skype: gustavo.adrian.marino

 

<img border="0" width="213" height="94" src="cid:image001.jpg@01CC37F5.99B4CD20" alt="Descripción: Numa Logo V 1-0">



2015-01-20 15:18 GMT-03:00 Denis Karataev <dsk@t-technologies.com>:
By the way, once I've faced with similar problem. I wanted to rewrite the "unlink" method for all objects to inject some additional behavior there. Could anyone recommend how to do it? Thanks

2015-01-20 20:23 GMT+03:00 Mohamed Magdy <moh.magdy40@gmail.com>:
I think all you need is to override the orm class

Best Regards,

Mohamed Magdy
Mob: +201114347478

On Tue, Jan 20, 2015 at 3:23 PM, Mohamed Mtloob <mtloob87@gmail.com> wrote:
Dear All

Hope my mail find you well
Could you help me about now i made updates in fields_view_get the main method in orm class
my question is how to separate my customized code in separate module??? ...
when installed it my customized code is installed

--
Thanks
Mohamed Mtloob
Sr.Odoo Developer @ Techorg CO
Linkedin

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Denis Karataev
CEO at Transparent Technologies



_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe