From 8bfea53fecee92485b78bc179366229de8adc5dc Mon Sep 17 00:00:00 2001 From: Graeme Gellatly Date: Thu, 5 Oct 2017 05:26:24 +1300 Subject: [PATCH] [PORT] Printer Tray to V11 --- printer_tray/__manifest__.py | 4 +- printer_tray/models/__init__.py | 2 +- ...ons_report_xml.py => ir_actions_report.py} | 4 +- .../tests/test_ir_actions_report_xml.py | 4 +- printer_tray/tests/test_printing_printer.py | 2 +- printer_tray/tests/test_printing_tray.py | 2 +- printer_tray/views/ir_actions_report.xml | 16 ++++++++ printer_tray/views/ir_actions_report_xml.xml | 18 -------- printer_tray/views/printing_printer.xml | 39 +++++++++--------- .../views/printing_report_xml_action.xml | 41 ++++++++++--------- printer_tray/views/res_users.xml | 34 ++++++++------- 11 files changed, 81 insertions(+), 85 deletions(-) rename printer_tray/models/{ir_actions_report_xml.py => ir_actions_report.py} (87%) create mode 100644 printer_tray/views/ir_actions_report.xml delete mode 100644 printer_tray/views/ir_actions_report_xml.xml diff --git a/printer_tray/__manifest__.py b/printer_tray/__manifest__.py index 88c3440..a95c9a1 100644 --- a/printer_tray/__manifest__.py +++ b/printer_tray/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Report to printer - Paper tray selection', - 'version': '10.0.1.0.0', + 'version': '11.0.1.0.0', 'category': 'Printer', 'author': "Camptocamp, Odoo Community Association (OCA)", 'maintainer': 'Camptocamp', @@ -15,7 +15,7 @@ ], 'data': [ 'views/res_users.xml', - 'views/ir_actions_report_xml.xml', + 'views/ir_actions_report.xml', 'views/printing_printer.xml', 'views/printing_report_xml_action.xml', 'security/ir.model.access.csv', diff --git a/printer_tray/models/__init__.py b/printer_tray/models/__init__.py index dd6af32..37e0673 100644 --- a/printer_tray/models/__init__.py +++ b/printer_tray/models/__init__.py @@ -2,7 +2,7 @@ # Copyright (C) 2013-2014 Camptocamp () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import ir_actions_report_xml +from . import ir_actions_report from . import printing_tray from . import printing_printer from . import res_users diff --git a/printer_tray/models/ir_actions_report_xml.py b/printer_tray/models/ir_actions_report.py similarity index 87% rename from printer_tray/models/ir_actions_report_xml.py rename to printer_tray/models/ir_actions_report.py index 042b197..964b28e 100644 --- a/printer_tray/models/ir_actions_report_xml.py +++ b/printer_tray/models/ir_actions_report.py @@ -5,8 +5,8 @@ from odoo import api, fields, models -class IrActionsReportXml(models.Model): - _inherit = 'ir.actions.report.xml' +class IrActionsReport(models.Model): + _inherit = 'ir.actions.report' printer_tray_id = fields.Many2one( comodel_name='printing.tray', diff --git a/printer_tray/tests/test_ir_actions_report_xml.py b/printer_tray/tests/test_ir_actions_report_xml.py index 37daf12..43a4a09 100644 --- a/printer_tray/tests/test_ir_actions_report_xml.py +++ b/printer_tray/tests/test_ir_actions_report_xml.py @@ -7,7 +7,7 @@ from odoo.tests.common import TransactionCase class TestIrActionsReportXml(TransactionCase): def test_onchange_printer_tray_id_empty(self): - action = self.env['ir.actions.report.xml'].new( + action = self.env['ir.actions.report'].new( {'printer_tray_id': False}) action.onchange_printing_printer_id() self.assertFalse(action.printer_tray_id) @@ -31,7 +31,7 @@ class TestIrActionsReportXml(TransactionCase): 'printer_id': printer.id, }) - action = self.env['ir.actions.report.xml'].new( + action = self.env['ir.actions.report'].new( {'printer_tray_id': tray.id}) self.assertEqual(action.printer_tray_id, tray) action.onchange_printing_printer_id() diff --git a/printer_tray/tests/test_printing_printer.py b/printer_tray/tests/test_printing_printer.py index d40951d..336b1e0 100644 --- a/printer_tray/tests/test_printing_printer.py +++ b/printer_tray/tests/test_printing_printer.py @@ -104,7 +104,7 @@ class TestPrintingPrinter(TransactionCase): """ It should generate the right options dictionnary """ - report = self.env['ir.actions.report.xml'].search([], limit=1) + report = self.env['ir.actions.report'].search([], limit=1) action = self.env['printing.report.xml.action'].create({ 'user_id': self.env.user.id, 'report_id': report.id, diff --git a/printer_tray/tests/test_printing_tray.py b/printer_tray/tests/test_printing_tray.py index 753aa48..ca82837 100644 --- a/printer_tray/tests/test_printing_tray.py +++ b/printer_tray/tests/test_printing_tray.py @@ -36,7 +36,7 @@ class TestPrintingTray(TransactionCase): def test_report_behaviour(self): """ It should add the selected tray in the report data """ - ir_report = self.env['ir.actions.report.xml'].search([], limit=1) + ir_report = self.env['ir.actions.report'].search([], limit=1) report = self.env['printing.report.xml.action'].create({ 'user_id': self.env.user.id, 'report_id': ir_report.id, diff --git a/printer_tray/views/ir_actions_report.xml b/printer_tray/views/ir_actions_report.xml new file mode 100644 index 0000000..331d323 --- /dev/null +++ b/printer_tray/views/ir_actions_report.xml @@ -0,0 +1,16 @@ + + + + + + ir.actions.report.xml.add.printer.tray + ir.actions.report + + + + + + + + + diff --git a/printer_tray/views/ir_actions_report_xml.xml b/printer_tray/views/ir_actions_report_xml.xml deleted file mode 100644 index 60d52b0..0000000 --- a/printer_tray/views/ir_actions_report_xml.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - ir.actions.report.xml.add.printer.tray - ir.actions.report.xml - - - - - - - - - - diff --git a/printer_tray/views/printing_printer.xml b/printer_tray/views/printing_printer.xml index 35f0ad8..411b796 100644 --- a/printer_tray/views/printing_printer.xml +++ b/printer_tray/views/printing_printer.xml @@ -1,25 +1,24 @@ - - + + - printing.printer.form - printing.printer - - - - - -
- - - + printing.printer.form + printing.printer + + + + + + + + + + + + - - -
-
-
+ +
-
-
+ diff --git a/printer_tray/views/printing_report_xml_action.xml b/printer_tray/views/printing_report_xml_action.xml index 70600d8..4e52731 100644 --- a/printer_tray/views/printing_report_xml_action.xml +++ b/printer_tray/views/printing_report_xml_action.xml @@ -1,25 +1,26 @@ - - + + - printing.report.xml.action.form - printing.report.xml.action - - - - - - + printing.report.xml.action.form + printing.report.xml.action + + + + + + + - printing.report.xml.action.form - printing.report.xml.action - - - - - - + printing.report.xml.action.form + printing.report.xml.action + + + + + + - - + + diff --git a/printer_tray/views/res_users.xml b/printer_tray/views/res_users.xml index 6eeb6dc..2cd0d70 100644 --- a/printer_tray/views/res_users.xml +++ b/printer_tray/views/res_users.xml @@ -1,30 +1,28 @@ - - + - res.users.form.add.printer.tray - res.users - - - - + res.users.form.add.printer.tray + res.users + + + + + - - res.users.form.printing.tray - res.users - - - - + res.users.form.printing.tray + res.users + + + + + - - - +