openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #03798
Re: New module for spreadsheets creationthrough Python code interpreted from the UI
Hi Matt,
Great Job!
I've download and test your module just now, you created a menu to generate csv or xls file base on the python code in the 'config' tab.
I test on v7, little issues found, likely you write it for V6.1, the 2nd level menu in 7.0 is not executable, I move it lower. and the test report not been import even I have set "load demo" for my database, so I copy your code in demo_xml and it's running. don't know if caused by my windows environment, xls cannot been generated though. raisereport_spreadsheet\spreadsheetcreator.py", line 34, in get_xml f[0].close() TypeError: 'file' object is not subscriptablebut CSV is working.
Then I removed the [0],xls works also.
This module is great for me, Thank you for your work and sharing.
------------------
Jeff Wang | jeff@xxxxxxxxx | 18016291663 | 02158980787
@OpenERP_Jeff "As simple as possible, As complex as needed"
Maintainer of Open ERP china community
http://www.openerp-china.org
------------------ Original ------------------
From: "choplin mat";<choplin.mat@xxxxxxxxx>;
Date: Sun, Nov 3, 2013 04:00 AM
To: "openerp-community"<openerp-community@xxxxxxxxxxxxxxxxxxx>;
Subject: Re: [Openerp-community] New module for spreadsheets creationthrough Python code interpreted from the UI
Hello Community,
I have created a generic reporting module called "spreadsheet_creator" that enables (among other things) to create spreadsheet (.csv, .xls file) according to Python code that will be interpreted from the User Interface.
Usually, to create such reports, I was using "base_report_creator" that interprets sql queries from the UI but I was struggling to read the functional fields not stored in database so I thought that it could be good to have something that interprets python code besides of sql queries. Also, the "base_report_creator" module proposed "only" 2 parameters: "date from" and "date to". With this new module, you have the choice to set whatever parameters you want (group by date, list of products...) and use them with a classic orm read method in your code fields.
The thing is that it is not only limited to reports creation. As you can execute *any* python code, you can do whatever you want, and it can be dangerous... So I have tried to secure it with consistent user rights, so that only the relevant people (i.e. the admin) can configure them.
I have followed as much as possible the Guidelines stated here: https://doc.openerp.com/contribute/05_developing_modules/
I have seen that a project has been created for reporting engines: https://launchpad.net/openerp-reporting-engines so I was thinking to push it there (please tell me if it is not the right place).
It is hosted here at the moment: https://github.com/matthiouz/openerp-addons/tree/master/report_spreadsheet
If you want to test it.
- there is no dependency, so you can install it on a bare DB (without other modules than the core ones)
- it is accessible from the menu "Settings| Reporting| Reports Generation" that you can access as admin without user rights configuration. But for other users you will have to configure that: 1st in there access rights tab (to access the menu), 2nd on the report (to access the report, because each report has its own user access)
- there is one simple example (that is inactive by default)
I am very interested in your feedback, ideas...
Yours,
Matt Choplin
OpenERP developer at made.com
https://twitter.com/Matthiouz