Merge branch 'fix/14.0/delivery_fedex_hibou__mutli_rate_picking_without_package' into '14.0'

fix/14.0/delivery_fedex_hibou__mutli_rate_picking_without_package into 14.0

See merge request hibou-io/hibou-odoo/suite!1043
This commit is contained in:
Jared Kipe
2021-09-20 23:28:39 +00:00

View File

@@ -558,6 +558,7 @@ class DeliveryFedex(models.Model):
) )
srm.set_master_package(weight_value, 1) srm.set_master_package(weight_value, 1)
else: else:
if picking.package_ids:
for sequence, package in enumerate(picking.package_ids, start=1): for sequence, package in enumerate(picking.package_ids, start=1):
package_weight = self._fedex_convert_weight(package.shipping_weight, self.fedex_weight_unit) package_weight = self._fedex_convert_weight(package.shipping_weight, self.fedex_weight_unit)
packaging = package.packaging_id packaging = package.packaging_id
@@ -575,6 +576,24 @@ class DeliveryFedex(models.Model):
reference=('%s-%d' % (order_name, sequence)), reference=('%s-%d' % (order_name, sequence)),
insurance=insurance_value insurance=insurance_value
) )
else:
# deliver all together...
package_weight = self._fedex_convert_weight(picking.shipping_weight or picking.weight, self.fedex_weight_unit)
packaging = self.fedex_default_packaging_id
srm.add_package(
package_weight,
mode='rating',
package_code=packaging.shipper_package_code,
package_height=packaging.height,
package_width=packaging.width,
package_length=packaging.packaging_length,
sequence_number=1,
# po_number=po_number,
# dept_number=dept_number,
reference=('%s-%d' % (order_name, 1)),
insurance=insurance_value
)
# Commodities for customs declaration (international shipping) # Commodities for customs declaration (international shipping)