diff --git a/models/shipcloud_delivery_carrier.py b/models/shipcloud_delivery_carrier.py index fd6aac7..62d11c0 100644 --- a/models/shipcloud_delivery_carrier.py +++ b/models/shipcloud_delivery_carrier.py @@ -204,7 +204,18 @@ class SCDeliveryCarrier(models.Model): except shipcloud.ApiError as err: raise Warning(str(err)) # { "shipment_quote": { "price": 42.12 } } - return result['shipment_quote']['price'] + shipping_cost = result['shipment_quote']['price'] + # determine net value in EUR of order + if order.currency_id != order.company_id.currency_id: + eur_amount = order.currency_id.compute(order.amount_untaxed, order.company_id.currency_id) + _logger.info("Converted %5.2f %s -> %5.2f %s" % (order.amount_untaxed, order.currency_id.name, eur_amount, order.company_id.currency_id.name)) + else: + eur_amount = order.amount_untaxed + # compute 0.35% of net value for transport insurance + insurance_cost = eur_amount * 0.0035 + _logger.info("Order %s, Shipping Service %s, cost=%5.2f, insurance=%5.2f", order.name, carrier_service.name, shipping_cost, insurance_cost) + # return sum of shipcloud shipping cost + insurance cost + return shipping_cost + insurance_cost def _is_outside_eu(self, country): if country.code == 'DE':