Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Aggregate function (group,sum,avg,etc) in XML-RPC calls

By
Yohanes Iwan Sugiarto
on 5/30/13, 10:39 PM 4,402 views

I'm in a progress of developing dashboard mobile app for iOS and Android. I'm also aware of analytic & report objects such as: - purchase.report - sale.report - account.invoice.report - etc.

Pulling each record to mobile device and aggregates them in the mobile device would be inefficient. How can I perform aggregate functions such as SUM,AVG,MIN,MAX in the server side?

I wanted to avoid modifying views, adding modules, etc to the OpenERP installation; as I would like the mobile app to be as universal as possible without too much modification on the OpenERP base installation.

It would be also nice if I can run SQL statements via XML-RPC web service calls. Can it be done?

Thanks

0
Dharmesh Rathod
On 6/1/13, 4:51 AM

Hi,

You can directly execute SQL queries with help of creating POSTGRES instance. In another way, you can make new module or can write methods into existing module and call that with help of API.

Email : info@acespritech.com
Skype : acespritech
Blog : acespritechblog.wordpress.com

the question was if it is possible to use some kind of XML-RPC call to execute SQL, without the need to install additional software / module on the openERP server. So the answer to create a new module or write methods for existing modules is not what Yohanes is looking for....

patrick
on 6/1/13, 7:59 PM

XML-RPC is communicating with which takes and input as a XML-RPC request and process it. In OpenERP, XML-RPC is mainly working on objects and API. It's not allowing to deal with SQL. For that you have to direct deal with postgresql with help of python programming.

Dharmesh Rathod
on 6/3/13, 4:00 AM

Thanks Dharmesh for you response. Yes actually I wanted to avoid adding custom module, but I guess it's not possible this time. Just wondering, how is the grouping in the web/gtk client (tree view) works? Was it done in the client?

Yohanes Iwan Sugiarto
on 6/4/13, 1:02 AM

How can i call a python function that executes a select query and returns a result, in my openoffice report? I mean the syntax.

evon_dun
on 7/15/13, 7:23 AM
0

patrick

--patrick--
1958
| 5 4 7
Baarn, Netherlands
--patrick--
patrick
On 5/31/13, 7:22 PM

It is possible to run SQL commands, but I think that requires you to make your own module.

According to this site, you can use Query objects, maybe that is what yo are looking for?

More specific, this part of the above page is talking about aggregation-grouping.

Update Within openERP, all models extend osv.BaseModel. If you want to know more about the possible methods, read through the source code, or check the following site, which has made HTML documentation out of the source code. You have to look under Namespaces -> Namespace List -> openERP -> osv. One of the things defined here is query (what you are looking for I think). Another thing defined here is BaseModel, which has quite some API interfaces defined.

Hi Patrick, thanks for your answer. XML-RPC web services (object proxy) expose OpenERP objects methods via "call" method (or maybe "execute" to be exact). It also expose the "exec_workflow" method, but I couldn't find the "query" method. Any hints about how to access "query" from web services?

Yohanes Iwan Sugiarto
on 5/31/13, 10:49 PM

Thanks Patrick for the update, will try that.

Yohanes Iwan Sugiarto
on 6/4/13, 12:59 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/30/13, 10:39 PM
Seen: 4402 times
Last updated: 3/16/15, 8:10 AM