odoo11 添加打印功能

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_15206589/article/details/84954595

1. 在__init__.py添加 from . import report

2. 在模块目录中添加report目录及文件

3. report目录下的__init__.py需要导入当前目录下的py文件

4. py文件内容:

_name= 'report.' +[数据表的名称]+ '.' +[template的id名称]

其中的get_report_values()是必须存在的,可以参考https://blog.csdn.net/shenshibujie/article/details/80682410

5. xml文件内容:

<report>标签是用来设置打印的信息和关联,

model代表model数据库的name

string代表打印的名称

name和file一样由名称+template的id组成,可以通过odoo查看

<template>标签代表pdf显示的内容

docs代表py返回的数据

web.html_container代表内容的书写

web.external_layout代表默认的页眉页脚

可以参考https://odoo-master.readthedocs.io/en/latest/reference/reports.html

6. 在 __manifest__.py文件中导入report目录中的xml文件

猜你喜欢

转载自blog.csdn.net/qq_15206589/article/details/84954595