Merge branch 'new/15.0/delivery_ups_oca_hibou' into '15.0-test'

new/15.0/delivery_ups_oca_hibou into 15.0-test

See merge request hibou-io/hibou-odoo/suite!1465
This commit is contained in:
Hibou Bot
2022-09-06 22:20:52 +00:00

View File

@@ -12,6 +12,7 @@ def _quant_package_data(self, package, picking):
# TODO do we want to call this without a package? # TODO do we want to call this without a package?
if not package and picking.package_ids: if not package and picking.package_ids:
package = picking.package_ids package = picking.package_ids
package_type = self.carrier.ups_default_package_type_id
currency = picking.sale_id.currency_id if picking.sale_id else picking.company_id.currency_id currency = picking.sale_id.currency_id if picking.sale_id else picking.company_id.currency_id
insurance_currency_code = currency.name insurance_currency_code = currency.name
res = [] res = []
@@ -21,11 +22,12 @@ def _quant_package_data(self, package, picking):
NumOfPieces = len(package) NumOfPieces = len(package)
# PackageWeight = sum(package.mapped('shipping_weight')) # PackageWeight = sum(package.mapped('shipping_weight'))
for p in package: for p in package:
package_code = p.package_type_id.shipper_package_code if p.package_type_id.package_carrier_type == 'ups' else package_type.shipper_package_code
package_data = { package_data = {
"Description": p.name, "Description": p.name,
"NumOfPieces": str(NumOfPieces), "NumOfPieces": str(NumOfPieces),
"Packaging": { "Packaging": {
"Code": p.package_type_id.shipper_package_code, "Code": package_code,
"Description": p.name, "Description": p.name,
}, },
"Dimensions": { "Dimensions": {
@@ -60,7 +62,6 @@ def _quant_package_data(self, package, picking):
res.append(package_data) res.append(package_data)
return res return res
package_type = self.carrier.ups_default_package_type_id
return [{ return [{
"Description": picking.name, "Description": picking.name,
"NumOfPieces": str(NumOfPieces), "NumOfPieces": str(NumOfPieces),