Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
5232 Widoki

Hello,

I need to automate the task of generating a report of the POS statistics. 

The same as decribed here: https://www.odoo.com/documentation/user/9.0/point_of_sale/analyze/statistics.html

I'm developing a simple script on PHP using a XMLRPC lib (ripcord) but when I try to access to the model "report.pos.order" using the 'search' function it doesn't return any report instead it gives me all the orders IDs.

Is there any way to auto generate the report and at the same time using some criteria for filtering by products or date using the API?

I also followed the "Report Printing" section in https://www.odoo.com/documentation/9.0/api_integration.html

It doesn't work for me with the "report.pos.order" model.

I would like to get the data in XML or CSV or even a raw array or objects instead of a PDF so I can manipulate it.

Example code I'm using (PHP):


$url = "https://myerp.my";
$db = "my_db";
$username = "user";
$password = "pass";

$common = ripcord::client("$url/xmlrpc/2/common");
$uid = $common->authenticate($db, $username, $password, []);

$models = ripcord::client("$url/xmlrpc/2/object");
$report = $models->execute_kw($db, $uid, $password, 'report.pos.order', 'search', array(array()));

I would appreciate any help!

Thank you!


Technical Details:

- PHP 7.1

- Odoo 9.0c

- Ripcord: https://github.com/DarkaOnLine/Ripcord


Awatar
Odrzuć
Autor Najlepsza odpowiedź

Hello Paresh,

Thank you very much for the reply. I have readed more about the ORM documentation and now I'm capable of gettig the sum of the sales without re-doing the entire calculation process but now I'm facing another issue, please see the link below:

https://www.odoo.com/forum/help-1/question/point-of-sale-read-group-group-by-funcionality-api-158773

And again, thank you!

Awatar
Odrzuć
Najlepsza odpowiedź

Hi Liam:

search retrieves a list of ids. You then have to do a read to retrieve the data associated with the ids. There is also a search_read method that allows you to do a search and a read in one step. In your case, you will need to read the data from the models associated with the orders and create the report in PHP. Retrieving the report PDF will not help since it will be in a base64 encoded format which you will not be able to use for manipulating the raw data. 

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lis 22
5667
3
wrz 22
7885
2
sie 20
72
2
sie 20
52
1
lip 25
973