diff --git a/yuthon_notice/__manifest__.py b/yuthon_notice/__manifest__.py index 4effe9597..34478b919 100644 --- a/yuthon_notice/__manifest__.py +++ b/yuthon_notice/__manifest__.py @@ -16,6 +16,8 @@ 'data/notice_code_data.xml', 'data/notice_cron_data.xml', 'data/notice_type_data.xml', + 'report/notice_print_report.xml', + 'report/notice_print_template.xml', 'views/yuthon_notice_views.xml', 'views/yuthon_notice_type_views.xml', 'views/yuthon_cs_tree_views.xml', diff --git a/yuthon_notice/models/yuthon_notice.py b/yuthon_notice/models/yuthon_notice.py index 16f830e25..53363314c 100644 --- a/yuthon_notice/models/yuthon_notice.py +++ b/yuthon_notice/models/yuthon_notice.py @@ -272,6 +272,12 @@ class YuthonNotice(models.Model): 'end_date': fields.Date.today(), }) + def action_print_notice(self): + """打印通知公告""" + self.ensure_one() + report = self.env.ref('yuthon_notice.action_notice_print_report') + return report.report_action(self) + class YuthonCsTree(models.Model): _name = 'yuthon.cs.tree' diff --git a/yuthon_notice/report/notice_print_report.xml b/yuthon_notice/report/notice_print_report.xml new file mode 100644 index 000000000..8753674bd --- /dev/null +++ b/yuthon_notice/report/notice_print_report.xml @@ -0,0 +1,23 @@ + + + + + Notice Small Top Margin + A4 + 5 + Portrait + + + + 通知公告 + + yuthon.notice + qweb-pdf + yuthon_notice.notice_print_template + yuthon_notice.notice_print_template + + report + '通知公告_%s_%s' % (object.name or '', object.code or '') + + + diff --git a/yuthon_notice/report/notice_print_template.xml b/yuthon_notice/report/notice_print_template.xml new file mode 100644 index 000000000..75cce6aca --- /dev/null +++ b/yuthon_notice/report/notice_print_template.xml @@ -0,0 +1,144 @@ + + + + diff --git a/yuthon_notice/views/yuthon_notice_views.xml b/yuthon_notice/views/yuthon_notice_views.xml index 7cc12f4d7..41d1eedfc 100644 --- a/yuthon_notice/views/yuthon_notice_views.xml +++ b/yuthon_notice/views/yuthon_notice_views.xml @@ -29,6 +29,9 @@ yuthon.notice
+
+