OpenERP - 报告创建

1 投票
4 回答
6207 浏览
提问于 2025-04-17 09:07

我想用报告插件和OpenOffice创建一个新的报告,但我不知道怎么在OpenERP系统中设置它。

有没有人能给我提供创建新报告和与OpenERP集成的具体步骤?

提前谢谢大家!

4 个回答

1

首先,你要保存一个 .odt 文件,然后连接到服务器,选择打开一个新报告。接着,把这个报告发送到服务器,并给它起个合适的名字。之后,你可以通过选择修改现有报告的选项,继续编辑你的报告。

1

关于如何创建一个新的报告并把它添加到OpenERP中的步骤,可以在开发者文档里找到。听起来你可能特别想知道怎么让这个报告在用户界面上显示出来。这个内容可以在服务器PDF输出的部分里找到。

7

下面是创建OpenERP RML报告的步骤。

  1. 打开 open-office.org

    • 在工具菜单中
      • 选择扩展管理器
        • 找到 - base_report_designer
        • 插件 → openerp_report_designer.zip
  2.  

    • 重启 open-office
  3.  

    • 打开一个新报告
    • 添加一个循环(选择你的数据库)
    • 将循环设置为重复
    • 添加一个字段并自定义其外观
    • 将文件保存为 .sxw 格式,或者发送到服务器
  4. 将 .sxw 文件转换为 .rml

    • $> cd 到 base-report-designer/openerp_sxw2rml
    • $> python openerp_sxw2rml.py ../../exam/report/.sxw > ../../exam/report/.rml
  5. (在报告文件夹中)

    • exam.py(或者从 http://doc.openerp.com/v6.0/developer/3_11_reports/11_1_openoffice_report.html 复制过来):

      import time 
      from report import report_sxw 
      class exam(report_sxw.rml_parse): 
           def __init__(self, cr, uid, name, context): 
                  super(exam, self).__init__(cr, uid, name, context) 
                  self.localcontext.update({ 
                   'time': time, 
                  }) 
      report_sxw.report_sxw('report.exam.student', 'exam.student', 
              'addons/exam/report/exam.rml', parser=exam, header=True)
      
    • (exam.py, exam.rml, exam.sxw, __init__.py)

    • __init__.py:

      import exam
      
  6. (主 exam 文件夹)

    • exam_report.xml

      <?xml version="1.0"?> 
      <openerp> 
          <data> 
              <report 
                      id="exam_student" 
                      string="Print Exam..." 
                      model="exam.student" 
                      name="exam.student" 
                      rml="exam/report/exam.rml" 
                      auto="False" 
                      header="False"/> 
          </data> 
      </openerp>
      
    • __openerp__.py
      在更新中 → 'exam_report.xml'

    • __init__.py

      import report
      

撰写回答