RAD Tools

DIA

uml_dia 模块可以帮助开发者使用 DIA 工具 (http://www.gnome.org/projects/dia) 设计UML后自动生成开发新模块.

这并不是一个需要安装到服务器上的非标准模块, 整个模块仅仅是一个 Dia 的Python脚本(codegen_openerp.py), 以及一个用于生成模块的测试用的 dia 文档.

模块在 extra_addons 项目的分支中: https://code.launchpad.net/openobject-addons

要在Dia中使用 codegen_openerp 模块, 通常在 /usr/share/dia/python 路径下载入一次即可, 只需要打开 Dia 并且从 Dialog Menu 菜单下打开 Python Console, 在Python 交互窗口中输入 “import codegen_openerp”. 如果不出意外的话,你就可以在 “PyDia Code Generation (OpenERP)” 对话框中 选择 “Export...” 来导出并创建一个由UML设计自动生成的 zip 格式的OpenERP 模块了.

要安装 Dia for windows, 你需要先安装 Python-2.3.5, 再安装 Dia, 就可以选择是否安装 Dia 的plug-in. 然后再将 codegen_openerp.py 文件复制到 C:\Program Files\Dia , 然后你的Dia 就可以实现导出 OpenERP 模块的功能了.

Dia for Windows 的安装请参阅 (http://openerpdev.blogspot.com/2009/11/rad-with-openerp.html)

如果你得到最终的ZIP文件不能正常打开, 只需要使用 DiskInternals ZipRepais utility 工具来修复一下zip 文件,即可在OpenERP 中正常导入了. 当然,你不能修改zip文件的文件名. 因为文件名必须与你的模块名保持一致.

Open Office 报表设计工具

安装

Openoffice.org 报表设计器插件方便安装与使用. 整个插件只有两个文件: openofficereport.zip 与 Makefile. 下面来看看具体的安装步骤.

  • 在 Openoffice Writer 中插件管理中心安装.

要安装设计器插件,需要在菜单 Tools ‣ Extension Manager 去激活安装.

../../_images/1_1.png

在插件管理器窗口中, 点击 Add 按钮弹出文件选择框, 这时你选择下载的插件 openofficereport.zip 文件进行安装.

../../_images/1_2.png

插件安装完毕后,你可以在 Openoffice.org Writer 中发现多出来一个 OpenERP Report 菜单项.

../../_images/21.png

配置连接参数

你可以在菜单: OpenERP Report ‣ Server Parameters 或者点击工具栏上的 OpenERP 按钮,就可以以不同的用户 身份连接到 OpenERP Server.

点开后弹出窗体:

../../_images/31.png

指定正确的 Server URL 后, 你就可以用相应的用户登陆进该 OpenERP Server了.

你还可以通过点击 ‘Change’ 按钮来修改这些配置参数.

../../_images/3_1.png

创建一个新报表

点击 OpenERP Report ‣ Open a new report 打开创建新报表的对话框.

../../_images/41.png

在上面的窗口中,选择相应模块来创建与该模块相关的报表.

循环

为了在 OpenERP Report 中循环输出数据. 只需要打开菜单 OpenERP Report ‣ Add a loop 或者 点击工具栏的 按钮 激活下面的窗口. * 循环部分也可以放到表格或者OpenOffice.org的部件中.

../../_images/51.png

点击 ‘OK’ 按钮,就可以得到一个可循环的对象,参见下图:

../../_images/5_1.png

上面完成了在 OpenOffice.org 报表中使用一个 Input 字段的功能. 并且这个字段会在文档上表现为一个深色背景以及 你在变量名那里输入的英文: | .partner.|

添加字段打印

如果需要在 OpenERP Report 中使用对象的其他字段, 你需要点开工具栏按钮或者 OpenERP Report ‣ Add a Field 菜单 打开下图的对话框,选择一个或者多个字段.

../../_images/61.png

使用表达式

还可以为 OpenERP Report 针对字段创建一些表达式. 点击 OpenERP Report ‣ Add an expression 象下图这样.

  • 点 Expression 按钮,你可以直接输入 Python表达式. 表达式可以用于报表涉及对象的所有字段计算. 例如, 你可以在订单报表中使用如下的表达式:
'%.2f' % (amount_total * 0.9,)

在上面的例子中, amount_total 是订单对象的一个字段. 上面的表达式则将字段的金额9折后按两位小数的格式输出.

../../_images/71.png

点击 ‘ok’ 按钮后, 就会得到一个 表达式 对象, 如下图所示

../../_images/7_1.png

使用翻译标签

因为 OpenERP 是多语言的, 所以报表也必须要支持多语言翻译. 但是报表中并非所有项都需要翻译: 类似那些用于格式 化输入的部分,就不应该做翻译处理. 如果XML标签含有属性 t=”1” 的话, 则这个字段会被处理成多语言字段. 在报表生 成的时候, 服务器会自动处理该字段为含有<lang>标签的字段.

../../_images/81.png

修改

修改 OpenERP Report 中的 repeatIn, 字段及表达式. * This functionality will work with cursor you have to place your current cursor before the report statement and it will open dialog box after detecting that statement is either Expression, RepeatIn or Fields.

  • 点击 OpenERP Report ‣ Modify 菜单弹出下面的对话框.
../../_images/91.png

将光标置于你要修改的部分的最前面, 点击菜单 OpenERP Report ‣ Modify 或者点击工具栏的修改按钮. 系统会自动根据所修改的部分的类型(字段,表达式,循环)自动调出类似下面的对应的修改窗口.

../../_images/101.png

Conversion Fields > Brackets

The purpose of this functionality is mapping old (use bracket for writing report statement) and new (use input filed for writing report statement). So whenever you want to convert your new report statement to old fashion then you can use this method. if you want to access this functionality you can click on OpenReport > Conversion Fields > Bracket from menubar.

../../_images/11.png

Conversion Brackets > Fields

This is reverse functionality in which you can change your old-format report into new format. If you want to access this functionality you can click on Open Report > Conversion Bracket > Fields from menubar.

../../_images/121.png

添加附件

You can attach the report with record using attachment and the model which add in base_model are displayed in list. Note: Server side Add the base_model module this module available in trunk-extra-addons and add the model name which display in Add Attachment.

../../_images/13.png ../../_images/141.png

导出RML文件

  • 可以将 sxw 文件转化生成相应的 rml 文件.
  • 点击 OpenERP Report ‣ Export to RML 菜单.
  • The basic feature of this functionality is now you can create your rml file in just few mouse clicks. The main requirements of this utility is you must have to save your report in Open Server using Send to the Server functionality.
  • When you click on Export to RML It will open save file dialog box in which you can specify file name and destination of rml file to save

保存报表到OpenERP

This is the most important functionality available in Open Report Design tools * The basic feature of this functionality is to add new report or update existing report to Open Servein RML as well as SXW format. * You can access this feature by using clicking on Open Report > Send to the Server in menubar *

../../_images/151.png

修改报表

Openoffice.org Report Design tool provide functionality of modify existing report which is already available in Open server and also delete the report from database. You can access this feature by using clicking on OpenReport > Modify Existing Report in menubar. By clicking on Modify Existing Report I will display dialog box displayed below.

../../_images/16.png

现在你可以选择打开现有的报表, 或者删除掉现有的报表. 打开报表则会将服务器的报表保存到一个临时文件夹里,再调用可用 的编辑器打开. 如图所示

../../_images/17.png

关于

这个关于窗口显示着版权和版本信息.你可以在菜单栏上的报表>关于中打开窗口.

../../_images/18.png