diff options
| author | Pierre Masereel <pim@odoo.com> | 2019-04-04 07:45:09 +0000 |
|---|---|---|
| committer | Pierre Masereel <pim@odoo.com> | 2020-02-04 12:57:52 +0000 |
| commit | d5fd89df5d1764aeb0a7d50a49b6b0a2ceeed3af (patch) | |
| tree | 5abcfcb0a03c55ce589a0347a88bbf37295894f8 /addons | |
| parent | eebbdb9584b964ba671ba50b104d8d91dc181d70 (diff) | |
[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.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/delivery/models/stock_picking.py | 2 | ||||
| -rw-r--r-- | addons/delivery/wizard/choose_delivery_package.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/addons/delivery/models/stock_picking.py b/addons/delivery/models/stock_picking.py index 85a2db8cf53..d006e7fd036 100644 --- a/addons/delivery/models/stock_picking.py +++ b/addons/delivery/models/stock_picking.py @@ -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]) diff --git a/addons/delivery/wizard/choose_delivery_package.py b/addons/delivery/wizard/choose_delivery_package.py index 8c54c7e130a..789e74e0d72 100644 --- a/addons/delivery/wizard/choose_delivery_package.py +++ b/addons/delivery/wizard/choose_delivery_package.py @@ -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 |
