What is the difference in terms of performance between "controller/main" and button of type "object"

Asked by Nhomar - Vauxoo


Can you help me with a fair technical question.

In past versions, if you need link openerp with something external, like read filesystem, connect with a third party system to malke a quick task, you create a button of type object and define a method in the class, really simple, but in the past, openerp doesn't have embeded multiprocess and json,

Now with web addon we can embed a "controller" in my module and OpenERP answer to a normal http: request, i.e a link to /do/something can be forced to do the same external task (what we did before in the method.) the cool thing now is that i can return a json and do what ever i want with it ;-)

Te question is, technically with both i can do the same job when i dont need the orm i terms af benefits, if i need i.e bring something to openerp "Just to show" what is better:

controller or button type object?

I hope i explain good by myself.


Question information

English Edit question
Odoo Server (MOVED TO GITHUB) Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) said :

Writing your own web controller makes sense when you are indeed not using the ORM and adding a generic/cross-model capability. If you were using a regular model method for this it would be rather artificial anyway.
In general this should be an exception though, as most features are ORM/model-centric and should stay in the business code of your models.
Note that you don't need an extra controller for serving static files, this works out of the box for the contents of the /static/ directory of your modules.

Performance should not be relevant here, regular ORM calls do not have much overhead on top of the JSON-RPC requests: a few extra Python methods in the stack depth and the initialization of a new db cursor, and that's it - no extra RPC, marshalling, etc.

Can you help with this problem?

Provide an answer of your own, or ask Nhomar - Vauxoo for more information if necessary.

To post a message you must log in.