[MIG] base_report_to_printer: Migration to 13.0

This commit is contained in:
Rod Schouteden
2019-09-30 12:13:42 +02:00
committed by Carlos Roca
parent 32352977ed
commit b1103c7b6d
20 changed files with 69 additions and 76 deletions

View File

@@ -14,13 +14,13 @@ Report to printer
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freport--print--send-lightgray.png?logo=github .. |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 :target: https://github.com/OCA/report-print-send/tree/13.0/base_report_to_printer
:alt: OCA/report-print-send :alt: OCA/report-print-send
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |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 :target: https://translation.odoo-community.org/projects/report-print-send-13-0/report-print-send-13-0-base_report_to_printer
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/144/12.0 :target: https://runbot.odoo-community.org/runbot/144/13.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -97,6 +97,11 @@ default tray setup on the CUPS server is used.
Changelog Changelog
========= =========
13.0.1.0.0 (2019-09-30)
~~~~~~~~~~~~~~~~~~~~~~~
* [RELEASE] Port from V12.
12.0.1.0.0 (2018-02-04) 12.0.1.0.0 (2018-02-04)
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
@@ -108,7 +113,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/report-print-send/issues>`_. 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. 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 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**>`_. `feedback <https://github.com/OCA/report-print-send/issues/new?body=module:%20base_report_to_printer%0Aversion:%2013.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. Do not contact contributors directly about support or help with technical issues.
@@ -139,6 +144,7 @@ Contributors
* Sylvain Garancher <sylvain.garancher@syleam.fr> * Sylvain Garancher <sylvain.garancher@syleam.fr>
* Jairo Llopis <jairo.llopis@tecnativa.com> * Jairo Llopis <jairo.llopis@tecnativa.com>
* Graeme Gellatly <graeme@o4sb.com> * Graeme Gellatly <graeme@o4sb.com>
* Rod Schouteden <rod@schout-it.be>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@@ -153,6 +159,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
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. This module is part of the `OCA/report-print-send <https://github.com/OCA/report-print-send/tree/13.0/base_report_to_printer>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -7,7 +7,7 @@
{ {
'name': "Report to printer", 'name': "Report to printer",
'version': '12.0.1.0.0', 'version': '13.0.1.0.0',
'category': 'Generic Modules/Base', 'category': 'Generic Modules/Base',
'author': "Agile Business Group & Domsense, Pegueroles SCP, NaN," 'author': "Agile Business Group & Domsense, Pegueroles SCP, NaN,"
" LasLabs, Camptocamp, Odoo Community Association (OCA)," " LasLabs, Camptocamp, Odoo Community Association (OCA),"
@@ -30,6 +30,6 @@
'installable': True, 'installable': True,
'application': False, 'application': False,
'external_dependencies': { 'external_dependencies': {
'python': ['cups'], 'python': ['pycups'],
}, },
} }

View File

@@ -54,7 +54,6 @@ class IrActionsReport(models.Model):
} }
return serializable_result return serializable_result
@api.multi
def _get_user_default_print_behaviour(self): def _get_user_default_print_behaviour(self):
printer_obj = self.env['printing.printer'] printer_obj = self.env['printing.printer']
user = self.env.user user = self.env.user
@@ -65,7 +64,6 @@ class IrActionsReport(models.Model):
user.printer_tray_id else False user.printer_tray_id else False
) )
@api.multi
def _get_report_default_print_behaviour(self): def _get_report_default_print_behaviour(self):
result = {} result = {}
report_action = self.property_printing_action_id report_action = self.property_printing_action_id
@@ -77,7 +75,6 @@ class IrActionsReport(models.Model):
result['tray'] = self.printer_tray_id.system_name result['tray'] = self.printer_tray_id.system_name
return result return result
@api.multi
def behaviour(self): def behaviour(self):
self.ensure_one() self.ensure_one()
printing_act_obj = self.env['printing.report.xml.action'] printing_act_obj = self.env['printing.report.xml.action']
@@ -98,7 +95,6 @@ class IrActionsReport(models.Model):
print_action.behaviour().items() if v}) print_action.behaviour().items() if v})
return result return result
@api.multi
def print_document(self, record_ids, data=None): def print_document(self, record_ids, data=None):
""" Print a document, do not return the document file """ """ Print a document, do not return the document file """
document, doc_format = self.with_context( document, doc_format = self.with_context(
@@ -116,7 +112,6 @@ class IrActionsReport(models.Model):
doc_format=self.report_type, doc_format=self.report_type,
**behaviour) **behaviour)
@api.multi
def _can_print_report(self, behaviour, printer, document): def _can_print_report(self, behaviour, printer, document):
"""Predicate that decide if report can be sent to printer """Predicate that decide if report can be sent to printer
@@ -129,7 +124,6 @@ class IrActionsReport(models.Model):
return True return True
return False return False
@api.noguess
def report_action(self, docids, data=None, config=True): def report_action(self, docids, data=None, config=True):
res = super().report_action(docids, data=data, config=config) res = super().report_action(docids, data=data, config=config)
if not res.get('id'): if not res.get('id'):

View File

@@ -25,5 +25,4 @@ class PrintingAction(models.Model):
selection=_available_action_types, selection=_available_action_types,
string='Type', string='Type',
required=True, required=True,
oldname='type'
) )

View File

@@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging import logging
from odoo import models, fields, api from odoo import models, fields
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -85,12 +85,10 @@ class PrintingJob(models.Model):
'The id of the job must be unique per server !'), 'The id of the job must be unique per server !'),
] ]
@api.multi
def action_cancel(self): def action_cancel(self):
self.ensure_one() self.ensure_one()
return self.cancel() return self.cancel()
@api.multi
def cancel(self, purge_job=False): def cancel(self, purge_job=False):
for job in self: for job in self:
connection = job.server_id._open_connection() connection = job.server_id._open_connection()

View File

@@ -11,7 +11,7 @@ import logging
import os import os
from tempfile import mkstemp from tempfile import mkstemp
from odoo import models, fields, api from odoo import models, fields
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -60,7 +60,6 @@ class PrintingPrinter(models.Model):
inverse_name='printer_id', inverse_name='printer_id',
string='Paper Sources') string='Paper Sources')
@api.multi
def _prepare_update_from_cups(self, cups_connection, cups_printer): def _prepare_update_from_cups(self, cups_connection, cups_printer):
mapping = { mapping = {
3: 'available', 3: 'available',
@@ -116,7 +115,6 @@ class PrintingPrinter(models.Model):
]) ])
return vals return vals
@api.multi
def print_document(self, report, content, **print_opts): def print_document(self, report, content, **print_opts):
""" Print a file """ Print a file
Format could be pdf, qweb-pdf, raw, ... Format could be pdf, qweb-pdf, raw, ...
@@ -138,7 +136,6 @@ class PrintingPrinter(models.Model):
# Backwards compatibility of builtin used as kwarg # Backwards compatibility of builtin used as kwarg
_set_option_format = _set_option_doc_format _set_option_format = _set_option_doc_format
@api.multi
def _set_option_tray(self, report, value): def _set_option_tray(self, report, value):
"""Note we use self here as some older PPD use tray """Note we use self here as some older PPD use tray
rather than InputSlot so we may need to query printer in override""" rather than InputSlot so we may need to query printer in override"""
@@ -151,7 +148,6 @@ class PrintingPrinter(models.Model):
_set_option_action = _set_option_noop _set_option_action = _set_option_noop
_set_option_printer = _set_option_noop _set_option_printer = _set_option_noop
@api.multi
def print_options(self, report=None, **print_opts): def print_options(self, report=None, **print_opts):
options = {} options = {}
for option, value in print_opts.items(): for option, value in print_opts.items():
@@ -162,7 +158,6 @@ class PrintingPrinter(models.Model):
options[option] = str(value) options[option] = str(value)
return options return options
@api.multi
def print_file(self, file_name, report=None, **print_opts): def print_file(self, file_name, report=None, **print_opts):
""" Print a file """ """ Print a file """
self.ensure_one() self.ensure_one()
@@ -182,7 +177,6 @@ class PrintingPrinter(models.Model):
)) ))
return True return True
@api.multi
def set_default(self): def set_default(self):
if not self: if not self:
return return
@@ -192,21 +186,17 @@ class PrintingPrinter(models.Model):
self.write({'default': True}) self.write({'default': True})
return True return True
@api.multi
def unset_default(self): def unset_default(self):
self.write({'default': False}) self.write({'default': False})
return True return True
@api.multi
def get_default(self): def get_default(self):
return self.search([('default', '=', True)], limit=1) return self.search([('default', '=', True)], limit=1)
@api.multi
def action_cancel_all_jobs(self): def action_cancel_all_jobs(self):
self.ensure_one() self.ensure_one()
return self.cancel_all_jobs() return self.cancel_all_jobs()
@api.multi
def cancel_all_jobs(self, purge_jobs=False): def cancel_all_jobs(self, purge_jobs=False):
for printer in self: for printer in self:
connection = printer.server_id._open_connection() connection = printer.server_id._open_connection()
@@ -218,7 +208,6 @@ class PrintingPrinter(models.Model):
return True return True
@api.multi
def enable(self): def enable(self):
for printer in self: for printer in self:
connection = printer.server_id._open_connection() connection = printer.server_id._open_connection()
@@ -229,7 +218,6 @@ class PrintingPrinter(models.Model):
return True return True
@api.multi
def disable(self): def disable(self):
for printer in self: for printer in self:
connection = printer.server_id._open_connection() connection = printer.server_id._open_connection()

View File

@@ -38,7 +38,6 @@ class PrintingReportXmlAction(models.Model):
""" Reset the tray when the printer is changed """ """ Reset the tray when the printer is changed """
self.printer_tray_id = False self.printer_tray_id = False
@api.multi
def behaviour(self): def behaviour(self):
if not self: if not self:
return {} return {}

View File

@@ -3,7 +3,7 @@
import logging import logging
from datetime import datetime from datetime import datetime
from odoo import models, fields, api, exceptions, _ from odoo import models, fields, exceptions, _
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -32,13 +32,12 @@ class PrintingServer(models.Model):
string='Printers List', string='Printers List',
help='List of printers available on this server.') help='List of printers available on this server.')
@api.multi
def _open_connection(self, raise_on_error=False): def _open_connection(self, raise_on_error=False):
self.ensure_one() self.ensure_one()
connection = False connection = False
try: try:
connection = cups.Connection(host=self.address, port=self.port) connection = cups.Connection(host=self.address, port=self.port)
except: except Exception:
message = _("Failed to connect to the CUPS server on %s:%s. " message = _("Failed to connect to the CUPS server on %s:%s. "
"Check that the CUPS server is running and that " "Check that the CUPS server is running and that "
"you can reach it from the Odoo server.") % ( "you can reach it from the Odoo server.") % (
@@ -49,11 +48,9 @@ class PrintingServer(models.Model):
return connection return connection
@api.multi
def action_update_printers(self): def action_update_printers(self):
return self.update_printers() return self.update_printers()
@api.multi
def update_printers(self, domain=None, raise_on_error=False): def update_printers(self, domain=None, raise_on_error=False):
if domain is None: if domain is None:
domain = [] domain = []
@@ -106,7 +103,6 @@ class PrintingServer(models.Model):
self = self.search([]) self = self.search([])
return self.update_jobs() return self.update_jobs()
@api.multi
def update_jobs(self, which='all', first_job_id=-1): def update_jobs(self, which='all', first_job_id=-1):
job_obj = self.env['printing.job'] job_obj = self.env['printing.job']
printer_obj = self.env['printing.printer'] printer_obj = self.env['printing.printer']

View File

@@ -9,3 +9,4 @@
* Sylvain Garancher <sylvain.garancher@syleam.fr> * Sylvain Garancher <sylvain.garancher@syleam.fr>
* Jairo Llopis <jairo.llopis@tecnativa.com> * Jairo Llopis <jairo.llopis@tecnativa.com>
* Graeme Gellatly <graeme@o4sb.com> * Graeme Gellatly <graeme@o4sb.com>
* Rod Schouteden <rod@schout-it.be>

View File

@@ -1,3 +1,8 @@
13.0.1.0.0 (2019-09-30)
~~~~~~~~~~~~~~~~~~~~~~~
* [RELEASE] Port from V12.
12.0.1.0.0 (2018-02-04) 12.0.1.0.0 (2018-02-04)
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~

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.15.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Report to printer</title> <title>Report to printer</title>
<style type="text/css"> <style type="text/css">
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! 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><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/13.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-13-0/report-print-send-13-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/13.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>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> <p>It adds an optional behaviour on reports to send it directly to a printer.</p>
<ul class="simple"> <ul class="simple">
@@ -391,24 +391,25 @@ preprinted paper such as payment slip.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
<li><a class="reference internal" href="#installation" id="id2">Installation</a></li> <li><a class="reference internal" href="#installation" id="id3">Installation</a></li>
<li><a class="reference internal" href="#configuration" id="id3">Configuration</a></li> <li><a class="reference internal" href="#configuration" id="id4">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="id4">Usage</a></li> <li><a class="reference internal" href="#usage" id="id5">Usage</a></li>
<li><a class="reference internal" href="#changelog" id="id5">Changelog</a><ul> <li><a class="reference internal" href="#changelog" id="id6">Changelog</a><ul>
<li><a class="reference internal" href="#id1" id="id6">12.0.1.0.0 (2018-02-04)</a></li> <li><a class="reference internal" href="#id1" id="id7">13.0.1.0.0 (2019-09-30)</a></li>
<li><a class="reference internal" href="#id2" id="id8">12.0.1.0.0 (2018-02-04)</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#bug-tracker" id="id7">Bug Tracker</a></li> <li><a class="reference internal" href="#bug-tracker" id="id9">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id8">Credits</a><ul> <li><a class="reference internal" href="#credits" id="id10">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id9">Authors</a></li> <li><a class="reference internal" href="#authors" id="id11">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id10">Contributors</a></li> <li><a class="reference internal" href="#contributors" id="id12">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id11">Maintainers</a></li> <li><a class="reference internal" href="#maintainers" id="id13">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<div class="section" id="installation"> <div class="section" id="installation">
<h1><a class="toc-backref" href="#id2">Installation</a></h1> <h1><a class="toc-backref" href="#id3">Installation</a></h1>
<p>To install this module, you need to:</p> <p>To install this module, you need to:</p>
<ol class="arabic simple"> <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> <li>Install PyCups - <a class="reference external" href="https://pypi.python.org/pypi/pycups">https://pypi.python.org/pypi/pycups</a></li>
@@ -421,7 +422,7 @@ sudo pip install pycups
</pre> </pre>
</div> </div>
<div class="section" id="configuration"> <div class="section" id="configuration">
<h1><a class="toc-backref" href="#id3">Configuration</a></h1> <h1><a class="toc-backref" href="#id4">Configuration</a></h1>
<p>To configure this module, you need to:</p> <p>To configure this module, you need to:</p>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Enable the “Printing / Print User” option under access <li>Enable the “Printing / Print User” option under access
@@ -429,7 +430,7 @@ rights to give users the ability to view the print menu.</li>
</ol> </ol>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#id4">Usage</a></h1> <h1><a class="toc-backref" href="#id5">Usage</a></h1>
<p>Guidelines for use:</p> <p>Guidelines for use:</p>
<blockquote> <blockquote>
<ul class="simple"> <ul class="simple">
@@ -447,26 +448,32 @@ change these in <em>Settings &gt; Printing &gt; Reports</em> in
default tray setup on the CUPS server is used.</p> default tray setup on the CUPS server is used.</p>
</div> </div>
<div class="section" id="changelog"> <div class="section" id="changelog">
<h1><a class="toc-backref" href="#id5">Changelog</a></h1> <h1><a class="toc-backref" href="#id6">Changelog</a></h1>
<div class="section" id="id1"> <div class="section" id="id1">
<h2><a class="toc-backref" href="#id6">12.0.1.0.0 (2018-02-04)</a></h2> <h2><a class="toc-backref" href="#id7">13.0.1.0.0 (2019-09-30)</a></h2>
<ul class="simple">
<li>[RELEASE] Port from V12.</li>
</ul>
</div>
<div class="section" id="id2">
<h2><a class="toc-backref" href="#id8">12.0.1.0.0 (2018-02-04)</a></h2>
<ul class="simple"> <ul class="simple">
<li>[RELEASE] Port from V11.</li> <li>[RELEASE] Port from V11.</li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id7">Bug Tracker</a></h1> <h1><a class="toc-backref" href="#id9">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>. <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. 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 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> <a class="reference external" href="https://github.com/OCA/report-print-send/issues/new?body=module:%20base_report_to_printer%0Aversion:%2013.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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
<h1><a class="toc-backref" href="#id8">Credits</a></h1> <h1><a class="toc-backref" href="#id10">Credits</a></h1>
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id9">Authors</a></h2> <h2><a class="toc-backref" href="#id11">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Agile Business Group &amp; Domsense</li> <li>Agile Business Group &amp; Domsense</li>
<li>Pegueroles SCP</li> <li>Pegueroles SCP</li>
@@ -477,7 +484,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id10">Contributors</a></h2> <h2><a class="toc-backref" href="#id12">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Ferran Pegueroles &lt;<a class="reference external" href="mailto:ferran&#64;pegueroles.com">ferran&#64;pegueroles.com</a>&gt;</li> <li>Ferran Pegueroles &lt;<a class="reference external" href="mailto:ferran&#64;pegueroles.com">ferran&#64;pegueroles.com</a>&gt;</li>
<li>Albert Cervera i Areny &lt;<a class="reference external" href="mailto:albert&#64;nan-tic.com">albert&#64;nan-tic.com</a>&gt;</li> <li>Albert Cervera i Areny &lt;<a class="reference external" href="mailto:albert&#64;nan-tic.com">albert&#64;nan-tic.com</a>&gt;</li>
@@ -490,16 +497,17 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Sylvain Garancher &lt;<a class="reference external" href="mailto:sylvain.garancher&#64;syleam.fr">sylvain.garancher&#64;syleam.fr</a>&gt;</li> <li>Sylvain Garancher &lt;<a class="reference external" href="mailto:sylvain.garancher&#64;syleam.fr">sylvain.garancher&#64;syleam.fr</a>&gt;</li>
<li>Jairo Llopis &lt;<a class="reference external" href="mailto:jairo.llopis&#64;tecnativa.com">jairo.llopis&#64;tecnativa.com</a>&gt;</li> <li>Jairo Llopis &lt;<a class="reference external" href="mailto:jairo.llopis&#64;tecnativa.com">jairo.llopis&#64;tecnativa.com</a>&gt;</li>
<li>Graeme Gellatly &lt;<a class="reference external" href="mailto:graeme&#64;o4sb.com">graeme&#64;o4sb.com</a>&gt;</li> <li>Graeme Gellatly &lt;<a class="reference external" href="mailto:graeme&#64;o4sb.com">graeme&#64;o4sb.com</a>&gt;</li>
<li>Rod Schouteden &lt;<a class="reference external" href="mailto:rod&#64;schout-it.be">rod&#64;schout-it.be</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id11">Maintainers</a></h2> <h2><a class="toc-backref" href="#id13">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p> <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> <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 <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> 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>This module is part of the <a class="reference external" href="https://github.com/OCA/report-print-send/tree/13.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> <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> </div>

View File

@@ -29,10 +29,11 @@ odoo.define('base_report_to_printer.print', function (require) {
print_action.printer_name print_action.printer_name
) )
); );
}).fail(function () { }, function () {
self.do_notify(_t('Report'), self.do_notify(_t('Report'),
_.str.sprintf( _.str.sprintf(
_t('Error when sending the document to the printer '), _t('Error when sending the document\
to the printer '),
print_action.printer_name print_action.printer_name
) )
); );

View File

@@ -167,7 +167,8 @@ class TestIrActionsReportXml(TransactionCase):
) )
def test_behaviour_printing_action_with_no_printer(self): def test_behaviour_printing_action_with_no_printer(self):
""" It should return the action from printing action and printer from other """ It should return the action from printing action and printer from
other
""" """
report = self.Model.search([], limit=1) report = self.Model.search([], limit=1)
self.env.user.printing_action = 'client' self.env.user.printing_action = 'client'
@@ -196,7 +197,8 @@ class TestIrActionsReportXml(TransactionCase):
) )
def test_behaviour_printing_action_user_defaults(self): def test_behaviour_printing_action_user_defaults(self):
""" It should return the action and printer from user with printing action """ It should return the action and printer from user with printing
action
""" """
report = self.Model.search([], limit=1) report = self.Model.search([], limit=1)
self.env.user.printing_action = 'client' self.env.user.printing_action = 'client'

View File

@@ -40,7 +40,8 @@ class TestPrintingReportXmlAction(TransactionCase):
}) })
def test_behaviour(self): def test_behaviour(self):
""" It should return some action's data, unless called on empty recordset """ It should return some action's data, unless called on empty
recordset
""" """
xml_action = self.new_record() xml_action = self.new_record()
self.assertEqual(xml_action.behaviour(), { self.assertEqual(xml_action.behaviour(), {

View File

@@ -33,7 +33,7 @@
<field name="name">printing.job.tree (in base_report_to_printer)</field> <field name="name">printing.job.tree (in base_report_to_printer)</field>
<field name="model">printing.job</field> <field name="model">printing.job</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Job"> <tree>
<field name="name"/> <field name="name"/>
<field name="job_id_cups"/> <field name="job_id_cups"/>
<field name="job_state"/> <field name="job_state"/>

View File

@@ -61,7 +61,7 @@
<field name="name">printing.printer.tree (in base_report_to_printer)</field> <field name="name">printing.printer.tree (in base_report_to_printer)</field>
<field name="model">printing.printer</field> <field name="model">printing.printer</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Printers" colors="green:status=='available'; orange:status=='printing'; red:1;"> <tree decoration-success="status=='available'" decoration-warning="status=='printing'" decoration-danger="status not in ['printing', 'available']">
<field name="default"/> <field name="default"/>
<field name="name"/> <field name="name"/>
<field name="system_name"/> <field name="system_name"/>
@@ -87,7 +87,6 @@
<field name="name">Show Printers</field> <field name="name">Show Printers</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">printing.printer</field> <field name="res_model">printing.printer</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>

View File

@@ -20,7 +20,7 @@
<field name="name">printing.report.xml.action.tree (in base_report_to_printer)</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="model">printing.report.xml.action</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Report Printing Actions"> <tree>
<field name="user_id"/> <field name="user_id"/>
<field name="action"/> <field name="action"/>
<field name="printer_id"/> <field name="printer_id"/>

View File

@@ -33,7 +33,7 @@
<field name="name">printing.server.tree (in base_report_to_printer)</field> <field name="name">printing.server.tree (in base_report_to_printer)</field>
<field name="model">printing.server</field> <field name="model">printing.server</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Servers"> <tree>
<field name="name"/> <field name="name"/>
<field name="address"/> <field name="address"/>
<field name="port"/> <field name="port"/>
@@ -57,7 +57,6 @@
<field name="name">Servers</field> <field name="name">Servers</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">printing.server</field> <field name="res_model">printing.server</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>

View File

@@ -6,7 +6,7 @@
import logging import logging
from odoo import models, api from odoo import models
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -16,14 +16,12 @@ class PrintingPrinterUpdateWizard(models.TransientModel):
_name = 'printing.printer.update.wizard' _name = 'printing.printer.update.wizard'
_description = 'Printing Printer Update Wizard' _description = 'Printing Printer Update Wizard'
@api.multi
def action_ok(self): def action_ok(self):
self.env['printing.server'].search([]) \ self.env['printing.server'].search([]) \
.update_printers(raise_on_error=True) .update_printers(raise_on_error=True)
return { return {
'name': 'Printers', 'name': 'Printers',
'view_type': 'form',
'view_mode': 'tree,form', 'view_mode': 'tree,form',
'res_model': 'printing.printer', 'res_model': 'printing.printer',
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',

View File

@@ -18,7 +18,6 @@
<field name="name">Update Printers from CUPS</field> <field name="name">Update Printers from CUPS</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">printing.printer.update.wizard</field> <field name="res_model">printing.printer.update.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="target">new</field> <field name="target">new</field>
</record> </record>