[IMP] delivery: better handle package shipping weight

If the shipping weight is changed on a package, we want to update the
shipping weight on the picking to be consistent.

We also want to be able to set a shipping weight on a package that has
no carrier packaging, as we'll use the default one set on the carrier.
This commit is contained in:
Pierre Masereel
2020-02-04 12:57:52 +00:00
parent eebbdb9584
commit d5fd89df5d
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ class StockPicking(models.Model):
weight += move_line.product_uom_id._compute_quantity(move_line.qty_done, move_line.product_id.uom_id) * move_line.product_id.weight
picking.weight_bulk = weight
@api.depends('package_ids', 'weight_bulk')
@api.depends('package_ids', 'package_ids.shipping_weight', 'weight_bulk')
def _compute_shipping_weight(self):
for picking in self:
picking.shipping_weight = picking.weight_bulk + sum([pack.shipping_weight for pack in picking.package_ids])
@@ -60,5 +60,5 @@ class ChooseDeliveryPackage(models.TransientModel):
# write shipping weight and product_packaging on 'stock_quant_package' if needed
if self.delivery_packaging_id:
delivery_package.packaging_id = self.delivery_packaging_id
if self.shipping_weight:
delivery_package.shipping_weight = self.shipping_weight
if self.shipping_weight:
delivery_package.shipping_weight = self.shipping_weight