[MIG] base_report_to_printer: Print attachments wizard

This commit is contained in:
sebalix
2020-08-06 12:30:44 +02:00
parent e4ce148208
commit 90816757ec
2 changed files with 55 additions and 52 deletions

View File

@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
import base64
from openerp import _, models, api, fields
from odoo import _, models, api, fields
class PrintAttachment(models.TransientModel):
@@ -59,7 +58,10 @@ class PrintAttachmentLine(models.TransientModel):
attachment_id = fields.Many2one(
'ir.attachment',
required=True,
domain="['|', ('mimetype', '=', 'application/pdf'), ('mimetype', '=', 'application/octet-stream')]"
domain=(
"['|', ('mimetype', '=', 'application/pdf'), "
"('mimetype', '=', 'application/octet-stream')]"
)
)
record_name = fields.Char(related="attachment_id.res_name", readonly=True)
copies = fields.Integer(default=1)

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<odoo>
<record id="wizard_print_attachment_form" model="ir.ui.view">
<field name="name">wizard.print.attachment</field>
<field name="model">wizard.print.attachment</field>
@@ -17,9 +16,9 @@
</field>
</group>
<footer>
<button name="print_attachments" string="Print" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
<button name="print_attachments" type="object"
string="Print" class="btn-primary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
@@ -45,6 +44,8 @@
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="menu_action_wizard_print_attachment" action="action_wizard_print_attachment" sequence="50" parent="printing_menu" />
</data>
</openerp>
<menuitem id="menu_action_wizard_print_attachment"
action="action_wizard_print_attachment"
sequence="50"
parent="printing_menu" />
</odoo>