mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[IMP] base_report_to_printer - retab and clean extra spaces
This commit is contained in:
@@ -27,13 +27,13 @@
|
|||||||
'category': 'Generic Modules/Base',
|
'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.
|
'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:
|
Before you can use this module:
|
||||||
You must have lpr installed for this module to work as-is.
|
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
|
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
|
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.
|
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.
|
Then goto the user profile and set the users printing action and default printer.
|
||||||
""",
|
""",
|
||||||
'author': 'Agile Business Group & Domsense, Pegueroles SCP, NaN',
|
'author': 'Agile Business Group & Domsense, Pegueroles SCP, NaN',
|
||||||
'website': 'http://www.agilebg.com',
|
'website': 'http://www.agilebg.com',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
|||||||
@@ -60,13 +60,14 @@ class printing_printer(osv.osv):
|
|||||||
'model': fields.char('Model', size=500, readonly=True),
|
'model': fields.char('Model', size=500, readonly=True),
|
||||||
'location': fields.char('Location', size=500, readonly=True),
|
'location': fields.char('Location', size=500, readonly=True),
|
||||||
'uri': fields.char('URI', size=500, readonly=True),
|
'uri': fields.char('URI', size=500, readonly=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
_order = "name"
|
_order = "name"
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'default': lambda *a: False,
|
'default': lambda *a: False,
|
||||||
'status': lambda *a: 'unknown',
|
'status': lambda *a: 'unknown',
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, pool, cr):
|
def __init__(self, pool, cr):
|
||||||
super(printing_printer, self).__init__(pool, cr)
|
super(printing_printer, self).__init__(pool, cr)
|
||||||
@@ -194,7 +195,7 @@ def _available_action_types(self, cr, uid, context=None):
|
|||||||
('server',_('Send to Printer')),
|
('server',_('Send to Printer')),
|
||||||
('client',_('Send to Client')),
|
('client',_('Send to Client')),
|
||||||
('user_default',_("Use user's defaults")),
|
('user_default',_("Use user's defaults")),
|
||||||
]
|
]
|
||||||
|
|
||||||
class printing_action(osv.osv):
|
class printing_action(osv.osv):
|
||||||
_name = 'printing.action'
|
_name = 'printing.action'
|
||||||
@@ -203,7 +204,7 @@ class printing_action(osv.osv):
|
|||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Name', size=256, required=True),
|
'name': fields.char('Name', size=256, required=True),
|
||||||
'type': fields.selection(_available_action_types, 'Type', required=True),
|
'type': fields.selection(_available_action_types, 'Type', required=True),
|
||||||
}
|
}
|
||||||
printing_action()
|
printing_action()
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -222,7 +223,7 @@ class res_users(osv.osv):
|
|||||||
_columns = {
|
_columns = {
|
||||||
'printing_action': fields.selection(_user_available_action_types, 'Printing Action'),
|
'printing_action': fields.selection(_user_available_action_types, 'Printing Action'),
|
||||||
'printing_printer_id': fields.many2one('printing.printer', 'Default Printer'),
|
'printing_printer_id': fields.many2one('printing.printer', 'Default Printer'),
|
||||||
}
|
}
|
||||||
|
|
||||||
res_users()
|
res_users()
|
||||||
|
|
||||||
@@ -246,10 +247,10 @@ class report_xml(osv.osv):
|
|||||||
printer_system_name = printer.system_name
|
printer_system_name = printer.system_name
|
||||||
if format == 'raw':
|
if format == 'raw':
|
||||||
# -l is the same as -o raw
|
# -l is the same as -o raw
|
||||||
cmd = "lpr -l -P %s %s" % (printer_system_name,file_name)
|
cmd = "lpr -l -P %s %s" % (printer_system_name,file_name)
|
||||||
#cmd = "lp -d %s %s" % (printer_system_name,file_name)
|
#cmd = "lp -d %s %s" % (printer_system_name,file_name)
|
||||||
else:
|
else:
|
||||||
cmd = "lpr -P %s %s" % (printer_system_name,file_name)
|
cmd = "lpr -P %s %s" % (printer_system_name,file_name)
|
||||||
#cmd = "lp -d %s %s" % (printer_system_name,file_name)
|
#cmd = "lp -d %s %s" % (printer_system_name,file_name)
|
||||||
logger = logging.getLogger('base_report_to_printer')
|
logger = logging.getLogger('base_report_to_printer')
|
||||||
logger.info("Printing job : '%s'" % cmd)
|
logger.info("Printing job : '%s'" % cmd)
|
||||||
@@ -266,10 +267,10 @@ class report_xml(osv.osv):
|
|||||||
string='Action',
|
string='Action',
|
||||||
view_load=True,
|
view_load=True,
|
||||||
method=True,
|
method=True,
|
||||||
),
|
),
|
||||||
'printing_printer_id': fields.many2one('printing.printer', 'Printer'),
|
'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'),
|
'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):
|
def behaviour(self, cr, uid, ids, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
@@ -311,7 +312,7 @@ class report_xml(osv.osv):
|
|||||||
result[report.id] = {
|
result[report.id] = {
|
||||||
'action': action,
|
'action': action,
|
||||||
'printer': printer,
|
'printer': printer,
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -325,7 +326,7 @@ class report_xml_action(osv.osv):
|
|||||||
'user_id': fields.many2one('res.users', 'User', required=True, ondelete='cascade'),
|
'user_id': fields.many2one('res.users', 'User', required=True, ondelete='cascade'),
|
||||||
'action': fields.selection(_available_action_types, 'Action', required=True),
|
'action': fields.selection(_available_action_types, 'Action', required=True),
|
||||||
'printer_id': fields.many2one('printing.printer', 'Printer'),
|
'printer_id': fields.many2one('printing.printer', 'Printer'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def behaviour(self, cr, uid, report_id, context=None):
|
def behaviour(self, cr, uid, report_id, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
@@ -338,7 +339,7 @@ class report_xml_action(osv.osv):
|
|||||||
return {
|
return {
|
||||||
'action': action.action,
|
'action': action.action,
|
||||||
'printer': action.printer_id.system_name,
|
'printer': action.printer_id.system_name,
|
||||||
}
|
}
|
||||||
report_xml_action()
|
report_xml_action()
|
||||||
|
|
||||||
class virtual_report_spool(base_calendar.virtual_report_spool):
|
class virtual_report_spool(base_calendar.virtual_report_spool):
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class printing_printer_update_wizard(osv.osv_memory):
|
|||||||
_name = "printing.printer.update.wizard"
|
_name = "printing.printer.update.wizard"
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
}
|
}
|
||||||
|
|
||||||
def action_cancel(self, cr, uid, ids, context=None):
|
def action_cancel(self, cr, uid, ids, context=None):
|
||||||
return {}
|
return {}
|
||||||
@@ -60,7 +60,7 @@ class printing_printer_update_wizard(osv.osv_memory):
|
|||||||
'model': printer.get('printer-make-and-model', False),
|
'model': printer.get('printer-make-and-model', False),
|
||||||
'location': printer.get('printer-location', False),
|
'location': printer.get('printer-location', False),
|
||||||
'uri': printer.get('device-uri', False),
|
'uri': printer.get('device-uri', False),
|
||||||
}, context)
|
}, context)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'name': 'Printers',
|
'name': 'Printers',
|
||||||
@@ -69,7 +69,7 @@ class printing_printer_update_wizard(osv.osv_memory):
|
|||||||
'res_model': 'printing.printer',
|
'res_model': 'printing.printer',
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
'target': 'current',
|
'target': 'current',
|
||||||
}
|
}
|
||||||
|
|
||||||
printing_printer_update_wizard()
|
printing_printer_update_wizard()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user