mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[WIP] Migrate base_report_to_printer to V12
This commit is contained in:
@@ -1,10 +1,29 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
=================
|
||||
Report to printer
|
||||
=================
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
:alt: Beta
|
||||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freport--print--send-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/report-print-send/tree/12.0/base_report_to_printer
|
||||
:alt: OCA/report-print-send
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/report-print-send-12-0/report-print-send-12-0-base_report_to_printer
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/144/12.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
=================
|
||||
Report To Printer
|
||||
=================
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module allows users to send reports to a printer attached to the server.
|
||||
|
||||
@@ -31,10 +50,17 @@ Settings can be configured:
|
||||
* per report
|
||||
* per user and report
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
* Install PyCups - https://pypi.python.org/pypi/pycups
|
||||
To install this module, you need to:
|
||||
|
||||
#. Install PyCups - https://pypi.python.org/pypi/pycups
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -43,58 +69,64 @@ Installation
|
||||
sudo apt-get install python3-dev
|
||||
sudo pip install pycups
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
After installing enable the "Printing / Print User" option under access
|
||||
rights to give users the ability to view the print menu.
|
||||
To configure this module, you need to:
|
||||
|
||||
#. Enable the "Printing / Print User" option under access
|
||||
rights to give users the ability to view the print menu.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Guidelines for use:
|
||||
|
||||
* To update the CUPS printers in *Settings > Printing > Update Printers
|
||||
from CUPS*
|
||||
* If you want to print a report on a specific printer or tray, you can change
|
||||
* To print a report on a specific printer or tray, you can change
|
||||
these in *Settings > Printing > Reports* to define default behaviour.
|
||||
* If you want to print a report on a specific printer and/or tray for a user, you can
|
||||
* To print a report on a specific printer and/or tray for a user, you can
|
||||
change these in *Settings > Printing > Reports* in
|
||||
*Specific actions per user*
|
||||
* Users may also select a default action, printer or tray in their preferences
|
||||
* Users may also select a default action, printer or tray in their preferences.
|
||||
|
||||
When no tray is configured for a report and a user, the
|
||||
default tray setup on the CUPS server is used.
|
||||
|
||||
Caveat
|
||||
------
|
||||
Changelog
|
||||
=========
|
||||
|
||||
The notification when a report is sent to a printer will not be
|
||||
displayed for the deprecated report types (RML, Webkit, ...).
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/144/11.0
|
||||
12.0.1.0.0 (2018-02-04)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* [RELEASE] Port from V11.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/report-print-send/issues>`_. In case of trouble, please
|
||||
check there if your issue has already been reported. If you spotted it first,
|
||||
help us smashing it by providing a detailed and welcomed feedback.
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/report-print-send/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/report-print-send/issues/new?body=module:%20base_report_to_printer%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Images
|
||||
------
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
|
||||
* Agile Business Group & Domsense
|
||||
* Pegueroles SCP
|
||||
* NaN
|
||||
* LasLabs
|
||||
* Camptocamp
|
||||
* Open for Small Business Ltd
|
||||
|
||||
Contributors
|
||||
------------
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Ferran Pegueroles <ferran@pegueroles.com>
|
||||
* Albert Cervera i Areny <albert@nan-tic.com>
|
||||
@@ -106,18 +138,21 @@ Contributors
|
||||
* Dave Lasley <dave@laslabs.com>
|
||||
* Sylvain Garancher <sylvain.garancher@syleam.fr>
|
||||
* Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||
* Graeme Gellatly <graeme@o4sb.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
To contribute to this module, please visit https://odoo-community.org.
|
||||
This module is part of the `OCA/report-print-send <https://github.com/OCA/report-print-send/tree/12.0/base_report_to_printer>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
@@ -8,10 +7,11 @@
|
||||
|
||||
{
|
||||
'name': "Report to printer",
|
||||
'version': '11.0.2.3.0',
|
||||
'version': '12.0.1.0.0',
|
||||
'category': 'Generic Modules/Base',
|
||||
'author': "Agile Business Group & Domsense, Pegueroles SCP, NaN,"
|
||||
" LasLabs, Camptocamp, Odoo Community Association (OCA)",
|
||||
" LasLabs, Camptocamp, Odoo Community Association (OCA),"
|
||||
" Open for Small Business Ltd",
|
||||
'website': 'http://www.agilebg.com',
|
||||
'license': 'AGPL-3',
|
||||
"depends": ['web'],
|
||||
@@ -28,7 +28,7 @@
|
||||
'wizards/printing_printer_update_wizard_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
'application': False,
|
||||
'external_dependencies': {
|
||||
'python': ['cups'],
|
||||
},
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import ir_actions_report
|
||||
from . import printing_action
|
||||
|
||||
@@ -136,14 +136,14 @@ class IrActionsReport(models.Model):
|
||||
res['id'] = self.id
|
||||
return res
|
||||
|
||||
def render_qweb_pdf(self, docids, data=None):
|
||||
def render_qweb_pdf(self, res_ids=None, data=None):
|
||||
""" Generate a PDF and returns it.
|
||||
|
||||
If the action configured on the report is server, it prints the
|
||||
generated document as well.
|
||||
"""
|
||||
document, doc_format = super(IrActionsReport, self).render_qweb_pdf(
|
||||
docids, data=data)
|
||||
res_ids=res_ids, data=data)
|
||||
|
||||
behaviour = self.behaviour()
|
||||
printer = behaviour.pop('printer', None)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2016 SYLEAM (<http://www.syleam.fr>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
@@ -62,9 +62,20 @@ class PrintingPrinter(models.Model):
|
||||
|
||||
@api.multi
|
||||
def _prepare_update_from_cups(self, cups_connection, cups_printer):
|
||||
vals = super(PrintingPrinter, self)._prepare_update_from_cups(
|
||||
cups_connection, cups_printer)
|
||||
|
||||
mapping = {
|
||||
3: 'available',
|
||||
4: 'printing',
|
||||
5: 'error'
|
||||
}
|
||||
vals = {
|
||||
'name': cups_printer['printer-info'],
|
||||
'model': cups_printer.get('printer-make-and-model', False),
|
||||
'location': cups_printer.get('printer-location', False),
|
||||
'uri': cups_printer.get('device-uri', False),
|
||||
'status': mapping.get(cups_printer.get(
|
||||
'printer-state'), 'unknown'),
|
||||
'status_message': cups_printer.get('printer-state-message', ''),
|
||||
}
|
||||
printer_uri = cups_printer['printer-uri-supported']
|
||||
printer_system_name = printer_uri[printer_uri.rfind('/') + 1:]
|
||||
ppd_info = cups_connection.getPPD3(printer_system_name)
|
||||
@@ -103,33 +114,12 @@ class PrintingPrinter(models.Model):
|
||||
for tray in self.tray_ids.filtered(
|
||||
lambda record: record.system_name not in cups_trays.keys())
|
||||
])
|
||||
|
||||
return vals
|
||||
|
||||
@api.multi
|
||||
def _prepare_update_from_cups(self, cups_connection, cups_printer):
|
||||
mapping = {
|
||||
3: 'available',
|
||||
4: 'printing',
|
||||
5: 'error'
|
||||
}
|
||||
vals = {
|
||||
'name': cups_printer['printer-info'],
|
||||
'model': cups_printer.get('printer-make-and-model', False),
|
||||
'location': cups_printer.get('printer-location', False),
|
||||
'uri': cups_printer.get('device-uri', False),
|
||||
'status': mapping.get(cups_printer.get(
|
||||
'printer-state'), 'unknown'),
|
||||
'status_message': cups_printer.get('printer-state-message', ''),
|
||||
}
|
||||
return vals
|
||||
|
||||
@api.multi
|
||||
def print_document(self, report, content, **print_opts):
|
||||
""" Print a file
|
||||
|
||||
Format could be pdf, qweb-pdf, raw, ...
|
||||
|
||||
"""
|
||||
self.ensure_one()
|
||||
fd, file_name = mkstemp()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2016 SYLEAM (<http://www.syleam.fr>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
@@ -206,6 +205,11 @@ class PrintingServer(models.Model):
|
||||
('server_id', '=', server.id),
|
||||
('system_name', '=', printer_system_name),
|
||||
], limit=1)
|
||||
# CUPS retains jobs for disconnected printers and also may
|
||||
# leak jobs data for unshared printers, therefore we just
|
||||
# discard here if not printer found
|
||||
if not printer:
|
||||
continue
|
||||
job_values['printer_id'] = printer.id
|
||||
|
||||
if jobs:
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2013-2014 Camptocamp (<http://www.camptocamp.com>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
@@ -49,4 +48,3 @@ class ResUsers(models.Model):
|
||||
def onchange_printing_printer_id(self):
|
||||
""" Reset the tray when the printer is changed """
|
||||
self.printer_tray_id = False
|
||||
|
||||
|
||||
4
base_report_to_printer/readme/CONFIGURE.rst
Normal file
4
base_report_to_printer/readme/CONFIGURE.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
To configure this module, you need to:
|
||||
|
||||
#. Enable the "Printing / Print User" option under access
|
||||
rights to give users the ability to view the print menu.
|
||||
11
base_report_to_printer/readme/CONTRIBUTORS.rst
Normal file
11
base_report_to_printer/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,11 @@
|
||||
* Ferran Pegueroles <ferran@pegueroles.com>
|
||||
* Albert Cervera i Areny <albert@nan-tic.com>
|
||||
* Davide Corio <davide.corio@agilebg.com>
|
||||
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
|
||||
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
|
||||
* Lionel Sausin <ls@numerigraphe.com>
|
||||
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
|
||||
* Dave Lasley <dave@laslabs.com>
|
||||
* Sylvain Garancher <sylvain.garancher@syleam.fr>
|
||||
* Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||
* Graeme Gellatly <graeme@o4sb.com>
|
||||
24
base_report_to_printer/readme/DESCRIPTION.rst
Normal file
24
base_report_to_printer/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,24 @@
|
||||
This module allows users to send reports to a printer attached to the server.
|
||||
|
||||
It adds an optional behaviour on reports to send it directly to a printer.
|
||||
|
||||
* `Send to Client` is the default behaviour providing you a downloadable PDF
|
||||
* `Send to Printer` prints the report on selected printer
|
||||
|
||||
It detects trays on printers installation plus permits to select the
|
||||
paper source on which you want to print directly.
|
||||
|
||||
Report behaviour is defined by settings.
|
||||
|
||||
You will find this option on default user config, on default report
|
||||
config and on specific config per user per report.
|
||||
|
||||
This allows you to dedicate a specific paper source for example for
|
||||
preprinted paper such as payment slip.
|
||||
|
||||
Settings can be configured:
|
||||
|
||||
* globally
|
||||
* per user
|
||||
* per report
|
||||
* per user and report
|
||||
4
base_report_to_printer/readme/HISTORY.rst
Normal file
4
base_report_to_printer/readme/HISTORY.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
12.0.1.0.0 (2018-02-04)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* [RELEASE] Port from V11.
|
||||
10
base_report_to_printer/readme/INSTALL.rst
Normal file
10
base_report_to_printer/readme/INSTALL.rst
Normal file
@@ -0,0 +1,10 @@
|
||||
To install this module, you need to:
|
||||
|
||||
#. Install PyCups - https://pypi.python.org/pypi/pycups
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get install cups
|
||||
sudo apt-get install libcups2-dev
|
||||
sudo apt-get install python3-dev
|
||||
sudo pip install pycups
|
||||
13
base_report_to_printer/readme/USAGE.rst
Normal file
13
base_report_to_printer/readme/USAGE.rst
Normal file
@@ -0,0 +1,13 @@
|
||||
Guidelines for use:
|
||||
|
||||
* To update the CUPS printers in *Settings > Printing > Update Printers
|
||||
from CUPS*
|
||||
* To print a report on a specific printer or tray, you can change
|
||||
these in *Settings > Printing > Reports* to define default behaviour.
|
||||
* To print a report on a specific printer and/or tray for a user, you can
|
||||
change these in *Settings > Printing > Reports* in
|
||||
*Specific actions per user*
|
||||
* Users may also select a default action, printer or tray in their preferences.
|
||||
|
||||
When no tray is configured for a report and a user, the
|
||||
default tray setup on the CUPS server is used.
|
||||
@@ -85,6 +85,15 @@
|
||||
<field eval="0" name="perm_write"/>
|
||||
<field eval="0" name="perm_create"/>
|
||||
</record>
|
||||
<record id="printing_job_group_manager" model="ir.model.access">
|
||||
<field name="name">Printing Job User</field>
|
||||
<field name="model_id" ref="model_printing_job"/>
|
||||
<field name="group_id" ref="printing_group_manager"/>
|
||||
<field eval="1" name="perm_read"/>
|
||||
<field eval="1" name="perm_unlink"/>
|
||||
<field eval="1" name="perm_write"/>
|
||||
<field eval="1" name="perm_create"/>
|
||||
</record>
|
||||
<record id="printing_action_group_user" model="ir.model.access">
|
||||
<field name="name">Printing Action User</field>
|
||||
<field name="model_id" ref="model_printing_action"/>
|
||||
|
||||
508
base_report_to_printer/static/description/index.html
Normal file
508
base_report_to_printer/static/description/index.html
Normal file
@@ -0,0 +1,508 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
|
||||
<title>Report to printer</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
.subscript {
|
||||
vertical-align: sub;
|
||||
font-size: smaller }
|
||||
|
||||
.superscript {
|
||||
vertical-align: super;
|
||||
font-size: smaller }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title, .code .error {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||
clear: left ;
|
||||
float: left ;
|
||||
margin-right: 1em }
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||
clear: right ;
|
||||
float: right ;
|
||||
margin-left: 1em }
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left }
|
||||
|
||||
.align-center {
|
||||
clear: both ;
|
||||
text-align: center }
|
||||
|
||||
.align-right {
|
||||
text-align: right }
|
||||
|
||||
/* reset inner alignment in figures */
|
||||
div.align-right {
|
||||
text-align: inherit }
|
||||
|
||||
/* div.align-center * { */
|
||||
/* text-align: left } */
|
||||
|
||||
.align-top {
|
||||
vertical-align: top }
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle }
|
||||
|
||||
.align-bottom {
|
||||
vertical-align: bottom }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font: inherit }
|
||||
|
||||
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
/* "booktabs" style (no vertical lines) */
|
||||
table.docutils.booktabs {
|
||||
border: 0px;
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.docutils.booktabs * {
|
||||
border: 0px;
|
||||
}
|
||||
table.docutils.booktabs th {
|
||||
border-bottom: thin solid;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="report-to-printer">
|
||||
<h1 class="title">Report to printer</h1>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/report-print-send/tree/12.0/base_report_to_printer"><img alt="OCA/report-print-send" src="https://img.shields.io/badge/github-OCA%2Freport--print--send-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/report-print-send-12-0/report-print-send-12-0-base_report_to_printer"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/144/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module allows users to send reports to a printer attached to the server.</p>
|
||||
<p>It adds an optional behaviour on reports to send it directly to a printer.</p>
|
||||
<ul class="simple">
|
||||
<li><cite>Send to Client</cite> is the default behaviour providing you a downloadable PDF</li>
|
||||
<li><cite>Send to Printer</cite> prints the report on selected printer</li>
|
||||
</ul>
|
||||
<p>It detects trays on printers installation plus permits to select the
|
||||
paper source on which you want to print directly.</p>
|
||||
<p>Report behaviour is defined by settings.</p>
|
||||
<p>You will find this option on default user config, on default report
|
||||
config and on specific config per user per report.</p>
|
||||
<p>This allows you to dedicate a specific paper source for example for
|
||||
preprinted paper such as payment slip.</p>
|
||||
<p>Settings can be configured:</p>
|
||||
<ul class="simple">
|
||||
<li>globally</li>
|
||||
<li>per user</li>
|
||||
<li>per report</li>
|
||||
<li>per user and report</li>
|
||||
</ul>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#installation" id="id2">Installation</a></li>
|
||||
<li><a class="reference internal" href="#configuration" id="id3">Configuration</a></li>
|
||||
<li><a class="reference internal" href="#usage" id="id4">Usage</a></li>
|
||||
<li><a class="reference internal" href="#changelog" id="id5">Changelog</a><ul>
|
||||
<li><a class="reference internal" href="#id1" id="id6">12.0.1.0.0 (2018-02-04)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id7">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id8">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id9">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id10">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id11">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="installation">
|
||||
<h1><a class="toc-backref" href="#id2">Installation</a></h1>
|
||||
<p>To install this module, you need to:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Install PyCups - <a class="reference external" href="https://pypi.python.org/pypi/pycups">https://pypi.python.org/pypi/pycups</a></li>
|
||||
</ol>
|
||||
<pre class="code bash literal-block">
|
||||
sudo apt-get install cups
|
||||
sudo apt-get install libcups2-dev
|
||||
sudo apt-get install python3-dev
|
||||
sudo pip install pycups
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="configuration">
|
||||
<h1><a class="toc-backref" href="#id3">Configuration</a></h1>
|
||||
<p>To configure this module, you need to:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Enable the “Printing / Print User” option under access
|
||||
rights to give users the ability to view the print menu.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#id4">Usage</a></h1>
|
||||
<p>Guidelines for use:</p>
|
||||
<blockquote>
|
||||
<ul class="simple">
|
||||
<li>To update the CUPS printers in <em>Settings > Printing > Update Printers
|
||||
from CUPS</em></li>
|
||||
<li>To print a report on a specific printer or tray, you can change
|
||||
these in <em>Settings > Printing > Reports</em> to define default behaviour.</li>
|
||||
<li>To print a report on a specific printer and/or tray for a user, you can
|
||||
change these in <em>Settings > Printing > Reports</em> in
|
||||
<em>Specific actions per user</em></li>
|
||||
<li>Users may also select a default action, printer or tray in their preferences.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<p>When no tray is configured for a report and a user, the
|
||||
default tray setup on the CUPS server is used.</p>
|
||||
</div>
|
||||
<div class="section" id="changelog">
|
||||
<h1><a class="toc-backref" href="#id5">Changelog</a></h1>
|
||||
<div class="section" id="id1">
|
||||
<h2><a class="toc-backref" href="#id6">12.0.1.0.0 (2018-02-04)</a></h2>
|
||||
<ul class="simple">
|
||||
<li>[RELEASE] Port from V11.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#id7">Bug Tracker</a></h1>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/report-print-send/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/report-print-send/issues/new?body=module:%20base_report_to_printer%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h1><a class="toc-backref" href="#id8">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id9">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Agile Business Group & Domsense</li>
|
||||
<li>Pegueroles SCP</li>
|
||||
<li>NaN</li>
|
||||
<li>LasLabs</li>
|
||||
<li>Camptocamp</li>
|
||||
<li>Open for Small Business Ltd</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id10">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Ferran Pegueroles <<a class="reference external" href="mailto:ferran@pegueroles.com">ferran@pegueroles.com</a>></li>
|
||||
<li>Albert Cervera i Areny <<a class="reference external" href="mailto:albert@nan-tic.com">albert@nan-tic.com</a>></li>
|
||||
<li>Davide Corio <<a class="reference external" href="mailto:davide.corio@agilebg.com">davide.corio@agilebg.com</a>></li>
|
||||
<li>Lorenzo Battistini <<a class="reference external" href="mailto:lorenzo.battistini@agilebg.com">lorenzo.battistini@agilebg.com</a>></li>
|
||||
<li>Yannick Vaucher <<a class="reference external" href="mailto:yannick.vaucher@camptocamp.com">yannick.vaucher@camptocamp.com</a>></li>
|
||||
<li>Lionel Sausin <<a class="reference external" href="mailto:ls@numerigraphe.com">ls@numerigraphe.com</a>></li>
|
||||
<li>Guewen Baconnier <<a class="reference external" href="mailto:guewen.baconnier@camptocamp.com">guewen.baconnier@camptocamp.com</a>></li>
|
||||
<li>Dave Lasley <<a class="reference external" href="mailto:dave@laslabs.com">dave@laslabs.com</a>></li>
|
||||
<li>Sylvain Garancher <<a class="reference external" href="mailto:sylvain.garancher@syleam.fr">sylvain.garancher@syleam.fr</a>></li>
|
||||
<li>Jairo Llopis <<a class="reference external" href="mailto:jairo.llopis@tecnativa.com">jairo.llopis@tecnativa.com</a>></li>
|
||||
<li>Graeme Gellatly <<a class="reference external" href="mailto:graeme@o4sb.com">graeme@o4sb.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#id11">Maintainers</a></h2>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/report-print-send/tree/12.0/base_report_to_printer">OCA/report-print-send</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,46 +3,48 @@ odoo.define('base_report_to_printer.print', function(require) {
|
||||
|
||||
var ActionManager = require('web.ActionManager');
|
||||
var core = require('web.core');
|
||||
var framework = require('web.framework');
|
||||
var rpc = require('web.rpc');
|
||||
var _t = core._t;
|
||||
|
||||
ActionManager.include({
|
||||
ir_actions_report: function(action, options) {
|
||||
action_val = _.clone(action);
|
||||
var _t = core._t;
|
||||
_triggerDownload: function (action, options, type) {
|
||||
var self = this;
|
||||
var _super = this._super;
|
||||
|
||||
if (action_val.report_type === 'qweb-pdf') {
|
||||
framework.blockUI();
|
||||
rpc.query({
|
||||
if (type === 'pdf') {
|
||||
this._rpc({
|
||||
model: 'ir.actions.report',
|
||||
method: 'print_action_for_report_name',
|
||||
args: [action_val.report_name]
|
||||
args: [action.report_name],
|
||||
}).then(function (print_action) {
|
||||
if (print_action && print_action.action === 'server') {
|
||||
framework.unblockUI();
|
||||
rpc.query({
|
||||
self._rpc({
|
||||
model: 'ir.actions.report',
|
||||
method: 'print_document',
|
||||
args: [action_val.id, action_val.context.active_ids],
|
||||
kwargs: {data: action_val.data || {}},
|
||||
context: action_val.context || {}
|
||||
args: [action.id, action.context.active_ids],
|
||||
kwargs: {data: action.data || {}},
|
||||
context: action.context || {},
|
||||
}).then(function () {
|
||||
self.do_notify(_t('Report'),
|
||||
_.str.sprintf(_t('Document sent to the printer %s'), print_action.printer_name));
|
||||
_.str.sprintf(
|
||||
_t('Document sent to the printer %s'),
|
||||
print_action.printer_name
|
||||
)
|
||||
);
|
||||
}).fail(function () {
|
||||
self.do_notify(_t('Report'),
|
||||
_.str.sprintf(_t('Error when sending the document to the printer '), print_action.printer_name));
|
||||
_.str.sprintf(
|
||||
_t('Error when sending the document to the printer '),
|
||||
print_action.printer_name
|
||||
)
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return _super.apply(self, [action, options, type]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return _super.apply(self, [action, options, type]);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
} else {
|
||||
return _super.apply(self, [action_val, options]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return _super.apply(self, [action_val, options]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ class TestPrintingPrinter(TransactionCase):
|
||||
'location': 'Location',
|
||||
'uri': 'URI',
|
||||
}
|
||||
self.report = self.env['ir.actions.report'].search([], limit=1)
|
||||
|
||||
def new_record(self):
|
||||
return self.Model.create(self.printer_vals)
|
||||
@@ -66,7 +67,6 @@ class TestPrintingPrinter(TransactionCase):
|
||||
|
||||
def test_print_options(self):
|
||||
""" It should generate the right options dictionnary """
|
||||
'copies': '2',
|
||||
# TODO: None here used as report - tests here should be merged
|
||||
# with tests in test_printing_printer_tray from when modules merged
|
||||
report = self.env['ir.actions.report'].search([], limit=1)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
@@ -165,7 +164,6 @@ class TestPrintingPrinter(TransactionCase):
|
||||
self, os_unlink, cups):
|
||||
"""
|
||||
When a ENOENT error is encountered, the file has already been unlinked
|
||||
|
||||
This is not an issue, as we were trying to delete the file.
|
||||
The update can continue.
|
||||
"""
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
@@ -26,6 +25,7 @@ class TestPrintingPrinterWizard(TransactionCase):
|
||||
'printer-make-and-model': 'Make and Model',
|
||||
'printer-location': "location",
|
||||
'device-uri': 'URI',
|
||||
'printer-uri-supported': 'uri'
|
||||
}
|
||||
|
||||
def _record_vals(self, sys_name='sys_name'):
|
||||
@@ -52,6 +52,7 @@ class TestPrintingPrinterWizard(TransactionCase):
|
||||
cups.Connection().getPrinters.return_value = {
|
||||
'sys_name': self.printer_vals,
|
||||
}
|
||||
cups.Connection().getPPD3.return_value = (200, 0, '')
|
||||
self.Model.action_ok()
|
||||
cups.Connection().getPrinters.assert_called_once_with()
|
||||
|
||||
@@ -68,6 +69,7 @@ class TestPrintingPrinterWizard(TransactionCase):
|
||||
cups.Connection().getPrinters.return_value = {
|
||||
'sys_name': self.printer_vals,
|
||||
}
|
||||
cups.Connection().getPPD3.return_value = (200, 0, '')
|
||||
self.Model.action_ok()
|
||||
rec_id = self.env['printing.printer'].search([
|
||||
('system_name', '=', 'sys_name')
|
||||
@@ -89,6 +91,7 @@ class TestPrintingPrinterWizard(TransactionCase):
|
||||
cups.Connection().getPrinters.return_value = {
|
||||
'sys_name': self.printer_vals,
|
||||
}
|
||||
cups.Connection().getPPD3.return_value = (200, 0, '')
|
||||
self.env['printing.printer'].create(
|
||||
self._record_vals()
|
||||
)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 SYLEAM
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
@@ -47,12 +46,14 @@ class TestPrintingReportXmlAction(TransactionCase):
|
||||
self.assertEqual(xml_action.behaviour(), {
|
||||
'action': xml_action.action,
|
||||
'printer': xml_action.printer_id,
|
||||
'tray': False,
|
||||
})
|
||||
|
||||
xml_action = self.new_record({'printer_id': self.new_printer().id})
|
||||
self.assertEqual(xml_action.behaviour(), {
|
||||
'action': xml_action.action,
|
||||
'printer': xml_action.printer_id,
|
||||
'tray': False,
|
||||
})
|
||||
|
||||
self.assertEqual(self.Model.behaviour(), {})
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 LasLabs Inc.
|
||||
# Copyright 2017 Tecnativa - Jairo Llopis
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="act_report_xml_view">
|
||||
<field name="name">ir.actions.report.printing</field>
|
||||
<field name="name">ir.actions.report.form (in base_report_to_printer)</field>
|
||||
<field name="model">ir.actions.report</field>
|
||||
<field name="inherit_id" ref="base.act_report_xml_view"/>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="printing_job_view_form">
|
||||
<field name="name">printing.job.form</field>
|
||||
<field name="name">printing.job.form (in base_report_to_printer)</field>
|
||||
<field name="model">printing.job</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Job">
|
||||
@@ -30,7 +30,7 @@
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="printing_job_view_tree">
|
||||
<field name="name">printing.job.tree</field>
|
||||
<field name="name">printing.job.tree (in base_report_to_printer)</field>
|
||||
<field name="model">printing.job</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Job">
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/>
|
||||
|
||||
<record model="ir.ui.view" id="printing_printer_view_form">
|
||||
<field name="name">printing.printer.form</field>
|
||||
<field name="name">printing.printer.form (in base_report_to_printer)</field>
|
||||
<field name="model">printing.printer</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Printers">
|
||||
@@ -58,7 +58,7 @@
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="printing_printer_view_tree">
|
||||
<field name="name">printing.printer.tree</field>
|
||||
<field name="name">printing.printer.tree (in base_report_to_printer)</field>
|
||||
<field name="model">printing.printer</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Printers" colors="green:status=='available'; orange:status=='printing'; red:1;">
|
||||
@@ -71,7 +71,7 @@
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="printing_printer_view_search">
|
||||
<field name="name">printing.printer.search</field>
|
||||
<field name="name">printing.printer.search (in base_report_to_printer)</field>
|
||||
<field name="model">printing.printer</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Printers">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="printing_report_xml_action_view_form">
|
||||
<field name="name">printing.report.xml.action.form</field>
|
||||
<field name="name">printing.report.xml.action.form (in base_report_to_printer)</field>
|
||||
<field name="model">printing.report.xml.action</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Report Printing Actions">
|
||||
@@ -17,7 +17,7 @@
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="printing_report_xml_action_view_tree">
|
||||
<field name="name">printing.report.xml.action.tree</field>
|
||||
<field name="name">printing.report.xml.action.tree (in base_report_to_printer)</field>
|
||||
<field name="model">printing.report.xml.action</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Report Printing Actions">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="printing_server_view_form">
|
||||
<field name="name">printing.server.form</field>
|
||||
<field name="name">printing.server.form (in base_report_to_printer)</field>
|
||||
<field name="model">printing.server</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Servers">
|
||||
@@ -30,7 +30,7 @@
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="printing_server_view_tree">
|
||||
<field name="name">printing.server.tree</field>
|
||||
<field name="name">printing.server.tree (in base_report_to_printer)</field>
|
||||
<field name="model">printing.server</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Servers">
|
||||
@@ -42,7 +42,7 @@
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="printing_server_view_search">
|
||||
<field name="name">printing.server.search</field>
|
||||
<field name="name">printing.server.search (in base_report_to_printer)</field>
|
||||
<field name="model">printing.server</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Servers">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="view_users_form">
|
||||
<field name="name">res.users.form.printing.preferences</field>
|
||||
<field name="name">res.users.form (in base_report_to_printer)</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form"/>
|
||||
<field name="arch" type="xml">
|
||||
@@ -16,7 +16,7 @@
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_users_form_simple_modif">
|
||||
<field name="name">res.users.form.printing</field>
|
||||
<field name="name">res.users.form.simple (in base_report_to_printer)</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import printing_printer_update_wizard
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="model">printing.printer.update.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Update Printers from CUPS">
|
||||
<label string="This process will create all missing printers from the current CUPS server." colspan="2"/>
|
||||
<label string="This process will create all missing printers from the current CUPS server." colspan="2" for=""/>
|
||||
<footer>
|
||||
<button name="action_ok" string="Ok" type="object" class="oe_highlight"/>
|
||||
or
|
||||
|
||||
Reference in New Issue
Block a user