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',
|
||||
'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
|
||||
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.
|
||||
""",
|
||||
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',
|
||||
|
||||
@@ -60,13 +60,14 @@ class printing_printer(osv.osv):
|
||||
'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)
|
||||
@@ -194,7 +195,7 @@ def _available_action_types(self, cr, uid, context=None):
|
||||
('server',_('Send to Printer')),
|
||||
('client',_('Send to Client')),
|
||||
('user_default',_("Use user's defaults")),
|
||||
]
|
||||
]
|
||||
|
||||
class printing_action(osv.osv):
|
||||
_name = 'printing.action'
|
||||
@@ -203,7 +204,7 @@ class printing_action(osv.osv):
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=256, required=True),
|
||||
'type': fields.selection(_available_action_types, 'Type', required=True),
|
||||
}
|
||||
}
|
||||
printing_action()
|
||||
|
||||
#
|
||||
@@ -222,7 +223,7 @@ class res_users(osv.osv):
|
||||
_columns = {
|
||||
'printing_action': fields.selection(_user_available_action_types, 'Printing Action'),
|
||||
'printing_printer_id': fields.many2one('printing.printer', 'Default Printer'),
|
||||
}
|
||||
}
|
||||
|
||||
res_users()
|
||||
|
||||
@@ -246,10 +247,10 @@ class report_xml(osv.osv):
|
||||
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)
|
||||
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 = "lpr -P %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.info("Printing job : '%s'" % cmd)
|
||||
@@ -266,10 +267,10 @@ class report_xml(osv.osv):
|
||||
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:
|
||||
@@ -311,7 +312,7 @@ class report_xml(osv.osv):
|
||||
result[report.id] = {
|
||||
'action': action,
|
||||
'printer': printer,
|
||||
}
|
||||
}
|
||||
return result
|
||||
|
||||
|
||||
@@ -325,7 +326,7 @@ class report_xml_action(osv.osv):
|
||||
'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:
|
||||
@@ -338,7 +339,7 @@ class report_xml_action(osv.osv):
|
||||
return {
|
||||
'action': action.action,
|
||||
'printer': action.printer_id.system_name,
|
||||
}
|
||||
}
|
||||
report_xml_action()
|
||||
|
||||
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"
|
||||
|
||||
_columns = {
|
||||
}
|
||||
}
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
return {}
|
||||
@@ -60,7 +60,7 @@ class printing_printer_update_wizard(osv.osv_memory):
|
||||
'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,7 +69,7 @@ class printing_printer_update_wizard(osv.osv_memory):
|
||||
'res_model': 'printing.printer',
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'current',
|
||||
}
|
||||
}
|
||||
|
||||
printing_printer_update_wizard()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user