create customs declaration if destination != EU
This commit is contained in:
parent
35b7575e54
commit
1d6f20e1eb
|
@ -188,6 +188,14 @@ class SCDeliveryCarrier(models.Model):
|
|||
# { "shipment_quote": { "price": 42.12 } }
|
||||
return result['shipment_quote']['price']
|
||||
|
||||
def _is_outside_eu(self, country):
|
||||
if country.code == 'DE':
|
||||
return False
|
||||
eu_grp = self.env['res.country.group'].search([('name','=','EU-outside-Germany'), ('country_ids','=',country.id)])
|
||||
if eu_grp:
|
||||
return False
|
||||
return True
|
||||
|
||||
@api.one
|
||||
def sc_send_shipping(self, pickings):
|
||||
"""Generate a shipping label from the given stock.picking"""
|
||||
|
@ -201,7 +209,10 @@ class SCDeliveryCarrier(models.Model):
|
|||
from_addr = self.build_sc_addr(warehouse)
|
||||
to_addr = self.build_sc_addr(recipient)
|
||||
pkg = self.build_sc_pkg(picking=pickings)
|
||||
customs = None #self.build_sc_customs_decl(pickings, content_desc)
|
||||
if warehouse.country_id.code != recipient.country_id.code and self._is_outside_eu(recipient.country_id):
|
||||
customs = self.build_sc_customs_decl(pickings, content_desc)
|
||||
else:
|
||||
customs = None
|
||||
# build the actual shipment object
|
||||
shp = shipcloud.gen_shipment(from_addr, to_addr, pkg, pickings.name, customs_decl=customs,
|
||||
carrier=carrier_service.carrier, service=carrier_service.service,
|
||||
|
|
Loading…
Reference in New Issue