This question has been flagged
2 Replies
3031 Views

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

Avatar
Discard
Best Answer

It is similar with other python inheritance.  You define the fields_view_get method of the model in a new module.  If you still need to call the super method, you call it by res = super(class_name, self).fields_view_get(....).  You can then put you logic before or after the super call and return res or an modified res.  A sample could be found in addons/account/account.py

Avatar
Discard
Author Best Answer

thank you Ivan for your quicly respond

i know what you say about how to _inherit fields_view_get for one module

my question is about "i update in orm class itself openerp core module "in fields_view_get method under basemodel class for all objects in openerp.

how these updates can be seperated in module installble ??

hope you understand me...

Thanks

Avatar
Discard

Please avoid editing in the orm models it may lead to crash the module, I think it cant be separated bcoz u changed in the orm models.

Author

sir .. why i can't update and change in orm class while i understand every line in it and my business need to change it.. i updated it and no error for all modules.. i need to seperate theses updates in seperated installed module.. How ???

There have been numerous questions in this forum that discusses that topic. One is this: https://www.odoo.com/forum/help-1/question/how-to-override-basemodel-or-model-class-of-orm-py-36517. One of the disadvantages of doing this is that you are breaking the upgrade path, i.e. whatever update to that method made by the official trunk will not be reflected because it will be your custom code that runs.