Compare commits
2 Commits
05a867cc55
...
b8decb3ec8
Author | SHA1 | Date |
---|---|---|
Harald Welte | b8decb3ec8 | |
Harald Welte | fb5e942d45 |
|
@ -152,7 +152,7 @@ class SCDeliveryCarrier(models.Model):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def build_sc_customs_decl(self, picking, explanation, currency='EUR'):
|
def build_sc_customs_decl(self, picking, explanation, currency='EUR'):
|
||||||
items = [self.build_sc_customs_item(x) for x in picking.move_lines]
|
items = [self.build_sc_customs_item(x) for x in picking.move_lines if picking.state == 'assigned']
|
||||||
total = 0.0
|
total = 0.0
|
||||||
for i in items:
|
for i in items:
|
||||||
total += i['value_amount']
|
total += i['value_amount']
|
||||||
|
@ -204,7 +204,18 @@ class SCDeliveryCarrier(models.Model):
|
||||||
except shipcloud.ApiError as err:
|
except shipcloud.ApiError as err:
|
||||||
raise Warning(str(err))
|
raise Warning(str(err))
|
||||||
# { "shipment_quote": { "price": 42.12 } }
|
# { "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):
|
def _is_outside_eu(self, country):
|
||||||
if country.code == 'DE':
|
if country.code == 'DE':
|
||||||
|
|
Loading…
Reference in New Issue