mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Merge branch '11.0' into 11.0-test
This commit is contained in:
@@ -165,13 +165,12 @@ def patched_get_shipping_price(self, shipment_info, packages, shipper, ship_from
|
|||||||
_logger.warning('exception during the UPS Time In Transit request. ' + str(e))
|
_logger.warning('exception during the UPS Time In Transit request. ' + str(e))
|
||||||
tnt_ready = False
|
tnt_ready = False
|
||||||
tnt_response = '-1'
|
tnt_response = '-1'
|
||||||
if tnt_ready and hasattr(tnt_response, 'TransitReponse') and hasattr(tnt_response.TransitResponse, 'ServiceSummary'):
|
if tnt_ready and hasattr(tnt_response, 'TransitResponse') and hasattr(tnt_response.TransitResponse, 'ServiceSummary'):
|
||||||
for service in tnt_response.TransitResponse.ServiceSummary:
|
for service in tnt_response.TransitResponse.ServiceSummary:
|
||||||
if TNT_CODE_MAP.get(service.Service.Code) == service_type:
|
if TNT_CODE_MAP.get(service.Service.Code) == res['service_code']:
|
||||||
if hasattr(service, 'EstimatedArrival') and hasattr(service.EstimatedArrival, 'BusinessDaysInTransit'):
|
if hasattr(service, 'EstimatedArrival') and hasattr(service.EstimatedArrival, 'BusinessDaysInTransit'):
|
||||||
res['transit_days'] = int(service.EstimatedArrival.BusinessDaysInTransit)
|
res['transit_days'] = int(service.EstimatedArrival.BusinessDaysInTransit)
|
||||||
break
|
break
|
||||||
# use TNT API to
|
|
||||||
result.append(res)
|
result.append(res)
|
||||||
else:
|
else:
|
||||||
result = {}
|
result = {}
|
||||||
|
|||||||
@@ -23,10 +23,9 @@ class StockDeliveryPlanner(models.TransientModel):
|
|||||||
selected_options = wiz.plan_option_ids.filtered(lambda p: p.selection == 'selected')
|
selected_options = wiz.plan_option_ids.filtered(lambda p: p.selection == 'selected')
|
||||||
wiz.packages_planned = len(selected_options) == len(packages)
|
wiz.packages_planned = len(selected_options) == len(packages)
|
||||||
|
|
||||||
def create(self, values):
|
def _get_carriers(self):
|
||||||
planner = super(StockDeliveryPlanner, self).create(values)
|
self.ensure_one()
|
||||||
|
base_carriers = self.picking_id.picking_type_id.warehouse_id.delivery_planner_carrier_ids
|
||||||
base_carriers = planner.picking_id.picking_type_id.warehouse_id.delivery_planner_carrier_ids
|
|
||||||
if not base_carriers:
|
if not base_carriers:
|
||||||
carrier_ids = self.env['ir.config_parameter'].sudo().get_param('stock.delivery.planner.carrier_ids.%s' % (self.env.user.company_id.id, ))
|
carrier_ids = self.env['ir.config_parameter'].sudo().get_param('stock.delivery.planner.carrier_ids.%s' % (self.env.user.company_id.id, ))
|
||||||
if carrier_ids:
|
if carrier_ids:
|
||||||
@@ -35,7 +34,11 @@ class StockDeliveryPlanner(models.TransientModel):
|
|||||||
base_carriers = base_carriers.browse(carrier_ids)
|
base_carriers = base_carriers.browse(carrier_ids)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
base_carriers = base_carriers.sudo()
|
return base_carriers.sudo()
|
||||||
|
|
||||||
|
def create(self, values):
|
||||||
|
planner = super(StockDeliveryPlanner, self).create(values)
|
||||||
|
base_carriers = planner._get_carriers()
|
||||||
|
|
||||||
for carrier in base_carriers:
|
for carrier in base_carriers:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user