From 4e42c31a683862c3b08b6a1b433277f8782cdc0d Mon Sep 17 00:00:00 2001 From: Tom Blauwendraat Date: Thu, 18 Jul 2019 16:17:06 +0200 Subject: [PATCH] fixup! fixup! [FIX] base_delivery_carrier_files: more fixes on migration to 10.0 --- .../tests/test_get_weight.py | 6 ++- delivery_carrier_file_tnt/__init__.py | 24 ++--------- delivery_carrier_file_tnt/__manifest__.py | 32 +++------------ delivery_carrier_file_tnt/carrier_file.py | 40 ------------------- .../models/delivery_carrier_file.py | 20 ++++++++++ .../delivery_carrier_file.xml} | 0 6 files changed, 35 insertions(+), 87 deletions(-) delete mode 100644 delivery_carrier_file_tnt/carrier_file.py create mode 100644 delivery_carrier_file_tnt/models/delivery_carrier_file.py rename delivery_carrier_file_tnt/{carrier_file_view.xml => views/delivery_carrier_file.xml} (100%) diff --git a/base_delivery_carrier_label/tests/test_get_weight.py b/base_delivery_carrier_label/tests/test_get_weight.py index 3b5147f56e..f4ac14ddd7 100644 --- a/base_delivery_carrier_label/tests/test_get_weight.py +++ b/base_delivery_carrier_label/tests/test_get_weight.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from odoo.tests.common import TransactionCase +from odoo.tools import mute_logger class TestGetWeight(TransactionCase): @@ -212,7 +213,10 @@ def test_get_weight_with_uom(self): # end of prepare data # because uom conversion is not implemented - self.assertEqual(package.weight, False) + _module = 'odoo.addons.base_delivery_carrier_label'\ + '.models.stock_pack_operation' + with mute_logger(_module): + self.assertEqual(package.weight, False) # if one day, uom conversion is implemented: # self.assertEqual(package.get_weight(), products_weight) diff --git a/delivery_carrier_file_tnt/__init__.py b/delivery_carrier_file_tnt/__init__.py index c56096b507..66c619b9a1 100644 --- a/delivery_carrier_file_tnt/__init__.py +++ b/delivery_carrier_file_tnt/__init__.py @@ -1,23 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Author: Guewen Baconnier -# Copyright 2012 Camptocamp SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# Copyright 2012 Camptocamp SA +# Author: Guewen Baconnier +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import generator -from . import carrier_file +from . import models diff --git a/delivery_carrier_file_tnt/__manifest__.py b/delivery_carrier_file_tnt/__manifest__.py index 2d21c8f8ad..4e61b74cbb 100644 --- a/delivery_carrier_file_tnt/__manifest__.py +++ b/delivery_carrier_file_tnt/__manifest__.py @@ -1,24 +1,4 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Author: Guewen Baconnier -# Copyright 2012 Camptocamp SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - { 'name': 'Delivery Carrier File: TNT', 'version': '10.0.1.0.0', @@ -31,12 +11,12 @@ 'author': "Camptocamp,Odoo Community Association (OCA)", 'license': 'AGPL-3', 'website': 'http://www.camptocamp.com', - 'depends': ['base_delivery_carrier_files'], - 'init_xml': [], - 'update_xml': ['carrier_file_view.xml'], - 'demo_xml': [], - 'test': [], - 'images': [], + 'depends': [ + 'base_delivery_carrier_files' + ], + 'data': [ + 'views/delivery_carrier_file.xml' + ], 'installable': True, 'auto_install': False, } diff --git a/delivery_carrier_file_tnt/carrier_file.py b/delivery_carrier_file_tnt/carrier_file.py deleted file mode 100644 index 242654ba8e..0000000000 --- a/delivery_carrier_file_tnt/carrier_file.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Guewen Baconnier -# Copyright 2012 Camptocamp SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from odoo import api, fields, models - - -class CarrierFile(models.Model): - _inherit = 'delivery.carrier.file' - - @api.model - def get_type_selection(self): - result = super(CarrierFile, self - ).get_type_selection() - if 'tnt_express_shipper' not in result: - result.append(('tnt_express_shipper', 'TNT Express Shipper')) - return result - - type = fields.Selection(get_type_selection, 'Type', required=True) - tnt_account = fields.Char('TNT Account', size=9) - - -CarrierFile() diff --git a/delivery_carrier_file_tnt/models/delivery_carrier_file.py b/delivery_carrier_file_tnt/models/delivery_carrier_file.py new file mode 100644 index 0000000000..fa0dd48635 --- /dev/null +++ b/delivery_carrier_file_tnt/models/delivery_carrier_file.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Copyright 2012 Camptocamp SA +# Author: Guewen Baconnier +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class DeliveryCarrierFile(models.Model): + _inherit = 'delivery.carrier.file' + + @api.model + def get_type_selection(self): + result = super(DeliveryCarrierFile, self).get_type_selection() + if 'tnt_express_shipper' not in result: + result.append(('tnt_express_shipper', 'TNT Express Shipper')) + return result + + type = fields.Selection(get_type_selection, 'Type', required=True) + tnt_account = fields.Char('TNT Account', size=9) diff --git a/delivery_carrier_file_tnt/carrier_file_view.xml b/delivery_carrier_file_tnt/views/delivery_carrier_file.xml similarity index 100% rename from delivery_carrier_file_tnt/carrier_file_view.xml rename to delivery_carrier_file_tnt/views/delivery_carrier_file.xml