differentiate between EU / outside EU services
This commit is contained in:
parent
b685d48fd9
commit
5df351493e
|
@ -86,11 +86,23 @@ class DPDeliveryCarrier(models.Model):
|
||||||
last = last,
|
last = last,
|
||||||
address = addr)
|
address = addr)
|
||||||
|
|
||||||
|
def _get_eu_res_country_group(self):
|
||||||
|
eu_group = self.env.ref("base.europe", raise_if_not_found=False)
|
||||||
|
if not eu_group:
|
||||||
|
raise Warning(_('The Europe country group cannot be found. '
|
||||||
|
'Please update the base module.'))
|
||||||
|
return eu_group
|
||||||
|
|
||||||
def get_services_by_country(self, service_class, country_code):
|
def get_services_by_country(self, service_class, country_code):
|
||||||
if country_code == 'DE':
|
if country_code == 'DE':
|
||||||
return service_class.services_natl
|
return service_class.services_natl
|
||||||
else:
|
else:
|
||||||
return service_class.services_intl
|
eu_country_group = self._get_eu_res_country_group()
|
||||||
|
country_id = self.env['res.country'].search([('code','=',country_code)])
|
||||||
|
if country_id in eu_country_group.country_ids.ids:
|
||||||
|
return service_class.services_eu
|
||||||
|
else:
|
||||||
|
return service_class.services_intl
|
||||||
|
|
||||||
# determine lowest-matching-max-weight service within same class
|
# determine lowest-matching-max-weight service within same class
|
||||||
def get_service_by_class(self, recipient, weight, service_class):
|
def get_service_by_class(self, recipient, weight, service_class):
|
||||||
|
|
|
@ -13,6 +13,9 @@ class SMCShippingDpClass(models.Model):
|
||||||
# list of services in this class for national delivery
|
# list of services in this class for national delivery
|
||||||
services_natl = fields.Many2many(comodel_name = 'delivery.carrier.dp.service',
|
services_natl = fields.Many2many(comodel_name = 'delivery.carrier.dp.service',
|
||||||
relation = 'dp_class_natl_services_rel')
|
relation = 'dp_class_natl_services_rel')
|
||||||
|
# list of services in this class for EU delivery
|
||||||
|
services_eu = fields.Many2many(comodel_name = 'delivery.carrier.dp.service',
|
||||||
|
relation = 'dp_class_eu_services_rel')
|
||||||
# list of services in this class for international delivery
|
# list of services in this class for international delivery
|
||||||
services_intl = fields.Many2many(comodel_name = 'delivery.carrier.dp.service',
|
services_intl = fields.Many2many(comodel_name = 'delivery.carrier.dp.service',
|
||||||
relation = 'dp_class_intl_services_rel')
|
relation = 'dp_class_intl_services_rel')
|
||||||
|
@ -30,6 +33,7 @@ class SMCShippingDpService(models.Model):
|
||||||
width = fields.Integer("Width")
|
width = fields.Integer("Width")
|
||||||
length = fields.Integer("Length")
|
length = fields.Integer("Length")
|
||||||
international = fields.Boolean("International")
|
international = fields.Boolean("International")
|
||||||
|
eu = fields.Boolean("EU")
|
||||||
|
|
||||||
# extend stock.picking with fields for Shipment and Voucher ID
|
# extend stock.picking with fields for Shipment and Voucher ID
|
||||||
class SMCStockPickingDp(models.Model):
|
class SMCStockPickingDp(models.Model):
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
<field name="code"/>
|
<field name="code"/>
|
||||||
<field name="prodws_id"/>
|
<field name="prodws_id"/>
|
||||||
<field name="international"/>
|
<field name="international"/>
|
||||||
|
<field name="eu"/>
|
||||||
<field name="cost_price"/>
|
<field name="cost_price"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
|
@ -68,6 +69,7 @@
|
||||||
<field name="width"/>
|
<field name="width"/>
|
||||||
<field name="length"/>
|
<field name="length"/>
|
||||||
<field name="international"/>
|
<field name="international"/>
|
||||||
|
<field name="eu"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
@ -82,6 +84,7 @@
|
||||||
<sheet>
|
<sheet>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="services_natl"/>
|
<field name="services_natl"/>
|
||||||
|
<field name="services_eu"/>
|
||||||
<field name="services_intl"/>
|
<field name="services_intl"/>
|
||||||
</sheet>
|
</sheet>
|
||||||
</form>
|
</form>
|
||||||
|
@ -95,6 +98,7 @@
|
||||||
<tree string="package">
|
<tree string="package">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="services_natl"/>
|
<field name="services_natl"/>
|
||||||
|
<field name="services_eu"/>
|
||||||
<field name="services_intl"/>
|
<field name="services_intl"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
|
Loading…
Reference in New Issue