[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 # Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
import base64 import base64
from openerp import _, models, api, fields from odoo import _, models, api, fields
class PrintAttachment(models.TransientModel): class PrintAttachment(models.TransientModel):
@@ -59,7 +58,10 @@ class PrintAttachmentLine(models.TransientModel):
attachment_id = fields.Many2one( attachment_id = fields.Many2one(
'ir.attachment', 'ir.attachment',
required=True, 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) record_name = fields.Char(related="attachment_id.res_name", readonly=True)
copies = fields.Integer(default=1) copies = fields.Integer(default=1)

View File

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