[MIG] base_report_to_printer: Print attachments wizard

This commit is contained in:
sebalix
2020-08-06 12:30:44 +02:00
committed by trisdoan
parent aa6ec505d2
commit 0551fba25b
3 changed files with 57 additions and 63 deletions

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Report to printer</title> <title>Report to printer</title>
<style type="text/css"> <style type="text/css">

View File

@@ -2,7 +2,7 @@
# 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 _, api, fields, models from odoo import _, fields, models
class PrintAttachment(models.TransientModel): class PrintAttachment(models.TransientModel):
@@ -21,7 +21,6 @@ class PrintAttachment(models.TransientModel):
string="Attachments to print", string="Attachments to print",
) )
@api.multi
def print_attachments(self): def print_attachments(self):
"""Prints a label per selected record""" """Prints a label per selected record"""
self.ensure_one() self.ensure_one()
@@ -67,7 +66,6 @@ class PrintAttachmentLine(models.TransientModel):
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)
@api.multi
def get_format(self): def get_format(self):
self.ensure_one() self.ensure_one()
mimetype = self.attachment_id.mimetype mimetype = self.attachment_id.mimetype

View File

@@ -1,60 +1,56 @@
<?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> <field name="arch" type="xml">
<field name="arch" type="xml"> <form string="Print attachments">
<form string="Print attachments"> <group>
<group> <field name="printer_id" />
<field name="printer_id" /> <field name="attachment_line_ids">
<field name="attachment_line_ids"> <tree editable="top">
<tree editable="top"> <field name="attachment_id" create="0" />
<field name="attachment_id" create="0" /> <field name="record_name" />
<field name="record_name" /> <field name="copies" />
<field name="copies" /> </tree>
</tree> </field>
</field> </group>
</group> <footer>
<footer> <button
<button name="print_attachments"
name="print_attachments" type="object"
string="Print" string="Print"
type="object" class="btn-primary"
class="oe_highlight" />
/> <button string="Cancel" class="btn-secondary" special="cancel" />
or </footer>
<button string="Cancel" class="oe_link" special="cancel" /> </form>
</footer> </field>
</form> </record>
</field> <record id="wizard_print_attachment_line_form" model="ir.ui.view">
</record> <field name="name">wizard.print.attachment.line.form</field>
<record id="wizard_print_attachment_line_form" model="ir.ui.view"> <field name="model">wizard.print.attachment.line</field>
<field name="name">wizard.print.attachment.line.form</field> <field name="arch" type="xml">
<field name="model">wizard.print.attachment.line</field> <form>
<field name="arch" type="xml"> <group>
<form> <field name="attachment_id" create="0" />
<group> <field name="record_name" />
<field name="attachment_id" create="0" /> <field name="copies" />
<field name="record_name" /> </group>
<field name="copies" /> </form>
</group> </field>
</form> </record>
</field> <record id="action_wizard_print_attachment" model="ir.actions.act_window">
</record> <field name="name">Print Attachments</field>
<record id="action_wizard_print_attachment" model="ir.actions.act_window"> <field name="type">ir.actions.act_window</field>
<field name="name">Print Attachments</field> <field name="res_model">wizard.print.attachment</field>
<field name="type">ir.actions.act_window</field> <field name="view_mode">form</field>
<field name="res_model">wizard.print.attachment</field> <field name="target">new</field>
<field name="view_type">form</field> </record>
<field name="view_mode">form</field> <menuitem
<field name="target">new</field> id="menu_action_wizard_print_attachment"
</record> action="action_wizard_print_attachment"
<menuitem sequence="50"
id="menu_action_wizard_print_attachment" parent="printing_menu"
action="action_wizard_print_attachment" />
sequence="50" </odoo>
parent="printing_menu"
/>
</data>
</openerp>