openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #00258
lp:~camptocamp/report-print-send/7.0-base_report_to_printer_port-imp-yvr into lp:report-print-send
Yannick Vaucher @ Camptocamp has proposed merging lp:~camptocamp/report-print-send/7.0-base_report_to_printer_port-imp-yvr into lp:report-print-send with lp:~aes/report-print-send/base_report_to_printer as a prerequisite.
Requested reviews:
Report Printing and Sending Core Editors (report-print-send-core-editors)
For more details, see:
https://code.launchpad.net/~camptocamp/report-print-send/7.0-base_report_to_printer_port-imp-yvr/+merge/188789
Improved portage of base_report_to_printer lp:~aes/report-print-send/base_report_to_printer
--
https://code.launchpad.net/~camptocamp/report-print-send/7.0-base_report_to_printer_port-imp-yvr/+merge/188789
Your team Report Printing and Sending Core Editors is requested to review the proposed merge of lp:~camptocamp/report-print-send/7.0-base_report_to_printer_port-imp-yvr into lp:report-print-send.
=== modified file 'base_report_to_printer/__init__.py'
--- base_report_to_printer/__init__.py 2012-11-22 21:22:52 +0000
+++ base_report_to_printer/__init__.py 2013-10-02 09:43:07 +0000
@@ -21,5 +21,5 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
-import printing
-import wizard
+from . import printing
+from . import wizard
=== modified file 'base_report_to_printer/__openerp__.py'
--- base_report_to_printer/__openerp__.py 2013-10-02 09:43:07 +0000
+++ base_report_to_printer/__openerp__.py 2013-10-02 09:43:07 +0000
@@ -27,22 +27,22 @@
'category': 'Generic Modules/Base',
'description': """This module allows users to send reports to a printer attached to the server. Settings can be configured globaly, per user, per report and per user and report.
Before you can use this module:
- You must have lpr installed for this module to work as-is.
- To install lpr on ubuntu enter this command at the CLI - sudo apt-get install cups-bsd
- type ls | lpr at the command prompt to confirm your server can print
-
- After installing enable the "Printing / Print Operator" option under access rights to give users the ability to view the print menu.
- Then goto the user profile and set the users printing action and default printer.
- """,
+ You must have lpr installed for this module to work as-is.
+ To install lpr on ubuntu enter this command at the CLI - sudo apt-get install cups-bsd
+ type ls | lpr at the command prompt to confirm your server can print
+
+ After installing enable the "Printing / Print Operator" option under access rights to give users the ability to view the print menu.
+ Then goto the user profile and set the users printing action and default printer.
+ """,
'author': 'Agile Business Group & Domsense, Pegueroles SCP, NaN',
'website': 'http://www.agilebg.com',
'license': 'AGPL-3',
"depends" : ['base', 'base_calendar'],
'data': [
+ 'security/security.xml',
'printing_data.xml',
'printing_view.xml',
'wizard/update_printers.xml',
- 'security/security.xml',
],
'installable': True,
'auto_install': False,
=== modified file 'base_report_to_printer/printing.py'
--- base_report_to_printer/printing.py 2013-10-02 09:43:07 +0000
+++ base_report_to_printer/printing.py 2013-10-02 09:43:07 +0000
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# Copyright (c) 2007 Ferran Pegueroles <ferran@xxxxxxxxxxxxxx>
# Copyright (c) 2009 Albert Cervera i Areny <albert@xxxxxxxxxxx>
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
@@ -23,31 +23,25 @@
##############################################################################
import os
+import time
import base64
-import threading
from tempfile import mkstemp
+import logging
import cups
-import thread
from threading import Thread
from threading import Lock
-import netsvc
-import tools
-import time
-from osv import fields
-from osv import osv
-import pooler
-import tools
-from tools.translate import _
-from base_calendar import base_calendar
-import logging
+from openerp import pooler
+from openerp.osv import orm, fields
+from openerp.tools.translate import _
+from openerp.addons.base_calendar import base_calendar
#
# Printers
#
-class printing_printer(osv.osv):
+class printing_printer(orm.Model):
_name = "printing.printer"
_description = "Printer"
@@ -60,13 +54,14 @@
'model': fields.char('Model', size=500, readonly=True),
'location': fields.char('Location', size=500, readonly=True),
'uri': fields.char('URI', size=500, readonly=True),
- }
+ }
+
_order = "name"
-
+
_defaults = {
'default': lambda *a: False,
'status': lambda *a: 'unknown',
- }
+ }
def __init__(self, pool, cr):
super(printing_printer, self).__init__(pool, cr)
@@ -74,7 +69,7 @@
self.last_update = None
self.updating = False
- def update_printers_status(self, db_name, uid, context):
+ def update_printers_status(self, db_name, uid, context=None):
db, pool = pooler.get_db_and_pool(db_name)
cr = db.cursor()
@@ -90,13 +85,15 @@
4 : 'printing',
5 : 'error'
}
-
+
+ if context is None:
+ context = {}
try:
# Skip update to avoid the thread being created again
ctx = context.copy()
ctx['skip_update'] = True
- ids = self.pool.get('printing.printer').search(cr, uid, [], context=ctx)
- for printer in self.pool.get('printing.printer').browse(cr, uid, ids, context=ctx):
+ ids = self.search(cr, uid, [], context=ctx)
+ for printer in self.browse(cr, uid, ids, context=ctx):
vals = {}
if server_error:
status = 'server-error'
@@ -112,7 +109,7 @@
status = 'unavailable'
vals['status'] = status
- self.pool.get('printing.printer').write(cr, uid, [printer.id], vals, context)
+ self.write(cr, uid, [printer.id], vals, context)
cr.commit()
except:
cr.rollback()
@@ -174,16 +171,13 @@
self.write(cr, uid, default_ids, {'default':False}, context)
self.write(cr, uid, ids[0], {'default':True}, context)
return True
-
+
def get_default(self,cr,uid,context):
printer_ids = self.search(cr, uid,[('default','=',True)])
if printer_ids:
return printer_ids[0]
return False
-printing_printer()
-
-
#
# Actions
@@ -194,23 +188,22 @@
('server',_('Send to Printer')),
('client',_('Send to Client')),
('user_default',_("Use user's defaults")),
- ]
+ ]
-class printing_action(osv.osv):
+class printing_action(orm.Model):
_name = 'printing.action'
_description = 'Print Job Action'
_columns = {
'name': fields.char('Name', size=256, required=True),
'type': fields.selection(_available_action_types, 'Type', required=True),
- }
-printing_action()
+ }
-#
+#
# Users
#
-class res_users(osv.osv):
+class res_users(orm.Model):
_name = "res.users"
_inherit = "res.users"
@@ -222,17 +215,26 @@
_columns = {
'printing_action': fields.selection(_user_available_action_types, 'Printing Action'),
'printing_printer_id': fields.many2one('printing.printer', 'Default Printer'),
- }
-
-res_users()
+ }
#
# Reports
-#
-
-class report_xml(osv.osv):
-
- def print_direct(self, cr, uid, result, format, printer):
+#
+
+class report_xml(orm.Model):
+
+
+ def set_print_options(self, cr, uid, report_id, format, context=None):
+ """
+ Hook to set print options
+ """
+ options = {}
+ if format == 'raw':
+ options['raw'] = True
+ return options
+
+ def print_direct(self, cr, uid, report_id, result, format, printer, context=None):
+ user_obj = self.pool.get('res.users')
fd, file_name = mkstemp()
try:
os.write(fd, base64.decodestring(result))
@@ -244,16 +246,13 @@
printer_system_name = printer
else:
printer_system_name = printer.system_name
- if format == 'raw':
- # -l is the same as -o raw
- cmd = "lpr -l -P %s %s" % (printer_system_name,file_name)
- #cmd = "lp -d %s %s" % (printer_system_name,file_name)
- else:
- cmd = "lpr -P %s %s" % (printer_system_name,file_name)
- #cmd = "lp -d %s %s" % (printer_system_name,file_name)
+ connection = cups.Connection()
+
+ options = self.set_print_options(cr, uid, report_id, format, context=context)
+
+ connection.printFile(printer_system_name, file_name, file_name, options=options)
logger = logging.getLogger('base_report_to_printer')
- logger.info("Printing job : '%s'" % cmd)
- os.system(cmd)
+ logger.info("Printing job : '%s'" % file_name)
return True
_inherit = 'ir.actions.report.xml'
@@ -266,22 +265,21 @@
string='Action',
view_load=True,
method=True,
- ),
+ ),
'printing_printer_id': fields.many2one('printing.printer', 'Printer'),
'printing_action_ids': fields.one2many('printing.report.xml.action', 'report_id', 'Actions', help='This field allows configuring action and printer on a per user basis'),
- }
+ }
def behaviour(self, cr, uid, ids, context=None):
- if context is None:
- context={}
result = {}
-
+ printer_obj = self.pool.get('printing.printer')
+ printing_act_obj = self.pool.get('printing.report.xml.action')
# Set hardcoded default action
default_action = 'client'
# Retrieve system wide printer
- default_printer = self.pool.get('printing.printer').get_default(cr,uid,context)
+ default_printer = printer_obj.get_default(cr, uid, context=context)
if default_printer:
- default_printer = self.pool.get('printing.printer').browse(cr,uid,default_printer,context).system_name
+ default_printer = printer_obj.browse(cr, uid, default_printer, context=context)
# Retrieve user default values
@@ -289,7 +287,7 @@
if user.printing_action:
default_action = user.printing_action
if user.printing_printer_id:
- default_printer = user.printing_printer_id.system_name
+ default_printer = user.printing_printer_id
for report in self.browse(cr, uid, ids, context):
action = default_action
@@ -302,8 +300,12 @@
printer = report.printing_printer_id
# Retrieve report-user specific values
- user_action = self.pool.get('printing.report.xml.action').behaviour(cr, uid, report.id, context)
- if user_action and user_action['action'] != 'user_default':
+ act_ids = printing_act_obj.search(cr, uid,
+ [('report_id', '=', report.id),
+ ('user_id', '=', uid),
+ ('action', '!=', 'user_default')], context=context)
+ if act_ids:
+ user_action = printing_act_obj.behaviour(cr, uid, act_ids[0], context)
action = user_action['action']
if user_action['printer']:
printer = user_action['printer']
@@ -311,13 +313,11 @@
result[report.id] = {
'action': action,
'printer': printer,
- }
+ }
return result
-report_xml()
-
-class report_xml_action(osv.osv):
+class report_xml_action(orm.Model):
_name = 'printing.report.xml.action'
_description = 'Report Printing Actions'
_columns = {
@@ -325,21 +325,18 @@
'user_id': fields.many2one('res.users', 'User', required=True, ondelete='cascade'),
'action': fields.selection(_available_action_types, 'Action', required=True),
'printer_id': fields.many2one('printing.printer', 'Printer'),
- }
-
- def behaviour(self, cr, uid, report_id, context=None):
- if context is None:
- context={}
+ }
+
+
+ def behaviour(self, cr, uid, act_id, context=None):
result = {}
- ids = self.search(cr, uid, [('report_id','=',report_id),('user_id','=',uid)], context=context)
- if not ids:
+ if not act_id:
return False
- action = self.browse(cr, uid, ids[0], context)
+ action = self.browse(cr, uid, act_id, context=context)
return {
'action': action.action,
- 'printer': action.printer_id.system_name,
- }
-report_xml_action()
+ 'printer': action.printer_id,
+ }
class virtual_report_spool(base_calendar.virtual_report_spool):
@@ -365,10 +362,13 @@
if action != 'client':
if (self._reports and self._reports.get(report_id, False) and self._reports[report_id].get('result', False)
and self._reports[report_id].get('format', False)):
- report_obj.print_direct(cr, uid, base64.encodestring(self._reports[report_id]['result']),
+ report_obj.print_direct(cr, uid, report.id, base64.encodestring(self._reports[report_id]['result']),
self._reports[report_id]['format'], printer)
- raise osv.except_osv(_('Printing...'), _('Document sent to printer %s') % (printer,))
-
+ # XXX "Warning" removed as it breaks the workflow
+ # it would be interesting to have a dialog box to confirm if we really want to print
+ # in this case it must be with a by pass parameter to allow massive impression
+ #raise osv.except_osv(_('Printing...'), _('Document sent to printer %s') % (printer,))
+
except:
cr.rollback()
raise
=== modified file 'base_report_to_printer/printing_data.xml'
--- base_report_to_printer/printing_data.xml 2012-11-22 21:22:52 +0000
+++ base_report_to_printer/printing_data.xml 2013-10-02 09:43:07 +0000
@@ -1,20 +1,20 @@
<?xml version="1.0"?>
<openerp>
-<data>
- <!-- printing.action -->
- <record model="printing.action" id="printing_action_1">
- <field name="name">Send to Printer</field>
- <field name="type">server</field>
- </record>
- <record model="printing.action" id="printing_action_2">
- <field name="name">Send to Client</field>
- <field name="type">client</field>
- </record>
- <!-- properties -->
- <record forcecreate="True" id="property_printing_action" model="ir.property">
- <field name="name">property_printing_action</field>
- <field name="fields_id" search="[('model','=','ir.actions.report.xml'),('name','=','property_printing_action')]"/>
- <field name="value" eval="'printing.action,'+str(printing_action_2)"/>
- </record>
-</data>
+ <data>
+ <!-- printing.action -->
+ <record model="printing.action" id="printing_action_1">
+ <field name="name">Send to Printer</field>
+ <field name="type">server</field>
+ </record>
+ <record model="printing.action" id="printing_action_2">
+ <field name="name">Send to Client</field>
+ <field name="type">client</field>
+ </record>
+ <!-- properties -->
+ <record forcecreate="True" id="property_printing_action" model="ir.property">
+ <field name="name">property_printing_action</field>
+ <field name="fields_id" search="[('model','=','ir.actions.report.xml'),('name','=','property_printing_action')]"/>
+ <field name="value" eval="'printing.action,'+str(printing_action_2)"/>
+ </record>
+ </data>
</openerp>
=== modified file 'base_report_to_printer/printing_view.xml'
--- base_report_to_printer/printing_view.xml 2013-10-02 09:43:07 +0000
+++ base_report_to_printer/printing_view.xml 2013-10-02 09:43:07 +0000
@@ -1,111 +1,114 @@
<?xml version="1.0"?>
<openerp>
-<data>
+ <data>
<menuitem name="Printing" id="menu_printing_main" parent="base.menu_config" groups="res_groups_printingprintoperator0"/>
-
- <record model="ir.ui.view" id="view_printing_printer_form">
- <field name="name">printing.printer.form</field>
- <field name="model">printing.printer</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Printers">
- <field name="name" select="1"/>
- <field name="system_name" select="1"/>
- <group col="3" colspan="2">
- <field name="default" select="1"/>
- <button name="set_default" string="Set Default" type="object"/>
- </group>
- <field name="uri" select="2"/>
- <field name="model" select="2"/>
- <field name="location" select="2"/>
- <field name="status" select="1"/>
- <field name="status_message" select="2"/>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_printing_printer_tree">
- <field name="name">printing.printer.tree</field>
- <field name="model">printing.printer</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Printers" colors="green:status=='available'; orange:status=='printing'; red:1;">
- <field name="default"/>
- <field name="name"/>
- <field name="system_name"/>
- <field name="status"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_printing_printer_form">
- <field name="name">Show Printers</field>
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">printing.printer</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="auto_refresh">20</field>
- </record>
-
- <menuitem name="Printers"
- id="menu_printing_printer_form"
- parent="menu_printing_main"
- action="action_printing_printer_form"/>
-
- <record model="ir.ui.view" id="action_report_xml_form">
- <field name="name">ir.actions.report.xml.printing</field>
- <field name="model">ir.actions.report.xml</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="base.act_report_xml_view" />
- <field name="arch" type="xml">
- <field name="groups_id" position="before">
- <field name="property_printing_action"/>
- <field name="printing_printer_id"/>
- <field name="printing_action_ids" colspan="4"/>
- </field>
- </field>
- </record>
-
- <!-- res.users -->
- <record model="ir.ui.view" id="view_printing_users_form">
- <field name="name">res.users.form.printing</field>
- <field name="type">form</field>
- <field name="model">res.users</field>
- <field name="inherit_id" ref="base.view_users_form" />
- <field name="arch" type="xml">
- <field name="lang" position="after">
- <field name="printing_action" />
- <field name="printing_printer_id" />
- </field>
- </field>
- </record>
-
- <!-- printing.report.xml.action -->
- <record model="ir.ui.view" id="printing_report_xml_action_form">
- <field name="name">printing.report.xml.action.form</field>
- <field name="model">printing.report.xml.action</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Report Printing Actions">
- <field name="user_id"/>
- <label string=""/>
- <field name="action"/>
- <field name="printer_id" select="1"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="printing_report_xml_action_tree">
- <field name="name">printing.report.xml.action.tree</field>
- <field name="model">printing.report.xml.action</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Report Printing Actions">
- <field name="user_id"/>
- <field name="action" />
- <field name="printer_id" />
- </tree>
- </field>
- </record>
-</data>
-</openerp>
\ No newline at end of file
+
+ <record model="ir.ui.view" id="view_printing_printer_form">
+ <field name="name">printing.printer.form</field>
+ <field name="model">printing.printer</field>
+ <field name="arch" type="xml">
+ <form string="Printers">
+ <field name="name" select="1"/>
+ <field name="system_name" select="1"/>
+ <group col="3" colspan="2">
+ <field name="default" select="1"/>
+ <button name="set_default" string="Set Default" type="object"/>
+ </group>
+ <field name="uri" select="2"/>
+ <field name="model" select="2"/>
+ <field name="location" select="2"/>
+ <field name="status" select="1"/>
+ <field name="status_message" select="2"/>
+ </form>
+ </field>
+ </record>
+
+ <record model="ir.ui.view" id="view_printing_printer_tree">
+ <field name="name">printing.printer.tree</field>
+ <field name="model">printing.printer</field>
+ <field name="arch" type="xml">
+ <tree string="Printers" colors="green:status=='available'; orange:status=='printing'; red:1;">
+ <field name="default"/>
+ <field name="name"/>
+ <field name="system_name"/>
+ <field name="status"/>
+ </tree>
+ </field>
+ </record>
+
+ <record model="ir.actions.act_window" id="action_printing_printer_form">
+ <field name="name">Show Printers</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">printing.printer</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="auto_refresh">20</field>
+ </record>
+
+ <menuitem name="Printers"
+ id="menu_printing_printer_form"
+ parent="menu_printing_main"
+ action="action_printing_printer_form"/>
+
+ <record model="ir.ui.view" id="action_report_xml_form">
+ <field name="name">ir.actions.report.xml.printing</field>
+ <field name="model">ir.actions.report.xml</field>
+ <field name="inherit_id" ref="base.act_report_xml_view" />
+ <field name="arch" type="xml">
+ <page string="Security" position="after">
+ <page string="Print">
+ <group>
+ <field name="property_printing_action"/>
+ <field name="printing_printer_id"/>
+ </group>
+
+ <separator string="Specific actions per user"/>
+ <field name="printing_action_ids"/>
+ </page>
+ </page>
+ </field>
+ </record>
+
+ <!-- res.users -->
+ <record model="ir.ui.view" id="view_printing_users_form">
+ <field name="name">res.users.form.printing</field>
+ <field name="model">res.users</field>
+ <field name="inherit_id" ref="base.view_users_form" />
+ <field name="arch" type="xml">
+ <field name="lang" position="after">
+ <group>
+ <field name="printing_action"/>
+ <field name="printing_printer_id"/>
+ </group>
+ </field>
+ </field>
+ </record>
+
+ <!-- printing.report.xml.action -->
+ <record model="ir.ui.view" id="printing_report_xml_action_form">
+ <field name="name">printing.report.xml.action.form</field>
+ <field name="model">printing.report.xml.action</field>
+ <field name="arch" type="xml">
+ <form string="Report Printing Actions">
+ <field name="user_id"/>
+ <label string=""/>
+ <field name="action"/>
+ <field name="printer_id" select="1"/>
+ </form>
+ </field>
+ </record>
+ <record model="ir.ui.view" id="printing_report_xml_action_tree">
+ <field name="name">printing.report.xml.action.tree</field>
+ <field name="model">printing.report.xml.action</field>
+ <field name="arch" type="xml">
+ <tree string="Report Printing Actions">
+ <field name="user_id"/>
+ <field name="action" />
+ <field name="printer_id" />
+ </tree>
+ </field>
+ </record>
+
+ </data>
+</openerp>
=== modified file 'base_report_to_printer/wizard/__init__.py'
--- base_report_to_printer/wizard/__init__.py 2012-11-22 21:22:52 +0000
+++ base_report_to_printer/wizard/__init__.py 2013-10-02 09:43:07 +0000
@@ -20,4 +20,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
-import update_printers
+from . import update_printers
=== modified file 'base_report_to_printer/wizard/update_printers.py'
--- base_report_to_printer/wizard/update_printers.py 2012-11-22 21:22:52 +0000
+++ base_report_to_printer/wizard/update_printers.py 2013-10-02 09:43:07 +0000
@@ -21,21 +21,16 @@
#
##############################################################################
-import time
-import subprocess
import cups
-import netsvc
-from osv import fields
-from osv import osv
-from tools.translate import _
-
-
-class printing_printer_update_wizard(osv.osv_memory):
+from openerp.osv import orm
+
+
+class printing_printer_update_wizard(orm.TransientModel):
_name = "printing.printer.update.wizard"
_columns = {
- }
+ }
def action_cancel(self, cr, uid, ids, context=None):
return {}
@@ -51,7 +46,7 @@
ids = self.pool.get('printing.printer').search(cr, uid, [('system_name','in',printers.keys())], context=context)
for printer in self.pool.get('printing.printer').browse(cr, uid, ids, context):
del printers[printer.system_name]
-
+
for name in printers:
printer = printers[name]
self.pool.get('printing.printer').create(cr, uid, {
@@ -60,7 +55,7 @@
'model': printer.get('printer-make-and-model', False),
'location': printer.get('printer-location', False),
'uri': printer.get('device-uri', False),
- }, context)
+ }, context)
return {
'name': 'Printers',
@@ -69,8 +64,7 @@
'res_model': 'printing.printer',
'type': 'ir.actions.act_window',
'target': 'current',
- }
+ }
-printing_printer_update_wizard()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'base_report_to_printer/wizard/update_printers.xml'
--- base_report_to_printer/wizard/update_printers.xml 2013-10-02 09:43:07 +0000
+++ base_report_to_printer/wizard/update_printers.xml 2013-10-02 09:43:07 +0000
@@ -1,26 +1,27 @@
+<?xml version="1.0"?>
<openerp>
-<data>
- <record id="printer_update_wizard" model="ir.ui.view">
- <field name="name">printing.printer.update.wizard</field>
- <field name="model">printing.printer.update.wizard</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Update Printers from CUPS" col="2">
- <label string="This process will create all missing printers from the current CUPS server." colspan="2"/>
- <separator string="" colspan="2"/>
- <button name="action_cancel" icon="gtk-cancel" string="Cancel" special="cancel"/>
- <button name="action_ok" type="object" icon="gtk-ok" string="Ok"/>
- </form>
- </field>
- </record>
- <record id="action_printer_update_wizard" model="ir.actions.act_window">
- <field name="name">Update Printers from CUPS</field>
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">printing.printer.update.wizard</field>
- <field name="view_type">form</field>
- <field name="view_mode">form</field>
- <field name="target">new</field>
- </record>
- <menuitem action="action_printer_update_wizard" id="menu_printer_update_wizard" parent="menu_printing_main"/>
-</data>
+ <data>
+ <record id="printer_update_wizard" model="ir.ui.view">
+ <field name="name">printing.printer.update.wizard</field>
+ <field name="model">printing.printer.update.wizard</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Update Printers from CUPS" col="2">
+ <label string="This process will create all missing printers from the current CUPS server." colspan="2"/>
+ <separator string="" colspan="2"/>
+ <button name="action_cancel" icon="gtk-cancel" string="Cancel" special="cancel"/>
+ <button name="action_ok" type="object" icon="gtk-ok" string="Ok"/>
+ </form>
+ </field>
+ </record>
+ <record id="action_printer_update_wizard" model="ir.actions.act_window">
+ <field name="name">Update Printers from CUPS</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">printing.printer.update.wizard</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ </record>
+ <menuitem action="action_printer_update_wizard" id="menu_printer_update_wizard" parent="menu_printing_main"/>
+ </data>
</openerp>
Follow ups