Skip to content
Snippets Groups Projects
Commit 1bd871f8 authored by Ahmad Khanalizadeh's avatar Ahmad Khanalizadeh
Browse files

[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#121123

Signed-off-by: default avatarTiffany Chang <tic@odoo.com>
parent e3289dec
No related branches found
No related tags found
No related merge requests found
......@@ -386,7 +386,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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment