From 4d902b9d35a2ea915bb0e27ad8db14049ffcda73 Mon Sep 17 00:00:00 2001 From: "Nasreddin (bon)" Date: Mon, 7 Sep 2020 08:26:37 +0000 Subject: [PATCH] [FIX] delivery: No option of delivery packaging when "Based on Rules" Issue - Ensure that the provider of "The Poste" delivery method is "Based on Rules". - Create a quotation with "The Poste" as shipping method. - Confirm, then click on "Delivery" stat button. - Click on "Put in Pack" and create a "Delivery Packaging". - Save, go back to quotation and duplicate it. - Confirm, then click on "Delivery" stat button. - Click on "Put in Pack". The "Delivery Packaging" created previously is not available. Solution If 'current_package_carrier_type' is equal to 'fixed' or 'base_on_rule', replace it by 'none' since there are the equivalents in 'package_carrier_type' for 'delivery_type'. Related fix : https://github.com/odoo/odoo/pull/37427 opw-2310258 closes odoo/odoo#57444 X-original-commit: 5898d31025eacad3e8c37f7a105e20c81831ed17 Signed-off-by: Simon Goffin (sig) Signed-off-by: bon-odoo --- addons/delivery/models/stock_picking.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/delivery/models/stock_picking.py b/addons/delivery/models/stock_picking.py index 1d561631ce8..d4c1f0342fa 100644 --- a/addons/delivery/models/stock_picking.py +++ b/addons/delivery/models/stock_picking.py @@ -148,11 +148,11 @@ class StockPicking(models.Model): current_package_carrier_type=self.carrier_id.delivery_type, default_picking_id=self.id ) - # As we pass the `delivery_type` ('fixed' by default) in a key who correspond - # to the `package_carrier_type` ('none' to default), we make a conversion. + # As we pass the `delivery_type` ('fixed' or 'base_on_rule' by default) in a key who + # correspond to the `package_carrier_type` ('none' to default), we make a conversion. # No need conversion for other carriers as the `delivery_type` and #`package_carrier_type` will be the same in these cases. - if context['current_package_carrier_type'] == 'fixed': + if context['current_package_carrier_type'] in ['fixed', 'base_on_rule']: context['current_package_carrier_type'] = 'none' return { 'name': _('Package Details'),