[FIX] delivery: exclude service lines from commodities
Steps to reproduce: configure easypost for international shipping (e.g. using USPS) Make a sale order for a customer in another country Add a discount program (e.g. 10% off) Attempt to add shipping and get the rates Get traceback: `Easypost returned an error: Wrong parameter type. - value: must be greater than or equal to 0` To fix this we need to exclude service type products when creating commodities from order lines (similar to creating commodities from stock move lines) opw-3269467 closes odoo/odoo#122869 X-original-commit: c4904454d46036374ea5e9ae7047f1546e9cab44 Signed-off-by: Tiffany Chang <tic@odoo.com> Signed-off-by: Khanalizadeh Ahmad (khah) <khah@odoo.com>
This commit is contained in:
@@ -185,7 +185,7 @@ class DeliveryCarrier(models.Model):
|
||||
def _get_commodities_from_order(self, order):
|
||||
commodities = []
|
||||
|
||||
for line in order.order_line.filtered(lambda line: not line.is_delivery and not line.display_type):
|
||||
for line in order.order_line.filtered(lambda line: not line.is_delivery and not line.display_type and line.product_id.type in ['product', 'consu']):
|
||||
unit_quantity = line.product_uom._compute_quantity(line.product_uom_qty, line.product_id.uom_id)
|
||||
rounded_qty = max(1, float_round(unit_quantity, precision_digits=0))
|
||||
country_of_origin = line.product_id.country_of_origin.code or order.warehouse_id.partner_id.country_id.code
|
||||
|
||||
Reference in New Issue
Block a user