From e828e3875eb1e11922df33ef42c04cd80d7ba1a0 Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Mon, 4 Oct 2021 10:56:19 -0700 Subject: [PATCH] [IMP] delivery_ups_hibou: multi-rating backports from 14.0 --- delivery_ups_hibou/__init__.py | 2 ++ delivery_ups_hibou/__manifest__.py | 4 ++-- delivery_ups_hibou/models/__init__.py | 2 ++ delivery_ups_hibou/models/delivery_ups.py | 14 +++++++++++++- delivery_ups_hibou/models/ups_request_patch.py | 2 ++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/delivery_ups_hibou/__init__.py b/delivery_ups_hibou/__init__.py index 0650744f..09434554 100644 --- a/delivery_ups_hibou/__init__.py +++ b/delivery_ups_hibou/__init__.py @@ -1 +1,3 @@ +# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. + from . import models diff --git a/delivery_ups_hibou/__manifest__.py b/delivery_ups_hibou/__manifest__.py index 67931660..fdaf3477 100644 --- a/delivery_ups_hibou/__manifest__.py +++ b/delivery_ups_hibou/__manifest__.py @@ -1,9 +1,9 @@ { 'name': 'Hibou UPS Shipping', - 'version': '12.0.1.0.0', + 'version': '12.0.1.1.0', 'category': 'Stock', 'author': "Hibou Corp.", - 'license': 'AGPL-3', + 'license': 'OPL-1', 'website': 'https://hibou.io/', 'depends': [ 'delivery_ups', diff --git a/delivery_ups_hibou/models/__init__.py b/delivery_ups_hibou/models/__init__.py index 735db17b..102ebacd 100644 --- a/delivery_ups_hibou/models/__init__.py +++ b/delivery_ups_hibou/models/__init__.py @@ -1,2 +1,4 @@ +# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. + from . import delivery_ups from . import ups_request_patch diff --git a/delivery_ups_hibou/models/delivery_ups.py b/delivery_ups_hibou/models/delivery_ups.py index 245f29ba..9331eebb 100644 --- a/delivery_ups_hibou/models/delivery_ups.py +++ b/delivery_ups_hibou/models/delivery_ups.py @@ -1,3 +1,5 @@ +# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. + from odoo import api, fields, models, _ from odoo.exceptions import UserError, ValidationError from odoo.addons.delivery_ups.models.ups_request import UPSRequest, Package @@ -219,7 +221,17 @@ class ProviderUPS(models.Model): res = res + [shipping_data] return res - def ups_rate_shipment_multi(self, order=None, picking=None): + def ups_rate_shipment_multi(self, order=None, picking=None, packages=None): + if not packages: + return self._ups_rate_shipment_multi_package(order=order, picking=picking) + else: + rates = [] + for package in packages: + rates += self._ups_rate_shipment_multi_package(order=order, picking=picking, package=package) + return rates + + def _ups_rate_shipment_multi_package(self, order=None, picking=None, package=None): + # TODO package here is ignored, it should not be (UPS is not multi-rating capable until we can get rates for a single package) superself = self.sudo() srm = UPSRequest(self.log_xml, superself.ups_username, superself.ups_passwd, superself.ups_shipper_number, superself.ups_access_number, self.prod_environment) ResCurrency = self.env['res.currency'] diff --git a/delivery_ups_hibou/models/ups_request_patch.py b/delivery_ups_hibou/models/ups_request_patch.py index 1b811f16..a845ed82 100644 --- a/delivery_ups_hibou/models/ups_request_patch.py +++ b/delivery_ups_hibou/models/ups_request_patch.py @@ -1,3 +1,5 @@ +# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. + import suds from odoo.addons.delivery_ups.models.ups_request import UPSRequest import logging