Skip to content

Commit

Permalink
[MIG] base_report_to_printer: Migration to v14
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis de Lattre authored and flachica committed Oct 1, 2022
1 parent 5e29d49 commit 689502d
Show file tree
Hide file tree
Showing 34 changed files with 40 additions and 65 deletions.
2 changes: 1 addition & 1 deletion base_report_to_printer/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{
"name": "Report to printer",
"version": "13.0.1.2.0",
"version": "14.0.1.0.0",
"category": "Generic Modules/Base",
"author": "Agile Business Group & Domsense, Pegueroles SCP, NaN,"
" LasLabs, Camptocamp, Odoo Community Association (OCA),"
Expand Down
4 changes: 2 additions & 2 deletions base_report_to_printer/data/printing_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
</record>
<record forcecreate="True" id="ir_cron_update_printers" model="ir.cron">
<field name="name">Update Printers Jobs</field>
<field eval="True" name="active" />
<field name="active" eval="True" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field name="doall" eval="False" />
<field name="model_id" ref="base_report_to_printer.model_printing_server" />
<field name="state">code</field>
<field name="code">model.action_update_jobs()</field>
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/am.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/base_report_to_printer.pot
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ msgstr "Aktionen"

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr "Aktiv"
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/el_GR.po
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ msgstr "Acciones"

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr "Activo"
Expand Down
6 changes: 3 additions & 3 deletions base_report_to_printer/i18n/es_AR.po
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ msgstr "Acciones"

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr "Activo"
Expand Down Expand Up @@ -276,8 +275,8 @@ msgstr "Error enviando el documento a la impresora "
#: code:addons/base_report_to_printer/models/printing_server.py:0
#, python-format
msgid ""
"Failed to connect to the CUPS server on %s:%s. Check that the CUPS server is "
"running and that you can reach it from the Odoo server."
"Failed to connect to the CUPS server on %s:%s. Check that the CUPS server is"
" running and that you can reach it from the Odoo server."
msgstr ""
"Ha fallado la conexión al servidor CUPS %s:%s. Comprueba que el servidor "
"CUPS está funcionando y que el servidor de Odoo puede comunicarse con él."
Expand Down Expand Up @@ -595,6 +594,7 @@ msgstr "Motivo del estado actual del trabajo."
#. module: base_report_to_printer
#. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.js:0
#: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.js:0
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_report_xml_action__report_id
#, python-format
msgid "Report"
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/es_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ msgstr "Actions"

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/gl.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/hr.po
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ msgstr "Akcije"

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr "Aktivno"
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/hr_HR.po
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ msgstr "Azioni"

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/nl_NL.po
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ msgstr "Acties"

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr "Actief"
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/pt_PT.po
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/sl.po
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/tr.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion base_report_to_printer/i18n/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ msgstr ""

#. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__active
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__active
msgid "Active"
msgstr ""
Expand Down
4 changes: 1 addition & 3 deletions base_report_to_printer/models/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ def render_qweb_pdf(self, res_ids=None, data=None):
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(
res_ids=res_ids, data=data
)
document, doc_format = super().render_qweb_pdf(res_ids=res_ids, data=data)

behaviour = self.behaviour()
printer = behaviour.pop("printer", None)
Expand Down
4 changes: 2 additions & 2 deletions base_report_to_printer/models/printing_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ def print_file(self, file_name, report=None, **print_opts):
options = self.print_options(report=report, **print_opts)

_logger.debug(
"Sending job to CUPS printer %s on %s"
% (self.system_name, self.server_id.address)
"Sending job to CUPS printer %s on %s with options %s"
% (self.system_name, self.server_id.address, options)
)
connection.printFile(self.system_name, file_name, file_name, options=options)
_logger.info(
Expand Down
5 changes: 3 additions & 2 deletions base_report_to_printer/models/printing_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def update_printers(self, domain=None, raise_on_error=False):
servers = self.search(domain)

res = True
for server in servers.with_context(active_test=False):
for server in servers:
connection = server._open_connection(raise_on_error=raise_on_error)
if not connection:
server.printer_ids.write({"status": "server-error"})
Expand All @@ -71,7 +71,8 @@ def update_printers(self, domain=None, raise_on_error=False):
# Update Printers
printers = connection.getPrinters()
existing_printers = {
printer.system_name: printer for printer in server.printer_ids
printer.system_name: printer
for printer in server.with_context(active_test=False).printer_ids
}
updated_printers = []
for name, printer_info in printers.items():
Expand Down
10 changes: 9 additions & 1 deletion base_report_to_printer/security/security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
<field eval="0" name="perm_write" />
<field eval="0" name="perm_create" />
</record>
<!--Ported from printing_tray -->
<record id="access_printing_tray_all" model="ir.model.access">
<field name="name">Printing Tray User</field>
<field name="model_id" ref="model_printing_tray" />
Expand All @@ -122,4 +121,13 @@
<field eval="1" name="perm_write" />
<field eval="1" name="perm_create" />
</record>
<record id="access_printing_printer_update_wizard" model="ir.model.access">
<field name="name">Update printer wizard</field>
<field name="model_id" ref="model_printing_printer_update_wizard" />
<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>
</odoo>
13 changes: 0 additions & 13 deletions base_report_to_printer/tests/test_printing_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,6 @@ def test_update_printers_update_unavailable(self, cups):
self.Model.action_update_printers()
self.assertEqual("unavailable", rec_id.status)

@mock.patch("%s.cups" % model)
def test_update_archived_printers(self, cups):
""" It should update status even if printer is archived """
rec_id = self.new_printer()
rec_id.toggle_active()
self.server.refresh()
cups.Connection().getPrinters().get.return_value = False
self.Model.action_update_printers()
self.assertEqual(
"unavailable",
rec_id.status,
)

@mock.patch("%s.cups" % model)
def test_update_jobs_cron(self, cups):
""" It should get all jobs from CUPS server """
Expand Down
4 changes: 2 additions & 2 deletions base_report_to_printer/views/ir_actions_report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<field name="model">ir.actions.report</field>
<field name="inherit_id" ref="base.act_report_xml_view" />
<field name="arch" type="xml">
<xpath expr="//page[@name='security']" position="before">
<page name="security" position="before">
<page string="Print" name="print">
<group>
<field name="property_printing_action_id" />
Expand All @@ -15,7 +15,7 @@
<separator string="Specific actions per user" />
<field name="printing_action_ids" />
</page>
</xpath>
</page>
</field>
</record>
</odoo>
5 changes: 5 additions & 0 deletions base_report_to_printer/views/printing_printer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
<field name="system_name" />
<field name="location" />
<field name="status" />
<filter
string="Archived"
name="inactive"
domain="[('active', '=', False)]"
/>
</search>
</field>
</record>
Expand Down
10 changes: 5 additions & 5 deletions base_report_to_printer/views/res_users.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form" />
<field name="arch" type="xml">
<xpath expr="//group[@name='preferences']/ancestor::page" position="inside">
<group name="preferences" position="after">
<group string="Printing" name="printing">
<field name="printing_action" />
<field name="printing_printer_id" options="{'no_create': True}" />
</group>
</xpath>
</group>
</field>
</record>
<record model="ir.ui.view" id="view_users_form_simple_modif">
<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">
<footer position="before">
<group string="Printing" name="printing">
<group name="preferences" position="inside">
<group name="printing">
<field name="printing_action" readonly="0" />
<field
name="printing_printer_id"
readonly="0"
options="{'no_create': True}"
/>
</group>
</footer>
</group>
</field>
</record>
</odoo>
Loading

0 comments on commit 689502d

Please sign in to comment.