How to find (and maybe extend) the list of available field names for reports in the OpenERP server sourcecode?

别说谁变了你拦得住时间么 提交于 2019-12-07 20:06:33

问题


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.


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!