I am looking for a reliable way to get names of available data fields when creating or extending OpenOffice/LibreOffice report files.
I already do know many field names from the existing reports. I also can lookup the field names in the module definitions.
For example in the file addons\base\res\partner\partner.py I find a field list for the partner model:
class res_partner(osv.osv):
_columns = {
'name': fields.char('Name', size=128, required=True, select=True),
'date': fields.date('Date', select=1),
'title': fields.many2one('res.partner.title','Partner Form'),
'parent_id': fields.many2one('res.partner','Parent Partner'),
'child_ids': fields.one2many('res.partner', 'parent_id', 'Partner Ref.'),
# many more...
}
But this is only guessing and it is not complete. I would prefer to know the fields that are really available for any given report, and not guess.
There are also reports with data from linked tables, which is also important.
For instance if I print an invoice there should be also the delivery address and the billing address available for the report, including the name field of the contact.
(It is also possible to use the "OpenERP Report Designer" addon for OpenOffice. You find that solution here: How to get field lists using the OpenERP Report Designer Addon for OpenOffice / LibreOffice )
How can I find out the available fields - and the best would be to also know how to make more of the existing fields available to the reports, for example from linked tables.
This would maybe include how to find the function definition that provide the fields. And I guess making more fields avalable would best be done by extending the respective module and rewriting the function that delivers the data to the report.
Under the Administration menu, open Customization: Database Structure: Objects. (I'm using version 5.0. The menus have changed in 6.0, so you might have to hunt for it.) Search for the object you're interested in, and open the form. That will list all the fields, including related fields, inherited fields, and functional fields.
If you want to know how to extend a module and add related fields, read about the different types of fields. One type is the related
field.
来源:https://stackoverflow.com/questions/8636949/how-to-find-and-maybe-extend-the-list-of-available-field-names-for-reports-in