From 12ff8646555a4bc3f98c0d55d94081759db654cb Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 30 Mar 2020 14:15:15 +0200 Subject: [PATCH] [MIG][12.0] partner_label --- partner_label/__init__.py | 3 - partner_label/__manifest__.py | 8 +- partner_label/models/__init__.py | 5 +- partner_label/models/res_company.py | 7 +- ...fig_settings.py => res_config_settings.py} | 27 ++++--- partner_label/reports/res_partner.xml | 46 +++++------ partner_label/tests/__init__.py | 3 - partner_label/tests/test_partner_label.py | 14 ++-- partner_label/views/base_config_settings.xml | 78 +++++++++++++------ 9 files changed, 103 insertions(+), 88 deletions(-) rename partner_label/models/{base_config_settings.py => res_config_settings.py} (75%) diff --git a/partner_label/__init__.py b/partner_label/__init__.py index a3e818a49..0650744f6 100644 --- a/partner_label/__init__.py +++ b/partner_label/__init__.py @@ -1,4 +1 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/partner_label/__manifest__.py b/partner_label/__manifest__.py index d2f65ac31..3c3a2ac8a 100644 --- a/partner_label/__manifest__.py +++ b/partner_label/__manifest__.py @@ -1,16 +1,14 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# Copyright 2019 Therp BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Partner labels", - "version": "10.0.1.0.0", + "version": "12.0.1.0.0", "author": "Therp BV,Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Base", "summary": "Print partner labels", "depends": [ 'base_setup', - 'report', ], "data": [ "views/base_config_settings.xml", diff --git a/partner_label/models/__init__.py b/partner_label/models/__init__.py index d7fc83e26..0b150f71c 100644 --- a/partner_label/models/__init__.py +++ b/partner_label/models/__init__.py @@ -1,5 +1,2 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import res_company -from . import base_config_settings +from . import res_config_settings diff --git a/partner_label/models/res_company.py b/partner_label/models/res_company.py index 135e076ba..6ef0f7772 100644 --- a/partner_label/models/res_company.py +++ b/partner_label/models/res_company.py @@ -1,7 +1,6 @@ -# -*- coding: utf-8 -*- -# © 2017 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import fields, models +# Copyright 2017-2019 Therp BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields, models class ResCompany(models.Model): diff --git a/partner_label/models/base_config_settings.py b/partner_label/models/res_config_settings.py similarity index 75% rename from partner_label/models/base_config_settings.py rename to partner_label/models/res_config_settings.py index 8690a7269..98c60fd2b 100644 --- a/partner_label/models/base_config_settings.py +++ b/partner_label/models/res_config_settings.py @@ -1,36 +1,38 @@ -# -*- coding: utf-8 -*- -# © 2017 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import api, fields, models +# Copyright 2017-2019 Therp BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import api, fields, models -class BaseConfigSettings(models.TransientModel): - _inherit = 'base.config.settings' +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' partner_labels_width = fields.Float( related='company_id.partner_labels_width', required=True, + readonly=False, ) partner_labels_height = fields.Float( related='company_id.partner_labels_height', required=True, + readonly=False, ) partner_labels_padding = fields.Float( related='company_id.partner_labels_padding', required=True, + readonly=False, ) partner_labels_margin_top = fields.Float( related='company_id.partner_labels_margin_top', - required=True, + required=True, readonly=False, ) partner_labels_margin_bottom = fields.Float( related='company_id.partner_labels_margin_bottom', - required=True, + required=True, readonly=False, ) partner_labels_margin_left = fields.Float( related='company_id.partner_labels_margin_left', - required=True, + required=True, readonly=False, ) partner_labels_margin_right = fields.Float( related='company_id.partner_labels_margin_right', - required=True, + required=True, readonly=False, ) partner_labels_paperformat_id = fields.Many2one( 'report.paperformat', string='Paperformat', required=True, @@ -57,7 +59,8 @@ class BaseConfigSettings(models.TransientModel): @api.multi def action_partner_labels_preview(self): - return self.env['report'].get_action( + return self.env.ref( + 'partner_label.report_res_partner_label' + ).report_action( self.env['res.partner'].search([], limit=100), - 'partner_label.view_res_partner_label', ) diff --git a/partner_label/reports/res_partner.xml b/partner_label/reports/res_partner.xml index d8e8da5a4..6d84a4cef 100644 --- a/partner_label/reports/res_partner.xml +++ b/partner_label/reports/res_partner.xml @@ -1,39 +1,31 @@ diff --git a/partner_label/tests/__init__.py b/partner_label/tests/__init__.py index 43dacef09..dae92ca6c 100644 --- a/partner_label/tests/__init__.py +++ b/partner_label/tests/__init__.py @@ -1,4 +1 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_partner_label diff --git a/partner_label/tests/test_partner_label.py b/partner_label/tests/test_partner_label.py index de7b90c3a..7a9b8ef58 100644 --- a/partner_label/tests/test_partner_label.py +++ b/partner_label/tests/test_partner_label.py @@ -1,12 +1,12 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp.tests.common import TransactionCase +# Copyright 2017 Therp BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo.tests.common import TransactionCase class TestPartnerLabel(TransactionCase): def test_partner_label(self): - settings = self.env['base.config.settings'].create({}) + settings = self.env['res.config.settings'].create({}) + settings.refresh() self.assertItemsEqual( settings.action_partner_labels_preview()['context']['active_ids'], self.env['res.partner'].search([], limit=100).ids, @@ -17,10 +17,10 @@ class TestPartnerLabel(TransactionCase): .paperformat_id ) settings.partner_labels_paperformat_id = self.env.ref( - 'report.paperformat_us' + 'base.paperformat_us' ).id, self.assertEqual( self.env.ref('partner_label.report_res_partner_label') .paperformat_id, - self.env.ref('report.paperformat_us') + self.env.ref('base.paperformat_us') ) diff --git a/partner_label/views/base_config_settings.xml b/partner_label/views/base_config_settings.xml index ea1d8041f..0c0d86eb9 100644 --- a/partner_label/views/base_config_settings.xml +++ b/partner_label/views/base_config_settings.xml @@ -1,31 +1,63 @@ - base.config.settings - + res.config.settings + - - -