fix(shipment): apply code review
This commit is contained in:
parent
1c9410e5e8
commit
000494f548
@ -24,14 +24,14 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "api_password",
|
"fieldname": "api_password",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Password",
|
||||||
"label": "API Password",
|
"label": "API Password",
|
||||||
"read_only_depends_on": "eval:doc.enabled == 0"
|
"read_only_depends_on": "eval:doc.enabled == 0"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-08-05 16:33:44.548230",
|
"modified": "2020-10-21 10:28:37.607717",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "ERPNext Integrations",
|
"module": "ERPNext Integrations",
|
||||||
"name": "LetMeShip",
|
"name": "LetMeShip",
|
||||||
|
|||||||
@ -20,9 +20,7 @@ def get_letmeship_available_services(delivery_to_type, pickup_address,
|
|||||||
delivery_address, shipment_parcel, description_of_content, pickup_date,
|
delivery_address, shipment_parcel, description_of_content, pickup_date,
|
||||||
value_of_goods, pickup_contact=None, delivery_contact=None):
|
value_of_goods, pickup_contact=None, delivery_contact=None):
|
||||||
# Retrieve rates at LetMeShip from specification stated.
|
# Retrieve rates at LetMeShip from specification stated.
|
||||||
enabled = frappe.db.get_single_value('LetMeShip','enabled')
|
api_id, api_password, enabled = frappe.db.get_value('LetMeShip', 'LetMeShip', ['enabled', 'api_password', 'api_id'])
|
||||||
api_id = frappe.db.get_single_value('LetMeShip','api_id')
|
|
||||||
api_password = frappe.db.get_single_value('LetMeShip','api_password')
|
|
||||||
if not enabled or not api_id or not api_password:
|
if not enabled or not api_id or not api_password:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@ -41,62 +39,16 @@ def get_letmeship_available_services(delivery_to_type, pickup_address,
|
|||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Access-Control-Allow-Origin': 'string'
|
'Access-Control-Allow-Origin': 'string'
|
||||||
}
|
}
|
||||||
payload = {'pickupInfo': {
|
payload = generate_payload(
|
||||||
'address': {
|
pickup_address=pickup_address,
|
||||||
'countryCode': pickup_address.country_code,
|
pickup_contact=pickup_contact,
|
||||||
'zip': pickup_address.pincode,
|
delivery_address=delivery_address,
|
||||||
'city': pickup_address.city,
|
delivery_contact=delivery_contact,
|
||||||
'street': pickup_address.address_line1,
|
description_of_content=description_of_content,
|
||||||
'addressInfo1': pickup_address.address_line2,
|
value_of_goods=value_of_goods,
|
||||||
'houseNo': '',
|
parcel_list=parcel_list,
|
||||||
},
|
pickup_date=pickup_date
|
||||||
'company': pickup_address.address_title,
|
)
|
||||||
'person': {
|
|
||||||
'title': pickup_contact.title,
|
|
||||||
'firstname': pickup_contact.first_name,
|
|
||||||
'lastname': pickup_contact.last_name
|
|
||||||
},
|
|
||||||
'phone': {
|
|
||||||
'phoneNumber': pickup_contact.phone,
|
|
||||||
'phoneNumberPrefix': pickup_contact.phone_prefix
|
|
||||||
},
|
|
||||||
'email': pickup_contact.email,
|
|
||||||
}, 'deliveryInfo': {
|
|
||||||
'address': {
|
|
||||||
'countryCode': delivery_address.country_code,
|
|
||||||
'zip': delivery_address.pincode,
|
|
||||||
'city': delivery_address.city,
|
|
||||||
'street': delivery_address.address_line1,
|
|
||||||
'addressInfo1': delivery_address.address_line2,
|
|
||||||
'houseNo': '',
|
|
||||||
},
|
|
||||||
'company': delivery_address.address_title,
|
|
||||||
'person': {
|
|
||||||
'title': delivery_contact.title,
|
|
||||||
'firstname': delivery_contact.first_name,
|
|
||||||
'lastname': delivery_contact.last_name
|
|
||||||
},
|
|
||||||
'phone': {
|
|
||||||
'phoneNumber': delivery_contact.phone,
|
|
||||||
'phoneNumberPrefix': delivery_contact.phone_prefix
|
|
||||||
},
|
|
||||||
'email': delivery_contact.email,
|
|
||||||
}, 'shipmentDetails': {
|
|
||||||
'contentDescription': description_of_content,
|
|
||||||
'shipmentType': 'PARCEL',
|
|
||||||
'shipmentSettings': {
|
|
||||||
'saturdayDelivery': False,
|
|
||||||
'ddp': False,
|
|
||||||
'insurance': False,
|
|
||||||
'pickupOrder': False,
|
|
||||||
'pickupTailLift': False,
|
|
||||||
'deliveryTailLift': False,
|
|
||||||
'holidayDelivery': False,
|
|
||||||
},
|
|
||||||
'goodsValue': value_of_goods,
|
|
||||||
'parcelList': parcel_list,
|
|
||||||
'pickupInterval': {'date': pickup_date},
|
|
||||||
}}
|
|
||||||
try:
|
try:
|
||||||
available_services = []
|
available_services = []
|
||||||
response_data = requests.post(
|
response_data = requests.post(
|
||||||
@ -128,6 +80,7 @@ def get_letmeship_available_services(delivery_to_type, pickup_address,
|
|||||||
.format(response_data['message'])
|
.format(response_data['message'])
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_('Error occurred while fetching LetMeShip Prices: {0}')
|
_('Error occurred while fetching LetMeShip Prices: {0}')
|
||||||
.format(str(exc)),
|
.format(str(exc)),
|
||||||
@ -142,9 +95,7 @@ def create_letmeship_shipment(pickup_address, delivery_address, shipment_parcel,
|
|||||||
pickup_contact=None, delivery_contact=None):
|
pickup_contact=None, delivery_contact=None):
|
||||||
# Create a transaction at LetMeShip
|
# Create a transaction at LetMeShip
|
||||||
# LetMeShip have limit of 30 characters for Company field
|
# LetMeShip have limit of 30 characters for Company field
|
||||||
enabled = frappe.db.get_single_value('LetMeShip','enabled')
|
api_id, api_password, enabled = frappe.db.get_value('LetMeShip', 'LetMeShip', ['enabled', 'api_password', 'api_id'])
|
||||||
api_id = frappe.db.get_single_value('LetMeShip','api_id')
|
|
||||||
api_password = frappe.db.get_single_value('LetMeShip','api_password')
|
|
||||||
if not enabled or not api_id or not api_password:
|
if not enabled or not api_id or not api_password:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@ -162,6 +113,72 @@ def create_letmeship_shipment(pickup_address, delivery_address, shipment_parcel,
|
|||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Access-Control-Allow-Origin': 'string'
|
'Access-Control-Allow-Origin': 'string'
|
||||||
}
|
}
|
||||||
|
payload = generate_payload(
|
||||||
|
pickup_address=pickup_address,
|
||||||
|
pickup_contact=pickup_contact,
|
||||||
|
delivery_address=delivery_address,
|
||||||
|
delivery_contact=delivery_contact,
|
||||||
|
description_of_content=description_of_content,
|
||||||
|
value_of_goods=value_of_goods,
|
||||||
|
parcel_list=parcel_list,
|
||||||
|
pickup_date=pickup_date,
|
||||||
|
service_info=service_info,
|
||||||
|
tracking_notific_email=tracking_notific_email,
|
||||||
|
shipment_notific_email=shipment_notific_email
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
response_data = requests.post(
|
||||||
|
url=url,
|
||||||
|
auth=(api_id, api_password),
|
||||||
|
headers=headers,
|
||||||
|
data=json.dumps(payload)
|
||||||
|
)
|
||||||
|
response_data = json.loads(response_data.text)
|
||||||
|
if 'shipmentId' in response_data:
|
||||||
|
shipment_amount = response_data['service']['priceInfo']['totalPrice']
|
||||||
|
awb_number = ''
|
||||||
|
url = 'https://api.letmeship.com/v1/shipments/{id}'.format(id=response_data['shipmentId'])
|
||||||
|
tracking_response = requests.get(url, auth=(api_id, api_password),headers=headers)
|
||||||
|
tracking_response_data = json.loads(tracking_response.text)
|
||||||
|
if 'trackingData' in tracking_response_data:
|
||||||
|
for parcel in tracking_response_data['trackingData']['parcelList']:
|
||||||
|
if 'awbNumber' in parcel:
|
||||||
|
awb_number = parcel['awbNumber']
|
||||||
|
return {
|
||||||
|
'service_provider': LETMESHIP_PROVIDER,
|
||||||
|
'shipment_id': response_data['shipmentId'],
|
||||||
|
'carrier': service_info['carrier'],
|
||||||
|
'carrier_service': service_info['service_name'],
|
||||||
|
'shipment_amount': shipment_amount,
|
||||||
|
'awb_number': awb_number,
|
||||||
|
}
|
||||||
|
elif 'message' in response_data:
|
||||||
|
frappe.throw(
|
||||||
|
_('Error occurred while creating Shipment: {0}')
|
||||||
|
.format(response_data['message'])
|
||||||
|
)
|
||||||
|
except Exception as exc:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
|
frappe.msgprint(
|
||||||
|
_('Error occurred while creating Shipment: {0}')
|
||||||
|
.format(str(exc)),
|
||||||
|
indicator='orange',
|
||||||
|
alert=True
|
||||||
|
)
|
||||||
|
|
||||||
|
def generate_payload(
|
||||||
|
pickup_address,
|
||||||
|
pickup_contact,
|
||||||
|
delivery_address,
|
||||||
|
delivery_contact,
|
||||||
|
description_of_content,
|
||||||
|
value_of_goods,
|
||||||
|
parcel_list,
|
||||||
|
pickup_date,
|
||||||
|
service_info=None,
|
||||||
|
tracking_notific_email=None,
|
||||||
|
shipment_notific_email=None
|
||||||
|
):
|
||||||
payload = {
|
payload = {
|
||||||
'pickupInfo': {
|
'pickupInfo': {
|
||||||
'address': {
|
'address': {
|
||||||
@ -205,18 +222,6 @@ def create_letmeship_shipment(pickup_address, delivery_address, shipment_parcel,
|
|||||||
},
|
},
|
||||||
'email': delivery_contact.email,
|
'email': delivery_contact.email,
|
||||||
},
|
},
|
||||||
'service': {
|
|
||||||
'baseServiceDetails': {
|
|
||||||
'id': service_info['id'],
|
|
||||||
'name': service_info['service_name'],
|
|
||||||
'carrier': service_info['carrier'],
|
|
||||||
'priceInfo': service_info['price_info'],
|
|
||||||
},
|
|
||||||
'supportedExWorkType': [],
|
|
||||||
'messages': [''],
|
|
||||||
'description': '',
|
|
||||||
'serviceInfo': '',
|
|
||||||
},
|
|
||||||
'shipmentDetails': {
|
'shipmentDetails': {
|
||||||
'contentDescription': description_of_content,
|
'contentDescription': description_of_content,
|
||||||
'shipmentType': 'PARCEL',
|
'shipmentType': 'PARCEL',
|
||||||
@ -233,10 +238,24 @@ def create_letmeship_shipment(pickup_address, delivery_address, shipment_parcel,
|
|||||||
'parcelList': parcel_list,
|
'parcelList': parcel_list,
|
||||||
'pickupInterval': {
|
'pickupInterval': {
|
||||||
'date': pickup_date
|
'date': pickup_date
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if service_info:
|
||||||
|
payload['service'] = {
|
||||||
|
'baseServiceDetails': {
|
||||||
|
'id': service_info['id'],
|
||||||
|
'name': service_info['service_name'],
|
||||||
|
'carrier': service_info['carrier'],
|
||||||
|
'priceInfo': service_info['price_info'],
|
||||||
},
|
},
|
||||||
'contentDescription': description_of_content,
|
'supportedExWorkType': [],
|
||||||
},
|
'messages': [''],
|
||||||
'shipmentNotification': {
|
'description': '',
|
||||||
|
'serviceInfo': '',
|
||||||
|
}
|
||||||
|
payload['shipmentNotification'] = {
|
||||||
'trackingNotification': {
|
'trackingNotification': {
|
||||||
'deliveryNotification': True,
|
'deliveryNotification': True,
|
||||||
'problemNotification': True,
|
'problemNotification': True,
|
||||||
@ -247,77 +266,47 @@ def create_letmeship_shipment(pickup_address, delivery_address, shipment_parcel,
|
|||||||
'notificationText': '',
|
'notificationText': '',
|
||||||
'emails': [ shipment_notific_email ]
|
'emails': [ shipment_notific_email ]
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
'labelEmail': True,
|
payload['labelEmail'] = True
|
||||||
}
|
return payload
|
||||||
|
|
||||||
|
def get_letmeship_label(shipment_id):
|
||||||
try:
|
try:
|
||||||
response_data = requests.post(
|
# Retrieve shipment label from LetMeShip
|
||||||
url=url,
|
api_id = frappe.db.get_single_value('LetMeShip','api_id')
|
||||||
auth=(api_id, api_password),
|
api_password = frappe.db.get_single_value('LetMeShip','api_password')
|
||||||
headers=headers,
|
headers = {
|
||||||
data=json.dumps(payload)
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Access-Control-Allow-Origin': 'string'
|
||||||
|
}
|
||||||
|
url = 'https://api.letmeship.com/v1/shipments/{id}/documents?types=LABEL'\
|
||||||
|
.format(id=shipment_id)
|
||||||
|
shipment_label_response = requests.get(
|
||||||
|
url,
|
||||||
|
auth=(api_id,api_password),
|
||||||
|
headers=headers
|
||||||
)
|
)
|
||||||
response_data = json.loads(response_data.text)
|
shipment_label_response_data = json.loads(shipment_label_response.text)
|
||||||
if 'shipmentId' in response_data:
|
if 'documents' in shipment_label_response_data:
|
||||||
shipment_amount = response_data['service']['priceInfo']['totalPrice']
|
for label in shipment_label_response_data['documents']:
|
||||||
awb_number = ''
|
if 'data' in label:
|
||||||
url = 'https://api.letmeship.com/v1/shipments/{id}'.format(id=response_data['shipmentId'])
|
return json.dumps(label['data'])
|
||||||
tracking_response = requests.get(url, auth=(api_id, api_password),headers=headers)
|
else:
|
||||||
tracking_response_data = json.loads(tracking_response.text)
|
|
||||||
if 'trackingData' in tracking_response_data:
|
|
||||||
for parcel in tracking_response_data['trackingData']['parcelList']:
|
|
||||||
if 'awbNumber' in parcel:
|
|
||||||
awb_number = parcel['awbNumber']
|
|
||||||
return {
|
|
||||||
'service_provider': LETMESHIP_PROVIDER,
|
|
||||||
'shipment_id': response_data['shipmentId'],
|
|
||||||
'carrier': service_info['carrier'],
|
|
||||||
'carrier_service': service_info['service_name'],
|
|
||||||
'shipment_amount': shipment_amount,
|
|
||||||
'awb_number': awb_number,
|
|
||||||
}
|
|
||||||
elif 'message' in response_data:
|
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_('Error occurred while creating Shipment: {0}')
|
_('Error occurred while printing Shipment: {0}')
|
||||||
.format(response_data['message'])
|
.format(shipment_label_response_data['message'])
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_('Error occurred while creating Shipment: {0}')
|
_('Error occurred while printing Shipment: {0}')
|
||||||
.format(str(exc)),
|
.format(str(exc)),
|
||||||
indicator='orange',
|
indicator='orange',
|
||||||
alert=True
|
alert=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_letmeship_label(shipment_id):
|
|
||||||
# Retrieve shipment label from LetMeShip
|
|
||||||
api_id = frappe.db.get_single_value('LetMeShip','api_id')
|
|
||||||
api_password = frappe.db.get_single_value('LetMeShip','api_password')
|
|
||||||
headers = {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Access-Control-Allow-Origin': 'string'
|
|
||||||
}
|
|
||||||
url = 'https://api.letmeship.com/v1/shipments/{id}/documents?types=LABEL'\
|
|
||||||
.format(id=shipment_id)
|
|
||||||
shipment_label_response = requests.get(
|
|
||||||
url,
|
|
||||||
auth=(api_id,api_password),
|
|
||||||
headers=headers
|
|
||||||
)
|
|
||||||
shipment_label_response_data = json.loads(shipment_label_response.text)
|
|
||||||
if 'documents' in shipment_label_response_data:
|
|
||||||
for label in shipment_label_response_data['documents']:
|
|
||||||
if 'data' in label:
|
|
||||||
return json.dumps(label['data'])
|
|
||||||
else:
|
|
||||||
frappe.throw(
|
|
||||||
_('Error occurred while printing Shipment: {0}')
|
|
||||||
.format(shipment_label_response_data['message'])
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def get_letmeship_tracking_data(shipment_id):
|
def get_letmeship_tracking_data(shipment_id):
|
||||||
# return letmeship tracking data
|
# return letmeship tracking data
|
||||||
api_id = frappe.db.get_single_value('LetMeShip','api_id')
|
api_id = frappe.db.get_single_value('LetMeShip','api_id')
|
||||||
@ -359,6 +348,7 @@ def get_letmeship_tracking_data(shipment_id):
|
|||||||
.format(tracking_data['message'])
|
.format(tracking_data['message'])
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_('Error occurred while updating Shipment: {0}')
|
_('Error occurred while updating Shipment: {0}')
|
||||||
.format(str(exc)),
|
.format(str(exc)),
|
||||||
|
|||||||
@ -72,6 +72,7 @@ def get_packlink_available_services(pickup_address, delivery_address, shipment_p
|
|||||||
|
|
||||||
return available_services
|
return available_services
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_('Error occurred on Packlink: {0}')
|
_('Error occurred on Packlink: {0}')
|
||||||
.format(str(exc)), indicator='orange',
|
.format(str(exc)), indicator='orange',
|
||||||
@ -152,6 +153,7 @@ def create_packlink_shipment(pickup_address, delivery_address, shipment_parcel,
|
|||||||
'awb_number': '',
|
'awb_number': '',
|
||||||
}
|
}
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_('Error occurred while creating Shipment: {0}')
|
_('Error occurred while creating Shipment: {0}')
|
||||||
.format(str(exc)),
|
.format(str(exc)),
|
||||||
@ -215,6 +217,7 @@ def get_packlink_tracking_data(shipment_id):
|
|||||||
'tracking_url': tracking_url
|
'tracking_url': tracking_url
|
||||||
}
|
}
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
frappe.msgprint(_('Error occurred while updating Shipment: {0}').format(
|
frappe.msgprint(_('Error occurred while updating Shipment: {0}').format(
|
||||||
str(exc)), indicator='orange', alert=True)
|
str(exc)), indicator='orange', alert=True)
|
||||||
return []
|
return []
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "api_secret",
|
"fieldname": "api_secret",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Password",
|
||||||
"label": "API Secret",
|
"label": "API Secret",
|
||||||
"read_only_depends_on": "eval:doc.enabled == 0"
|
"read_only_depends_on": "eval:doc.enabled == 0"
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-08-18 09:48:50.836233",
|
"modified": "2020-10-21 10:28:57.710549",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "ERPNext Integrations",
|
"module": "ERPNext Integrations",
|
||||||
"name": "SendCloud",
|
"name": "SendCloud",
|
||||||
|
|||||||
@ -16,9 +16,7 @@ class SendCloud(Document):
|
|||||||
|
|
||||||
def get_sendcloud_available_services(delivery_address, shipment_parcel):
|
def get_sendcloud_available_services(delivery_address, shipment_parcel):
|
||||||
# Retrieve rates at SendCloud from specification stated.
|
# Retrieve rates at SendCloud from specification stated.
|
||||||
enabled = frappe.db.get_single_value('SendCloud', 'enabled')
|
api_key, api_secret, enabled = frappe.db.get_value('SendCloud', 'SendCloud', ['enabled', 'api_key', 'api_secret'])
|
||||||
api_key = frappe.db.get_single_value('SendCloud', 'api_key')
|
|
||||||
api_secret = frappe.db.get_single_value('SendCloud', 'api_secret')
|
|
||||||
if not enabled or not api_key or not api_secret:
|
if not enabled or not api_key or not api_secret:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@ -40,6 +38,7 @@ def get_sendcloud_available_services(delivery_address, shipment_parcel):
|
|||||||
available_services.append(available_service)
|
available_services.append(available_service)
|
||||||
return available_services
|
return available_services
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
frappe.msgprint(_('Error occurred on SendCloud: {0}').format(
|
frappe.msgprint(_('Error occurred on SendCloud: {0}').format(
|
||||||
str(exc)), indicator='orange', alert=True)
|
str(exc)), indicator='orange', alert=True)
|
||||||
|
|
||||||
@ -53,9 +52,7 @@ def create_sendcloud_shipment(
|
|||||||
value_of_goods
|
value_of_goods
|
||||||
):
|
):
|
||||||
# Create a transaction at SendCloud
|
# Create a transaction at SendCloud
|
||||||
enabled = frappe.db.get_single_value('SendCloud', 'enabled')
|
api_key, api_secret, enabled = frappe.db.get_value('SendCloud', 'SendCloud', ['enabled', 'api_key', 'api_secret'])
|
||||||
api_key = frappe.db.get_single_value('SendCloud', 'api_key')
|
|
||||||
api_secret = frappe.db.get_single_value('SendCloud', 'api_secret')
|
|
||||||
if not enabled or not api_key or not api_secret:
|
if not enabled or not api_key or not api_secret:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@ -105,6 +102,7 @@ def create_sendcloud_shipment(
|
|||||||
'awb_number': awb_number
|
'awb_number': awb_number
|
||||||
}
|
}
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
frappe.msgprint(_('Error occurred while creating Shipment: {0}').format(
|
frappe.msgprint(_('Error occurred while creating Shipment: {0}').format(
|
||||||
str(exc)), indicator='orange', alert=True)
|
str(exc)), indicator='orange', alert=True)
|
||||||
|
|
||||||
@ -130,17 +128,15 @@ def get_sendcloud_tracking_data(shipment_id):
|
|||||||
api_key = frappe.db.get_single_value('SendCloud', 'api_key')
|
api_key = frappe.db.get_single_value('SendCloud', 'api_key')
|
||||||
api_secret = frappe.db.get_single_value('SendCloud', 'api_secret')
|
api_secret = frappe.db.get_single_value('SendCloud', 'api_secret')
|
||||||
shipment_id_list = shipment_id.split(', ')
|
shipment_id_list = shipment_id.split(', ')
|
||||||
tracking_url = ''
|
|
||||||
awb_number = []
|
awb_number = []
|
||||||
tracking_status = []
|
tracking_status = []
|
||||||
tracking_status_info = []
|
tracking_status_info = []
|
||||||
|
tracking_urls = []
|
||||||
for ship_id in shipment_id_list:
|
for ship_id in shipment_id_list:
|
||||||
tracking_data_response = \
|
tracking_data_response = \
|
||||||
requests.get('https://panel.sendcloud.sc/api/v2/parcels/{id}'.format(id=ship_id), auth=(api_key, api_secret))
|
requests.get('https://panel.sendcloud.sc/api/v2/parcels/{id}'.format(id=ship_id), auth=(api_key, api_secret))
|
||||||
tracking_data = json.loads(tracking_data_response.text)
|
tracking_data = json.loads(tracking_data_response.text)
|
||||||
tracking_url_template = \
|
tracking_urls.append(tracking_data['parcel']['tracking_url'])
|
||||||
'<a href="{{ tracking_url }}" target="_blank"><b>{{ _("Click here to Track Shipment") }}</b></a><br>'
|
|
||||||
tracking_url += frappe.render_template(tracking_url_template, {'tracking_url': tracking_data['parcel']['tracking_url']})
|
|
||||||
awb_number.append(tracking_data['parcel']['tracking_number'])
|
awb_number.append(tracking_data['parcel']['tracking_number'])
|
||||||
tracking_status.append(tracking_data['parcel']['status']['message'])
|
tracking_status.append(tracking_data['parcel']['status']['message'])
|
||||||
tracking_status_info.append(tracking_data['parcel']['status']['message'])
|
tracking_status_info.append(tracking_data['parcel']['status']['message'])
|
||||||
@ -148,9 +144,10 @@ def get_sendcloud_tracking_data(shipment_id):
|
|||||||
'awb_number': ', '.join(awb_number),
|
'awb_number': ', '.join(awb_number),
|
||||||
'tracking_status': ', '.join(tracking_status),
|
'tracking_status': ', '.join(tracking_status),
|
||||||
'tracking_status_info': ', '.join(tracking_status_info),
|
'tracking_status_info': ', '.join(tracking_status_info),
|
||||||
'tracking_url': tracking_url
|
'tracking_url': ', '.join(tracking_urls)
|
||||||
}
|
}
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
frappe.msgprint(_('Error occurred while updating Shipment: {0}').format(
|
frappe.msgprint(_('Error occurred while updating Shipment: {0}').format(
|
||||||
str(exc)), indicator='orange', alert=True)
|
str(exc)), indicator='orange', alert=True)
|
||||||
|
|
||||||
|
|||||||
@ -68,6 +68,4 @@ def get_tracking_url(carrier, tracking_number):
|
|||||||
url_reference = frappe.get_value('Parcel Service', carrier, 'url_reference')
|
url_reference = frappe.get_value('Parcel Service', carrier, 'url_reference')
|
||||||
if url_reference:
|
if url_reference:
|
||||||
tracking_url = frappe.render_template(url_reference, {'tracking_number': tracking_number})
|
tracking_url = frappe.render_template(url_reference, {'tracking_number': tracking_number})
|
||||||
tracking_url_template = '<a href="{{ tracking_url }}" target="_blank"><b>{{ _("Click here to Track Shipment") }}</a></b>'
|
|
||||||
tracking_url = frappe.render_template(tracking_url_template, {'tracking_url': tracking_url})
|
|
||||||
return tracking_url
|
return tracking_url
|
||||||
|
|||||||
@ -575,22 +575,24 @@ def make_shipment(source_name, target_doc=None):
|
|||||||
user = frappe.db.get_value("User", frappe.session.user, ['email', 'full_name', 'phone', 'mobile_no'], as_dict=1)
|
user = frappe.db.get_value("User", frappe.session.user, ['email', 'full_name', 'phone', 'mobile_no'], as_dict=1)
|
||||||
target.pickup_contact_email = user.email
|
target.pickup_contact_email = user.email
|
||||||
pickup_contact_display = '{}'.format(user.full_name)
|
pickup_contact_display = '{}'.format(user.full_name)
|
||||||
if user.email:
|
if user:
|
||||||
pickup_contact_display += '<br>' + user.email
|
if user.email:
|
||||||
if user.phone:
|
pickup_contact_display += '<br>' + user.email
|
||||||
pickup_contact_display += '<br>' + user.phone
|
if user.phone:
|
||||||
if user.mobile_no and not user.phone:
|
pickup_contact_display += '<br>' + user.phone
|
||||||
pickup_contact_display += '<br>' + user.mobile_no
|
if user.mobile_no and not user.phone:
|
||||||
|
pickup_contact_display += '<br>' + user.mobile_no
|
||||||
target.pickup_contact = pickup_contact_display
|
target.pickup_contact = pickup_contact_display
|
||||||
|
|
||||||
contact = frappe.db.get_value("Contact", source.contact_person, ['email_id', 'phone', 'mobile_no'], as_dict=1)
|
contact = frappe.db.get_value("Contact", source.contact_person, ['email_id', 'phone', 'mobile_no'], as_dict=1)
|
||||||
delivery_contact_display = '{}'.format(source.contact_display)
|
delivery_contact_display = '{}'.format(source.contact_display)
|
||||||
if contact.email_id:
|
if contact:
|
||||||
delivery_contact_display += '<br>' + contact.email_id
|
if contact.email_id:
|
||||||
if contact.phone:
|
delivery_contact_display += '<br>' + contact.email_id
|
||||||
delivery_contact_display += '<br>' + contact.phone
|
if contact.phone:
|
||||||
if contact.mobile_no and not contact.phone:
|
delivery_contact_display += '<br>' + contact.phone
|
||||||
delivery_contact_display += '<br>' + contact.mobile_no
|
if contact.mobile_no and not contact.phone:
|
||||||
|
delivery_contact_display += '<br>' + contact.mobile_no
|
||||||
target.delivery_contact = delivery_contact_display
|
target.delivery_contact = delivery_contact_display
|
||||||
|
|
||||||
doclist = get_mapped_doc("Delivery Note", source_name, {
|
doclist = get_mapped_doc("Delivery Note", source_name, {
|
||||||
@ -612,7 +614,7 @@ def make_shipment(source_name, target_doc=None):
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Delivery Note Item": {
|
"Delivery Note Item": {
|
||||||
"doctype": "Shipment Delivery Notes",
|
"doctype": "Shipment Delivery Note",
|
||||||
"field_map": {
|
"field_map": {
|
||||||
"name": "prevdoc_detail_docname",
|
"name": "prevdoc_detail_docname",
|
||||||
"parent": "prevdoc_docname",
|
"parent": "prevdoc_docname",
|
||||||
|
|||||||
@ -1,67 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
|
|
||||||
# For license information, please see license.txt
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
import frappe
|
|
||||||
from frappe import _
|
|
||||||
import re
|
|
||||||
|
|
||||||
def get_address(address_name):
|
|
||||||
address = frappe.db.get_value('Address', address_name, [
|
|
||||||
'address_title',
|
|
||||||
'address_line1',
|
|
||||||
'address_line2',
|
|
||||||
'city',
|
|
||||||
'pincode',
|
|
||||||
'country',
|
|
||||||
], as_dict=1)
|
|
||||||
address.country_code = frappe.db.get_value('Country', address.country, 'code').upper()
|
|
||||||
if not address.pincode or address.pincode == '':
|
|
||||||
frappe.throw(_("Postal Code is mandatory to continue. </br> \
|
|
||||||
Please set Postal Code for Address <a href='#Form/Address/{0}'>{1}</a>"
|
|
||||||
).format(address_name, address_name))
|
|
||||||
address.pincode = address.pincode.replace(' ', '')
|
|
||||||
address.city = address.city.strip()
|
|
||||||
return address
|
|
||||||
|
|
||||||
def get_contact(contact_name):
|
|
||||||
contact = frappe.db.get_value('Contact', contact_name, [
|
|
||||||
'first_name',
|
|
||||||
'last_name',
|
|
||||||
'email_id',
|
|
||||||
'phone',
|
|
||||||
'mobile_no',
|
|
||||||
'gender',
|
|
||||||
], as_dict=1)
|
|
||||||
if not contact.last_name:
|
|
||||||
frappe.throw(_("Last Name is mandatory to continue. </br> \
|
|
||||||
Please set Last Name for Contact <a href='#Form/Contact/{0}'>{1}</a>"
|
|
||||||
).format(contact_name, contact_name))
|
|
||||||
if not contact.phone:
|
|
||||||
contact.phone = contact.mobile_no
|
|
||||||
contact.phone_prefix = contact.phone[:3]
|
|
||||||
contact.phone = re.sub('[^A-Za-z0-9]+', '', contact.phone[3:])
|
|
||||||
contact.email = contact.email_id
|
|
||||||
contact.title = 'MS'
|
|
||||||
if contact.gender == 'Male':
|
|
||||||
contact.title = 'MR'
|
|
||||||
return contact
|
|
||||||
|
|
||||||
def get_company_contact():
|
|
||||||
contact = frappe.db.get_value('User', frappe.session.user, [
|
|
||||||
'first_name',
|
|
||||||
'last_name',
|
|
||||||
'email',
|
|
||||||
'phone',
|
|
||||||
'mobile_no',
|
|
||||||
'gender',
|
|
||||||
], as_dict=1)
|
|
||||||
if not contact.phone:
|
|
||||||
contact.phone = contact.mobile_no
|
|
||||||
contact.phone_prefix = contact.phone[:3]
|
|
||||||
contact.phone = re.sub('[^A-Za-z0-9]+', '', contact.phone[3:])
|
|
||||||
contact.title = 'MS'
|
|
||||||
if contact.gender == 'Male':
|
|
||||||
contact.title = 'MR'
|
|
||||||
return contact
|
|
||||||
@ -2,11 +2,6 @@
|
|||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('Shipment', {
|
frappe.ui.form.on('Shipment', {
|
||||||
setup: function(frm) {
|
|
||||||
if (frm.doc.__islocal) {
|
|
||||||
frm.trigger('pickup_type');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
address_query: function(frm, link_doctype, link_name, is_your_company_address) {
|
address_query: function(frm, link_doctype, link_name, is_your_company_address) {
|
||||||
return {
|
return {
|
||||||
query: 'frappe.contacts.doctype.address.address.address_query',
|
query: 'frappe.contacts.doctype.address.address.address_query',
|
||||||
@ -99,7 +94,7 @@ frappe.ui.form.on('Shipment', {
|
|||||||
}
|
}
|
||||||
return frm.events.contact_query(frm, link_doctype, link_name);
|
return frm.events.contact_query(frm, link_doctype, link_name);
|
||||||
});
|
});
|
||||||
frm.set_query("delivery_note", "shipment_delivery_notes", function() {
|
frm.set_query("delivery_note", "shipment_delivery_note", function() {
|
||||||
let customer = '';
|
let customer = '';
|
||||||
if (frm.doc.delivery_to_type == "Customer") {
|
if (frm.doc.delivery_to_type == "Customer") {
|
||||||
customer = frm.doc.delivery_customer;
|
customer = frm.doc.delivery_customer;
|
||||||
@ -127,27 +122,22 @@ frappe.ui.form.on('Shipment', {
|
|||||||
if (frm.doc.shipment_id) {
|
if (frm.doc.shipment_id) {
|
||||||
frm.add_custom_button(__('Print Shipping Label'), function() {
|
frm.add_custom_button(__('Print Shipping Label'), function() {
|
||||||
return frm.events.print_shipping_label(frm);
|
return frm.events.print_shipping_label(frm);
|
||||||
});
|
}, __('Tools'));
|
||||||
if (frm.doc.tracking_status != 'Delivered') {
|
if (frm.doc.tracking_status != 'Delivered') {
|
||||||
frm.add_custom_button(__('Update Tracking'), function() {
|
frm.add_custom_button(__('Update Tracking'), function() {
|
||||||
return frm.events.update_tracking(frm, frm.doc.service_provider, frm.doc.shipment_id);
|
return frm.events.update_tracking(frm, frm.doc.service_provider, frm.doc.shipment_id);
|
||||||
});
|
}, __('Tools'));
|
||||||
|
|
||||||
|
frm.add_custom_button(__('Track Status'), function() {
|
||||||
|
const urls = frm.doc.tracking_url.split(', ');
|
||||||
|
urls.forEach(url => window.open(url));
|
||||||
|
}, __('View'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$('div[data-fieldname=pickup_address] > div > .clearfix').hide();
|
$('div[data-fieldname=pickup_address] > div > .clearfix').hide();
|
||||||
$('div[data-fieldname=pickup_contact] > div > .clearfix').hide();
|
$('div[data-fieldname=pickup_contact] > div > .clearfix').hide();
|
||||||
$('div[data-fieldname=delivery_address] > div > .clearfix').hide();
|
$('div[data-fieldname=delivery_address] > div > .clearfix').hide();
|
||||||
$('div[data-fieldname=delivery_contact] > div > .clearfix').hide();
|
$('div[data-fieldname=delivery_contact] > div > .clearfix').hide();
|
||||||
|
|
||||||
if (frm.doc.delivery_from_type != 'Company') {
|
|
||||||
frm.set_df_property("delivery_contact_name", "reqd", 1);
|
|
||||||
}
|
|
||||||
if (frm.doc.pickup_from_type != 'Company') {
|
|
||||||
frm.set_df_property("pickup_contact_name", "reqd", 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
frm.toggle_display("pickup_contact_name", false);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
before_save: function(frm) {
|
before_save: function(frm) {
|
||||||
if (frm.doc.delivery_to_type == 'Company') {
|
if (frm.doc.delivery_to_type == 'Company') {
|
||||||
@ -188,14 +178,10 @@ frappe.ui.form.on('Shipment', {
|
|||||||
pickup_from_type: function(frm) {
|
pickup_from_type: function(frm) {
|
||||||
if (frm.doc.pickup_from_type == 'Company') {
|
if (frm.doc.pickup_from_type == 'Company') {
|
||||||
frm.set_value("pickup_company", frappe.defaults.get_default('company'));
|
frm.set_value("pickup_company", frappe.defaults.get_default('company'));
|
||||||
frm.set_df_property("pickup_contact_name", "reqd", 0);
|
|
||||||
frm.set_value("pickup_customer", '');
|
frm.set_value("pickup_customer", '');
|
||||||
frm.set_value("pickup_supplier", '');
|
frm.set_value("pickup_supplier", '');
|
||||||
frm.toggle_display("pickup_contact_name", false);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
frm.set_df_property("pickup_contact_name", "reqd", 1);
|
|
||||||
frm.toggle_display("pickup_contact_name", true);
|
|
||||||
frm.trigger('clear_pickup_fields');
|
frm.trigger('clear_pickup_fields');
|
||||||
}
|
}
|
||||||
if (frm.doc.pickup_from_type == 'Customer') {
|
if (frm.doc.pickup_from_type == 'Customer') {
|
||||||
@ -206,20 +192,16 @@ frappe.ui.form.on('Shipment', {
|
|||||||
frm.set_value("pickup_customer", '');
|
frm.set_value("pickup_customer", '');
|
||||||
frm.set_value("pickup_company", '');
|
frm.set_value("pickup_company", '');
|
||||||
}
|
}
|
||||||
frm.events.remove_notific_child_table(frm, 'shipment_notification_subscriptions', 'Pickup');
|
frm.events.remove_notific_child_table(frm, 'shipment_notification_subscription', 'Pickup');
|
||||||
frm.events.remove_notific_child_table(frm, 'shipment_status_update_subscriptions', 'Pickup');
|
frm.events.remove_notific_child_table(frm, 'shipment_status_update_subscription', 'Pickup');
|
||||||
},
|
},
|
||||||
delivery_to_type: function(frm) {
|
delivery_to_type: function(frm) {
|
||||||
if (frm.doc.delivery_to_type == 'Company') {
|
if (frm.doc.delivery_to_type == 'Company') {
|
||||||
frm.set_value("delivery_company", frappe.defaults.get_default('company'));
|
frm.set_value("delivery_company", frappe.defaults.get_default('company'));
|
||||||
frm.set_df_property("delivery_contact_name", "reqd", 0);
|
|
||||||
frm.set_value("delivery_customer", '');
|
frm.set_value("delivery_customer", '');
|
||||||
frm.set_value("delivery_supplier", '');
|
frm.set_value("delivery_supplier", '');
|
||||||
frm.toggle_display("delivery_contact_name", false);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
frm.set_df_property("delivery_contact_name", "reqd", 1);
|
|
||||||
frm.toggle_display("delivery_contact_name", true);
|
|
||||||
frm.trigger('clear_delivery_fields');
|
frm.trigger('clear_delivery_fields');
|
||||||
}
|
}
|
||||||
if (frm.doc.delivery_to_type == 'Customer') {
|
if (frm.doc.delivery_to_type == 'Customer') {
|
||||||
@ -229,13 +211,13 @@ frappe.ui.form.on('Shipment', {
|
|||||||
if (frm.doc.delivery_to_type == 'Supplier') {
|
if (frm.doc.delivery_to_type == 'Supplier') {
|
||||||
frm.set_value("delivery_customer", '');
|
frm.set_value("delivery_customer", '');
|
||||||
frm.set_value("delivery_company", '');
|
frm.set_value("delivery_company", '');
|
||||||
frm.toggle_display("shipment_delivery_notes", false);
|
frm.toggle_display("shipment_delivery_note", false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
frm.toggle_display("shipment_delivery_notes", true);
|
frm.toggle_display("shipment_delivery_note", true);
|
||||||
}
|
}
|
||||||
frm.events.remove_notific_child_table(frm, 'shipment_notification_subscriptions', 'Delivery');
|
frm.events.remove_notific_child_table(frm, 'shipment_notification_subscription', 'Delivery');
|
||||||
frm.events.remove_notific_child_table(frm, 'shipment_status_update_subscriptions', 'Delivery');
|
frm.events.remove_notific_child_table(frm, 'shipment_status_update_subscription', 'Delivery');
|
||||||
},
|
},
|
||||||
delivery_address_name: function(frm) {
|
delivery_address_name: function(frm) {
|
||||||
if (frm.doc.delivery_to_type == 'Company') {
|
if (frm.doc.delivery_to_type == 'Company') {
|
||||||
@ -307,6 +289,51 @@ frappe.ui.form.on('Shipment', {
|
|||||||
frm.events.get_contact_display(frm, frm.doc.pickup_contact_name, 'Pickup');
|
frm.events.get_contact_display(frm, frm.doc.pickup_contact_name, 'Pickup');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
pickup_contact_person: function(frm) {
|
||||||
|
if (frm.doc.pickup_contact_person) {
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.stock.doctype.shipment.shipment.get_company_contact",
|
||||||
|
args: { user: frm.doc.pickup_contact_person },
|
||||||
|
callback: function({ message }) {
|
||||||
|
const r = message;
|
||||||
|
let contact_display = `${r.first_name} ${r.last_name}`;
|
||||||
|
if (r.email) {
|
||||||
|
contact_display += `<br>${ r.email }`;
|
||||||
|
frm.set_value('pickup_contact_email', r.email);
|
||||||
|
}
|
||||||
|
if (r.phone) {
|
||||||
|
contact_display += `<br>${ r.phone }`;
|
||||||
|
}
|
||||||
|
if (r.mobile_no && !r.phone) {
|
||||||
|
contact_display += `<br>${ r.mobile_no }`;
|
||||||
|
}
|
||||||
|
frm.set_value('pickup_contact', contact_display);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (frm.doc.pickup_from_type === 'Company') {
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.stock.doctype.shipment.shipment.get_company_contact",
|
||||||
|
args: { user: frappe.session.user },
|
||||||
|
callback: function({ message }) {
|
||||||
|
const r = message;
|
||||||
|
let contact_display = `${r.first_name} ${r.last_name}`;
|
||||||
|
if (r.email) {
|
||||||
|
contact_display += `<br>${ r.email }`;
|
||||||
|
frm.set_value('pickup_contact_email', r.email);
|
||||||
|
}
|
||||||
|
if (r.phone) {
|
||||||
|
contact_display += `<br>${ r.phone }`;
|
||||||
|
}
|
||||||
|
if (r.mobile_no && !r.phone) {
|
||||||
|
contact_display += `<br>${ r.mobile_no }`;
|
||||||
|
}
|
||||||
|
frm.set_value('pickup_contact', contact_display);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
set_company_contact: function(frm, delivery_type) {
|
set_company_contact: function(frm, delivery_type) {
|
||||||
frappe.db.get_value('User', { name: frappe.session.user }, ['full_name', 'last_name', 'email', 'phone', 'mobile_no'], (r) => {
|
frappe.db.get_value('User', { name: frappe.session.user }, ['full_name', 'last_name', 'email', 'phone', 'mobile_no'], (r) => {
|
||||||
if (!(r.last_name && r.email && (r.phone || r.mobile_no))) {
|
if (!(r.last_name && r.email && (r.phone || r.mobile_no))) {
|
||||||
@ -344,6 +371,7 @@ frappe.ui.form.on('Shipment', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
frm.set_value('pickup_contact_person', frappe.session.user);
|
||||||
},
|
},
|
||||||
pickup_company: function(frm) {
|
pickup_company: function(frm) {
|
||||||
if (frm.doc.pickup_from_type == 'Company' && frm.doc.pickup_company) {
|
if (frm.doc.pickup_from_type == 'Company' && frm.doc.pickup_company) {
|
||||||
@ -372,14 +400,12 @@ frappe.ui.form.on('Shipment', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
pickup_customer: function(frm) {
|
pickup_customer: function(frm) {
|
||||||
frm.trigger('clear_pickup_fields');
|
|
||||||
if (frm.doc.pickup_customer) {
|
if (frm.doc.pickup_customer) {
|
||||||
frm.events.set_address_name(frm,'Customer',frm.doc.pickup_customer, 'Pickup');
|
frm.events.set_address_name(frm,'Customer',frm.doc.pickup_customer, 'Pickup');
|
||||||
frm.events.set_contact_name(frm,'Customer',frm.doc.pickup_customer, 'Pickup');
|
frm.events.set_contact_name(frm,'Customer',frm.doc.pickup_customer, 'Pickup');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pickup_supplier: function(frm) {
|
pickup_supplier: function(frm) {
|
||||||
frm.trigger('clear_pickup_fields');
|
|
||||||
if (frm.doc.pickup_supplier) {
|
if (frm.doc.pickup_supplier) {
|
||||||
frm.events.set_address_name(frm,'Supplier',frm.doc.pickup_supplier, 'Pickup');
|
frm.events.set_address_name(frm,'Supplier',frm.doc.pickup_supplier, 'Pickup');
|
||||||
frm.events.set_contact_name(frm,'Supplier',frm.doc.pickup_supplier, 'Pickup');
|
frm.events.set_contact_name(frm,'Supplier',frm.doc.pickup_supplier, 'Pickup');
|
||||||
@ -438,7 +464,7 @@ frappe.ui.form.on('Shipment', {
|
|||||||
},
|
},
|
||||||
pickup_date: function(frm) {
|
pickup_date: function(frm) {
|
||||||
if (frm.doc.pickup_date < frappe.datetime.get_today()) {
|
if (frm.doc.pickup_date < frappe.datetime.get_today()) {
|
||||||
frappe.throw(__("Pickup Date cannot be in the past"));
|
frappe.throw(__("Pickup Date cannot be before this day"));
|
||||||
}
|
}
|
||||||
if (frm.doc.pickup_date == frappe.datetime.get_today()) {
|
if (frm.doc.pickup_date == frappe.datetime.get_today()) {
|
||||||
var pickup_time = frm.events.get_pickup_time(frm);
|
var pickup_time = frm.events.get_pickup_time(frm);
|
||||||
@ -487,65 +513,63 @@ frappe.ui.form.on('Shipment', {
|
|||||||
frm.set_value("pickup_to", pickup_to);
|
frm.set_value("pickup_to", pickup_to);
|
||||||
},
|
},
|
||||||
clear_pickup_fields: function(frm) {
|
clear_pickup_fields: function(frm) {
|
||||||
frm.set_value("pickup_address_name", '');
|
let fields = ["pickup_address_name", "pickup_contact_name", "pickup_address", "pickup_contact", "pickup_contact_email", "pickup_contact_person"];
|
||||||
frm.set_value("pickup_contact_name", '');
|
for (let field of fields){
|
||||||
frm.set_value("pickup_address", '');
|
frm.set_value(field, '');
|
||||||
frm.set_value("pickup_contact", '');
|
}
|
||||||
frm.set_value("pickup_contact_email", '');
|
|
||||||
},
|
},
|
||||||
clear_delivery_fields: function(frm) {
|
clear_delivery_fields: function(frm) {
|
||||||
frm.set_value("delivery_address_name", '');
|
let fields = ["delivery_address_name", "delivery_contact_name", "delivery_address", "delivery_contact", "delivery_contact_email"];
|
||||||
frm.set_value("delivery_contact_name", '');
|
for (let field of fields){
|
||||||
frm.set_value("delivery_address", '');
|
frm.set_value(field, '');
|
||||||
frm.set_value("delivery_contact", '');
|
}
|
||||||
frm.set_value("delivery_contact_email", '');
|
|
||||||
},
|
},
|
||||||
pickup_from_send_shipping_notification: function(frm, cdt, cdn) {
|
pickup_from_send_shipping_notification: function(frm, cdt, cdn) {
|
||||||
if (frm.doc.pickup_contact_email && frm.doc.pickup_from_send_shipping_notification
|
if (frm.doc.pickup_contact_email && frm.doc.pickup_from_send_shipping_notification
|
||||||
&& !validate_duplicate(frm, 'shipment_notification_subscriptions', frm.doc.pickup_contact_email, locals[cdt][cdn].idx)) {
|
&& !validate_duplicate(frm, 'shipment_notification_subscription', frm.doc.pickup_contact_email, locals[cdt][cdn].idx)) {
|
||||||
let row = frappe.model.add_child(frm.doc, "Shipment Notification Subscriptions", "shipment_notification_subscriptions");
|
let row = frappe.model.add_child(frm.doc, "Shipment Notification Subscription", "shipment_notification_subscription");
|
||||||
row.email = frm.doc.pickup_contact_email;
|
row.email = frm.doc.pickup_contact_email;
|
||||||
frm.refresh_fields("shipment_notification_subscriptions");
|
frm.refresh_fields("shipment_notification_subscription");
|
||||||
}
|
}
|
||||||
if (!frm.doc.pickup_from_send_shipping_notification) {
|
if (!frm.doc.pickup_from_send_shipping_notification) {
|
||||||
frm.events.remove_email_row(frm, 'shipment_notification_subscriptions', frm.doc.pickup_contact_email);
|
frm.events.remove_email_row(frm, 'shipment_notification_subscription', frm.doc.pickup_contact_email);
|
||||||
frm.refresh_fields("shipment_notification_subscriptions");
|
frm.refresh_fields("shipment_notification_subscription");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pickup_from_subscribe_to_status_updates: function(frm, cdt, cdn) {
|
pickup_from_subscribe_to_status_updates: function(frm, cdt, cdn) {
|
||||||
if (frm.doc.pickup_contact_email && frm.doc.pickup_from_subscribe_to_status_updates
|
if (frm.doc.pickup_contact_email && frm.doc.pickup_from_subscribe_to_status_updates
|
||||||
&& !validate_duplicate(frm, 'shipment_status_update_subscriptions', frm.doc.pickup_contact_email, locals[cdt][cdn].idx)) {
|
&& !validate_duplicate(frm, 'shipment_status_update_subscription', frm.doc.pickup_contact_email, locals[cdt][cdn].idx)) {
|
||||||
let row = frappe.model.add_child(frm.doc, "Shipment Status Update Subscriptions", "shipment_status_update_subscriptions");
|
let row = frappe.model.add_child(frm.doc, "Shipment Status Update Subscription", "shipment_status_update_subscription");
|
||||||
row.email = frm.doc.pickup_contact_email;
|
row.email = frm.doc.pickup_contact_email;
|
||||||
frm.refresh_fields("shipment_status_update_subscriptions");
|
frm.refresh_fields("shipment_status_update_subscription");
|
||||||
}
|
}
|
||||||
if (!frm.doc.pickup_from_subscribe_to_status_updates) {
|
if (!frm.doc.pickup_from_subscribe_to_status_updates) {
|
||||||
frm.events.remove_email_row(frm, 'shipment_status_update_subscriptions', frm.doc.pickup_contact_email);
|
frm.events.remove_email_row(frm, 'shipment_status_update_subscription', frm.doc.pickup_contact_email);
|
||||||
frm.refresh_fields("shipment_status_update_subscriptions");
|
frm.refresh_fields("shipment_status_update_subscription");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
delivery_to_send_shipping_notification: function(frm, cdt, cdn) {
|
delivery_to_send_shipping_notification: function(frm, cdt, cdn) {
|
||||||
if (frm.doc.delivery_contact_email && frm.doc.delivery_to_send_shipping_notification
|
if (frm.doc.delivery_contact_email && frm.doc.delivery_to_send_shipping_notification
|
||||||
&& !validate_duplicate(frm, 'shipment_notification_subscriptions', frm.doc.delivery_contact_email, locals[cdt][cdn].idx)){
|
&& !validate_duplicate(frm, 'shipment_notification_subscription', frm.doc.delivery_contact_email, locals[cdt][cdn].idx)){
|
||||||
let row = frappe.model.add_child(frm.doc, "Shipment Notification Subscriptions", "shipment_notification_subscriptions");
|
let row = frappe.model.add_child(frm.doc, "Shipment Notification Subscription", "shipment_notification_subscription");
|
||||||
row.email = frm.doc.delivery_contact_email;
|
row.email = frm.doc.delivery_contact_email;
|
||||||
frm.refresh_fields("shipment_notification_subscriptions");
|
frm.refresh_fields("shipment_notification_subscription");
|
||||||
}
|
}
|
||||||
if (!frm.doc.delivery_to_send_shipping_notification) {
|
if (!frm.doc.delivery_to_send_shipping_notification) {
|
||||||
frm.events.remove_email_row(frm, 'shipment_notification_subscriptions', frm.doc.delivery_contact_email);
|
frm.events.remove_email_row(frm, 'shipment_notification_subscription', frm.doc.delivery_contact_email);
|
||||||
frm.refresh_fields("shipment_notification_subscriptions");
|
frm.refresh_fields("shipment_notification_subscription");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
delivery_to_subscribe_to_status_updates: function(frm, cdt, cdn) {
|
delivery_to_subscribe_to_status_updates: function(frm, cdt, cdn) {
|
||||||
if (frm.doc.delivery_contact_email && frm.doc.delivery_to_subscribe_to_status_updates
|
if (frm.doc.delivery_contact_email && frm.doc.delivery_to_subscribe_to_status_updates
|
||||||
&& !validate_duplicate(frm, 'shipment_status_update_subscriptions', frm.doc.delivery_contact_email, locals[cdt][cdn].idx)) {
|
&& !validate_duplicate(frm, 'shipment_status_update_subscription', frm.doc.delivery_contact_email, locals[cdt][cdn].idx)) {
|
||||||
let row = frappe.model.add_child(frm.doc, "Shipment Status Update Subscriptions", "shipment_status_update_subscriptions");
|
let row = frappe.model.add_child(frm.doc, "Shipment Status Update Subscription", "shipment_status_update_subscription");
|
||||||
row.email = frm.doc.delivery_contact_email;
|
row.email = frm.doc.delivery_contact_email;
|
||||||
frm.refresh_fields("shipment_status_update_subscriptions");
|
frm.refresh_fields("shipment_status_update_subscription");
|
||||||
}
|
}
|
||||||
if (!frm.doc.delivery_to_subscribe_to_status_updates) {
|
if (!frm.doc.delivery_to_subscribe_to_status_updates) {
|
||||||
frm.events.remove_email_row(frm, 'shipment_status_update_subscriptions', frm.doc.delivery_contact_email);
|
frm.events.remove_email_row(frm, 'shipment_status_update_subscription', frm.doc.delivery_contact_email);
|
||||||
frm.refresh_fields("shipment_status_update_subscriptions");
|
frm.refresh_fields("shipment_status_update_subscription");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
remove_email_row: function(frm, table, fieldname) {
|
remove_email_row: function(frm, table, fieldname) {
|
||||||
@ -589,7 +613,7 @@ frappe.ui.form.on('Shipment', {
|
|||||||
shipment_parcel: frm.doc.shipment_parcel,
|
shipment_parcel: frm.doc.shipment_parcel,
|
||||||
description_of_content: frm.doc.description_of_content,
|
description_of_content: frm.doc.description_of_content,
|
||||||
pickup_date: frm.doc.pickup_date,
|
pickup_date: frm.doc.pickup_date,
|
||||||
pickup_contact_name: frm.doc.pickup_contact_name,
|
pickup_contact_name: frm.doc.pickup_from_type === 'Company' ? frm.doc.pickup_contact_person : frm.doc.pickup_contact_name,
|
||||||
delivery_contact_name: frm.doc.delivery_contact_name,
|
delivery_contact_name: frm.doc.delivery_contact_name,
|
||||||
value_of_goods: frm.doc.value_of_goods
|
value_of_goods: frm.doc.value_of_goods
|
||||||
},
|
},
|
||||||
@ -639,7 +663,7 @@ frappe.ui.form.on('Shipment', {
|
|||||||
},
|
},
|
||||||
update_tracking: function(frm, service_provider, shipment_id) {
|
update_tracking: function(frm, service_provider, shipment_id) {
|
||||||
let delivery_notes = [];
|
let delivery_notes = [];
|
||||||
(frm.doc.shipment_delivery_notes || []).forEach((d) => {
|
(frm.doc.shipment_delivery_note || []).forEach((d) => {
|
||||||
delivery_notes.push(d.delivery_note);
|
delivery_notes.push(d.delivery_note);
|
||||||
});
|
});
|
||||||
frappe.call({
|
frappe.call({
|
||||||
@ -661,14 +685,13 @@ frappe.ui.form.on('Shipment', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on('Shipment Delivery Notes', {
|
frappe.ui.form.on('Shipment Delivery Note', {
|
||||||
delivery_note: function(frm, cdt, cdn) {
|
delivery_note: function(frm, cdt, cdn) {
|
||||||
let row = locals[cdt][cdn];
|
let row = locals[cdt][cdn];
|
||||||
if (row.delivery_note) {
|
if (row.delivery_note) {
|
||||||
let row_index = row.idx - 1;
|
let row_index = row.idx - 1;
|
||||||
if(validate_duplicate(frm, 'shipment_delivery_notes', row.delivery_note, row_index)) {
|
if(validate_duplicate(frm, 'shipment_delivery_note', row.delivery_note, row_index)) {
|
||||||
cur_frm.get_field('shipment_delivery_notes').grid.grid_rows[row_index].remove();
|
frappe.throw(__(`You have entered a duplicate Delivery Note on Row ${row.idx}. Please rectify and try again.`));
|
||||||
frappe.throw(__(`You have entered duplicate Delivery Notes. Please rectify and try again.`));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -683,29 +706,27 @@ frappe.ui.form.on('Shipment Delivery Notes', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var validate_duplicate = function(frm, table, fieldname, index){
|
var validate_duplicate = function(frm, table, fieldname, index){
|
||||||
let duplicate = false;
|
return (
|
||||||
$.each(frm.doc[table], function(i, detail) {
|
table === 'shipment_delivery_note'
|
||||||
// Email duplicate validation
|
? frm.doc[table].some((detail, i) => detail.delivery_note === fieldname && !(index === i))
|
||||||
if(detail.email === fieldname && !(index === i)) {
|
: frm.doc[table].some((detail, i) => detail.email === fieldname && !(index === i))
|
||||||
duplicate = true;
|
);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delivery Note duplicate validation
|
|
||||||
if(detail.delivery_note === fieldname && !(index === i)) {
|
|
||||||
duplicate = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return duplicate;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function select_from_available_services(frm, available_services) {
|
function select_from_available_services(frm, available_services) {
|
||||||
var headers = [ __("Service Provider"), __("Carrier"), __("Carrier’s Service"), __("Price"), "" ];
|
var headers = [ __("Service Provider"), __("Carrier"), __("Carrier’s Service"), __("Price"), "" ];
|
||||||
cur_frm.render_available_services = function(d, headers, data){
|
cur_frm.render_available_services = function(d, headers, data){
|
||||||
|
const arranged_data = data.reduce((prev, curr) => {
|
||||||
|
if (curr.is_preferred) {
|
||||||
|
prev.preferred_services.push(curr);
|
||||||
|
} else {
|
||||||
|
prev.other_services.push(curr);
|
||||||
|
}
|
||||||
|
return prev;
|
||||||
|
}, { preferred_services: [], other_services: [] });
|
||||||
d.fields_dict.available_services.$wrapper.html(
|
d.fields_dict.available_services.$wrapper.html(
|
||||||
frappe.render_template('shipment_service_selector',
|
frappe.render_template('shipment_service_selector',
|
||||||
{'header_columns': headers, 'data': data}
|
{'header_columns': headers, 'data': arranged_data}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -722,18 +743,18 @@ function select_from_available_services(frm, available_services) {
|
|||||||
cur_frm.render_available_services(d, headers, available_services);
|
cur_frm.render_available_services(d, headers, available_services);
|
||||||
let shipment_notific_email = [];
|
let shipment_notific_email = [];
|
||||||
let tracking_notific_email = [];
|
let tracking_notific_email = [];
|
||||||
(frm.doc.shipment_notification_subscriptions || []).forEach((d) => {
|
(frm.doc.shipment_notification_subscription || []).forEach((d) => {
|
||||||
if (!d.unsubscribed) {
|
if (!d.unsubscribed) {
|
||||||
shipment_notific_email.push(d.email);
|
shipment_notific_email.push(d.email);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
(frm.doc.shipment_status_update_subscriptions || []).forEach((d) => {
|
(frm.doc.shipment_status_update_subscription || []).forEach((d) => {
|
||||||
if (!d.unsubscribed) {
|
if (!d.unsubscribed) {
|
||||||
tracking_notific_email.push(d.email);
|
tracking_notific_email.push(d.email);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let delivery_notes = [];
|
let delivery_notes = [];
|
||||||
(frm.doc.shipment_delivery_notes || []).forEach((d) => {
|
(frm.doc.shipment_delivery_note || []).forEach((d) => {
|
||||||
delivery_notes.push(d.delivery_note);
|
delivery_notes.push(d.delivery_note);
|
||||||
});
|
});
|
||||||
cur_frm.select_row = function(service_data){
|
cur_frm.select_row = function(service_data){
|
||||||
@ -750,7 +771,7 @@ function select_from_available_services(frm, available_services) {
|
|||||||
shipment_parcel: frm.doc.shipment_parcel,
|
shipment_parcel: frm.doc.shipment_parcel,
|
||||||
description_of_content: frm.doc.description_of_content,
|
description_of_content: frm.doc.description_of_content,
|
||||||
pickup_date: frm.doc.pickup_date,
|
pickup_date: frm.doc.pickup_date,
|
||||||
pickup_contact_name: frm.doc.pickup_contact_name,
|
pickup_contact_name: frm.doc.pickup_from_type === 'Company' ? frm.doc.pickup_contact_person : frm.doc.pickup_contact_name,
|
||||||
delivery_contact_name: frm.doc.delivery_contact_name,
|
delivery_contact_name: frm.doc.delivery_contact_name,
|
||||||
value_of_goods: frm.doc.value_of_goods,
|
value_of_goods: frm.doc.value_of_goods,
|
||||||
service_data: service_data,
|
service_data: service_data,
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
"pickup",
|
"pickup",
|
||||||
"pickup_address_name",
|
"pickup_address_name",
|
||||||
"pickup_address",
|
"pickup_address",
|
||||||
|
"pickup_contact_person",
|
||||||
"pickup_contact_name",
|
"pickup_contact_name",
|
||||||
"pickup_contact_email",
|
"pickup_contact_email",
|
||||||
"pickup_contact",
|
"pickup_contact",
|
||||||
@ -32,17 +33,17 @@
|
|||||||
"notification_details_section",
|
"notification_details_section",
|
||||||
"pickup_from_send_shipping_notification",
|
"pickup_from_send_shipping_notification",
|
||||||
"pickup_from_subscribe_to_status_updates",
|
"pickup_from_subscribe_to_status_updates",
|
||||||
"shipment_notification_subscriptions",
|
"shipment_notification_subscription",
|
||||||
"column_break_27",
|
"column_break_27",
|
||||||
"delivery_to_send_shipping_notification",
|
"delivery_to_send_shipping_notification",
|
||||||
"delivery_to_subscribe_to_status_updates",
|
"delivery_to_subscribe_to_status_updates",
|
||||||
"shipment_status_update_subscriptions",
|
"shipment_status_update_subscription",
|
||||||
"parcels_section",
|
"parcels_section",
|
||||||
"shipment_parcel",
|
"shipment_parcel",
|
||||||
"parcel_template",
|
"parcel_template",
|
||||||
"add_template",
|
"add_template",
|
||||||
"column_break_28",
|
"column_break_28",
|
||||||
"shipment_delivery_notes",
|
"shipment_delivery_note",
|
||||||
"shipment_details_section",
|
"shipment_details_section",
|
||||||
"pallets",
|
"pallets",
|
||||||
"value_of_goods",
|
"value_of_goods",
|
||||||
@ -125,10 +126,11 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval: doc.pickup_customer || doc.pickup_supplier || doc.pickup_from_type == \"Company\"",
|
"depends_on": "eval: doc.pickup_customer || doc.pickup_supplier || doc.pickup_from_type !== \"Company\"",
|
||||||
"fieldname": "pickup_contact_name",
|
"fieldname": "pickup_contact_name",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Contact",
|
"label": "Contact",
|
||||||
|
"mandatory_depends_on": "eval: doc.pickup_from_type !== 'Company'",
|
||||||
"options": "Contact"
|
"options": "Contact"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -206,6 +208,7 @@
|
|||||||
"fieldname": "delivery_contact_name",
|
"fieldname": "delivery_contact_name",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Contact",
|
"label": "Contact",
|
||||||
|
"mandatory_depends_on": "eval: doc.delivery_from_type !== 'Company'",
|
||||||
"options": "Contact"
|
"options": "Contact"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -239,12 +242,6 @@
|
|||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Subscribe to status updates"
|
"label": "Subscribe to status updates"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "shipment_notification_subscriptions",
|
|
||||||
"fieldtype": "Table",
|
|
||||||
"label": "Shipment Notification Subscriptions",
|
|
||||||
"options": "Shipment Notification Subscriptions"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_27",
|
"fieldname": "column_break_27",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
@ -261,12 +258,6 @@
|
|||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Subscribe to status updates"
|
"label": "Subscribe to status updates"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "shipment_status_update_subscriptions",
|
|
||||||
"fieldtype": "Table",
|
|
||||||
"label": "Shipment Status Update Subscriptions",
|
|
||||||
"options": "Shipment Status Update Subscriptions"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "parcels_section",
|
"fieldname": "parcels_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
@ -293,12 +284,6 @@
|
|||||||
"fieldname": "column_break_28",
|
"fieldname": "column_break_28",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "shipment_delivery_notes",
|
|
||||||
"fieldtype": "Table",
|
|
||||||
"label": "Shipment Delivery Notes",
|
|
||||||
"options": "Shipment Delivery Notes"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "shipment_details_section",
|
"fieldname": "shipment_details_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
@ -328,16 +313,14 @@
|
|||||||
{
|
{
|
||||||
"default": "09:00",
|
"default": "09:00",
|
||||||
"fieldname": "pickup_from",
|
"fieldname": "pickup_from",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Time",
|
||||||
"label": "Pickup from",
|
"label": "Pickup from"
|
||||||
"options": "09:00\n09:30\n10:00\n10:30\n11:00\n11:30\n12:00\n12:30\n13:00\n13:30\n14:00\n14:30\n15:00\n15:30\n16:00\n16:30\n17:00\n17:30\n18:00\n18:30\n19:00"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "17:00",
|
"default": "17:00",
|
||||||
"fieldname": "pickup_to",
|
"fieldname": "pickup_to",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Time",
|
||||||
"label": "Pickup to",
|
"label": "Pickup to"
|
||||||
"options": "09:00\n09:30\n10:00\n10:30\n11:00\n11:30\n12:00\n12:30\n13:00\n13:30\n14:00\n14:30\n15:00\n15:30\n16:00\n16:30\n17:00\n17:30\n18:00\n18:30\n19:00"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_36",
|
"fieldname": "column_break_36",
|
||||||
@ -374,13 +357,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "service_provider",
|
"fieldname": "service_provider",
|
||||||
"fieldtype": "Read Only",
|
"fieldtype": "Data",
|
||||||
"label": "Service Provider"
|
"label": "Service Provider",
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "shipment_id",
|
"fieldname": "shipment_id",
|
||||||
"fieldtype": "Read Only",
|
"fieldtype": "Data",
|
||||||
"label": "Shipment ID"
|
"label": "Shipment ID",
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "shipment_amount",
|
"fieldname": "shipment_amount",
|
||||||
@ -399,23 +384,27 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "tracking_url",
|
"fieldname": "tracking_url",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
|
"hidden": 1,
|
||||||
"label": "Tracking URL",
|
"label": "Tracking URL",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "carrier",
|
"fieldname": "carrier",
|
||||||
"fieldtype": "Read Only",
|
"fieldtype": "Data",
|
||||||
"label": "Carrier"
|
"label": "Carrier",
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "carrier_service",
|
"fieldname": "carrier_service",
|
||||||
"fieldtype": "Read Only",
|
"fieldtype": "Data",
|
||||||
"label": "Carrier Service"
|
"label": "Carrier Service",
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "awb_number",
|
"fieldname": "awb_number",
|
||||||
"fieldtype": "Read Only",
|
"fieldtype": "Data",
|
||||||
"label": "AWB Number"
|
"label": "AWB Number",
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "tracking_status",
|
"fieldname": "tracking_status",
|
||||||
@ -449,11 +438,37 @@
|
|||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Incoterm",
|
"label": "Incoterm",
|
||||||
"options": "EXW (Ex Works)\nFCA (Free Carrier)\nCPT (Carriage Paid To)\nCIP (Carriage and Insurance Paid to)\nDPU (Delivered At Place Unloaded)\nDAP (Delivered At Place)\nDDP (Delivered Duty Paid)"
|
"options": "EXW (Ex Works)\nFCA (Free Carrier)\nCPT (Carriage Paid To)\nCIP (Carriage and Insurance Paid to)\nDPU (Delivered At Place Unloaded)\nDAP (Delivered At Place)\nDDP (Delivered Duty Paid)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "shipment_delivery_note",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"label": "Shipment Delivery Note",
|
||||||
|
"options": "Shipment Delivery Note"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "shipment_notification_subscription",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"label": "Shipment Notification Subscription",
|
||||||
|
"options": "Shipment Notification Subscription"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "shipment_status_update_subscription",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"label": "Shipment Status Update Subscription",
|
||||||
|
"options": "Shipment Status Update Subscription"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "eval:doc.pickup_from_type === 'Company'",
|
||||||
|
"fieldname": "pickup_contact_person",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Pickup Contact Person",
|
||||||
|
"mandatory_depends_on": "eval:doc.pickup_from_type === 'Company'",
|
||||||
|
"options": "User"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-07-24 11:44:30.904612",
|
"modified": "2020-09-29 13:59:50.241744",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Shipment",
|
"name": "Shipment",
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
import json
|
import json
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
from frappe.utils import flt
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from erpnext.accounts.party import get_party_shipping_address
|
from erpnext.accounts.party import get_party_shipping_address
|
||||||
from frappe.contacts.doctype.contact.contact import get_default_contact
|
from frappe.contacts.doctype.contact.contact import get_default_contact
|
||||||
@ -32,7 +33,7 @@ class Shipment(Document):
|
|||||||
|
|
||||||
def validate_weight(self):
|
def validate_weight(self):
|
||||||
for parcel in self.shipment_parcel:
|
for parcel in self.shipment_parcel:
|
||||||
if parcel.weight <= 0:
|
if flt(parcel.weight) <= 0:
|
||||||
frappe.throw(_('Parcel weight cannot be 0'))
|
frappe.throw(_('Parcel weight cannot be 0'))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
@ -52,12 +53,12 @@ def fetch_shipping_rates(pickup_from_type, delivery_to_type, pickup_address_name
|
|||||||
if pickup_from_type != 'Company':
|
if pickup_from_type != 'Company':
|
||||||
pickup_contact = get_contact(pickup_contact_name)
|
pickup_contact = get_contact(pickup_contact_name)
|
||||||
else:
|
else:
|
||||||
pickup_contact = get_company_contact()
|
pickup_contact = get_company_contact(user=pickup_contact_name)
|
||||||
|
|
||||||
if delivery_to_type != 'Company':
|
if delivery_to_type != 'Company':
|
||||||
delivery_contact = get_contact(delivery_contact_name)
|
delivery_contact = get_contact(delivery_contact_name)
|
||||||
else:
|
else:
|
||||||
delivery_contact = get_company_contact()
|
delivery_contact = get_company_contact(user=pickup_contact_name)
|
||||||
letmeship_prices = get_letmeship_available_services(
|
letmeship_prices = get_letmeship_available_services(
|
||||||
delivery_to_type=delivery_to_type,
|
delivery_to_type=delivery_to_type,
|
||||||
pickup_address=pickup_address,
|
pickup_address=pickup_address,
|
||||||
@ -104,12 +105,12 @@ def create_shipment(shipment, pickup_from_type, delivery_to_type, pickup_address
|
|||||||
if pickup_from_type != 'Company':
|
if pickup_from_type != 'Company':
|
||||||
pickup_contact = get_contact(pickup_contact_name)
|
pickup_contact = get_contact(pickup_contact_name)
|
||||||
else:
|
else:
|
||||||
pickup_contact = get_company_contact()
|
pickup_contact = get_company_contact(user=pickup_contact_name)
|
||||||
|
|
||||||
if delivery_to_type != 'Company':
|
if delivery_to_type != 'Company':
|
||||||
delivery_contact = get_contact(delivery_contact_name)
|
delivery_contact = get_contact(delivery_contact_name)
|
||||||
else:
|
else:
|
||||||
delivery_contact = get_company_contact()
|
delivery_contact = get_company_contact(user=pickup_contact_name)
|
||||||
if service_info['service_provider'] == LETMESHIP_PROVIDER:
|
if service_info['service_provider'] == LETMESHIP_PROVIDER:
|
||||||
shipment_info = create_letmeship_shipment(
|
shipment_info = create_letmeship_shipment(
|
||||||
pickup_address=pickup_address,
|
pickup_address=pickup_address,
|
||||||
@ -150,12 +151,9 @@ def create_shipment(shipment, pickup_from_type, delivery_to_type, pickup_address
|
|||||||
)
|
)
|
||||||
|
|
||||||
if shipment_info:
|
if shipment_info:
|
||||||
frappe.db.set_value('Shipment', shipment, 'service_provider', shipment_info.get('service_provider'))
|
fields = ['service_provider', 'carrier', 'carrier_service', 'shipment_id', 'shipment_amount', 'awb_number']
|
||||||
frappe.db.set_value('Shipment', shipment, 'carrier', shipment_info.get('carrier'))
|
for field in fields:
|
||||||
frappe.db.set_value('Shipment', shipment, 'carrier_service', shipment_info.get('carrier_service'))
|
frappe.db.set_value('Shipment', shipment, field, shipment_info.get(field))
|
||||||
frappe.db.set_value('Shipment', shipment, 'shipment_id', shipment_info.get('shipment_id'))
|
|
||||||
frappe.db.set_value('Shipment', shipment, 'shipment_amount', shipment_info.get('shipment_amount'))
|
|
||||||
frappe.db.set_value('Shipment', shipment, 'awb_number', shipment_info.get('awb_number'))
|
|
||||||
frappe.db.set_value('Shipment', shipment, 'status', 'Booked')
|
frappe.db.set_value('Shipment', shipment, 'status', 'Booked')
|
||||||
if delivery_notes:
|
if delivery_notes:
|
||||||
update_delivery_note(delivery_notes=delivery_notes, shipment_info=shipment_info)
|
update_delivery_note(delivery_notes=delivery_notes, shipment_info=shipment_info)
|
||||||
@ -277,9 +275,17 @@ def get_contact(contact_name):
|
|||||||
contact.phone = contact.mobile_no
|
contact.phone = contact.mobile_no
|
||||||
return contact
|
return contact
|
||||||
|
|
||||||
|
def match_parcel_service_type_carrier(shipment_prices, reference):
|
||||||
|
for idx, prices in enumerate(shipment_prices):
|
||||||
|
service_name = match_parcel_service_type_alias(prices.get(reference[0]), prices.get(reference[1]))
|
||||||
|
is_preferred = frappe.db.get_value('Parcel Service Type', service_name, 'show_in_preferred_services_list')
|
||||||
|
shipment_prices[idx].service_name = service_name
|
||||||
|
shipment_prices[idx].is_preferred = is_preferred
|
||||||
|
return shipment_prices
|
||||||
|
|
||||||
def get_company_contact():
|
@frappe.whitelist()
|
||||||
contact = frappe.db.get_value('User', frappe.session.user, [
|
def get_company_contact(user):
|
||||||
|
contact = frappe.db.get_value('User', user, [
|
||||||
'first_name',
|
'first_name',
|
||||||
'last_name',
|
'last_name',
|
||||||
'email',
|
'email',
|
||||||
@ -289,12 +295,4 @@ def get_company_contact():
|
|||||||
], as_dict=1)
|
], as_dict=1)
|
||||||
if not contact.phone:
|
if not contact.phone:
|
||||||
contact.phone = contact.mobile_no
|
contact.phone = contact.mobile_no
|
||||||
return contact
|
return contact
|
||||||
|
|
||||||
def match_parcel_service_type_carrier(shipment_prices, reference):
|
|
||||||
for idx, prices in enumerate(shipment_prices):
|
|
||||||
service_name = match_parcel_service_type_alias(prices.get(reference[0]), prices.get(reference[1]))
|
|
||||||
is_preferred = frappe.db.get_value('Parcel Service Type', service_name, 'show_in_preferred_services_list')
|
|
||||||
shipment_prices[idx].service_name = service_name
|
|
||||||
shipment_prices[idx].is_preferred = is_preferred
|
|
||||||
return shipment_prices
|
|
||||||
@ -1,59 +1,63 @@
|
|||||||
{% if (data.length) { %}
|
{% if (data.preferred_services.length || data.other_services.length) { %}
|
||||||
<div style="overflow-x:scroll;height: 550px;">
|
<div style="overflow-x:scroll; height: 550px;">
|
||||||
<h5>{{ __("Preferred Services") }}</h5>
|
<h5>{{ __("Preferred Services") }}</h5>
|
||||||
<table class="table table-bordered table-hover">
|
{% if (data.preferred_services.length) { %}
|
||||||
<thead class="grid-heading-row">
|
<table class="table table-bordered table-hover">
|
||||||
<tr style="text-align: center">
|
<thead class="grid-heading-row">
|
||||||
{% for (var i = 0; i < header_columns.length; i++) { %}
|
<tr style="text-align: center">
|
||||||
<th style="text-align: center">{{ header_columns[i] }}</th>
|
{% for (var i = 0; i < header_columns.length; i++) { %}
|
||||||
{% } %}
|
<th style="text-align: center">{{ header_columns[i] }}</th>
|
||||||
</tr>
|
{% } %}
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
</thead>
|
||||||
{% for (var i = 0; i < data.length; i++) { %}
|
<tbody>
|
||||||
{% if (data[i].is_preferred) { %}
|
{% for (var i = 0; i < data.preferred_services.length; i++) { %}
|
||||||
<tr style="text-align: center" id="data-list-{{i}}">
|
<tr style="text-align: center" id="data-list-{{i}}">
|
||||||
<td style="width:20%">{{ data[i].service_provider }}</td>
|
<td style="width:20%">{{ data.preferred_services[i].service_provider }}</td>
|
||||||
<td style="width:20%">{{ data[i].carrier }}</td>
|
<td style="width:20%">{{ data.preferred_services[i].carrier }}</td>
|
||||||
<td style="width:40%">{{ data[i].service_name }}</td>
|
<td style="width:40%">{{ data.preferred_services[i].service_name }}</td>
|
||||||
<td style="width:10%">{{ format_currency(data[i].total_price, 'EUR', 2) }}</td>
|
<td style="width:10%">{{ format_currency(data.preferred_services[i].total_price, 'EUR', 2) }}</td>
|
||||||
<td style="width:10%">
|
<td style="width:10%">
|
||||||
<button id="data-list-{{i}}" onclick='cur_frm.select_row({{JSON.stringify(data[i])}})' type="button" class="btn btn-success">
|
<button id="data-list-{{i}}" onclick='cur_frm.select_row({{JSON.stringify(data.preferred_services[i])}})' type="button" class="btn btn-primary">
|
||||||
<span class="glyphicon glyphicon-check"></span>
|
<span class="glyphicon glyphicon-ok"></span>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% } %}
|
{% } %}
|
||||||
{% } %}
|
</tbody>
|
||||||
</tbody>
|
</table>
|
||||||
</table>
|
{% } else { %}
|
||||||
|
<div><strong class="text-muted">{{ __("No Preferred Services Available") }}</strong></div>
|
||||||
|
{% } %}
|
||||||
<h5>{{ __("Other Services") }}</h5>
|
<h5>{{ __("Other Services") }}</h5>
|
||||||
<table class="table table-bordered table-hover">
|
{% if (data.other_services.length) { %}
|
||||||
<thead class="grid-heading-row">
|
<table class="table table-bordered table-hover">
|
||||||
<tr style="text-align: center">
|
<thead class="grid-heading-row">
|
||||||
{% for (var i = 0; i < header_columns.length; i++) { %}
|
<tr style="text-align: center">
|
||||||
<th style="text-align: center" >{{ header_columns[i] }}</th>
|
{% for (var i = 0; i < header_columns.length; i++) { %}
|
||||||
{% } %}
|
<th style="text-align: center" >{{ header_columns[i] }}</th>
|
||||||
</tr>
|
{% } %}
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
</thead>
|
||||||
{% for (var i = 0; i < data.length; i++) { %}
|
<tbody>
|
||||||
{% if (!data[i].is_preferred) { %}
|
{% for (var i = 0; i < data.other_services.length; i++) { %}
|
||||||
<tr style="text-align: center" id="data-list-{{i}}">
|
<tr style="text-align: center" id="data-list-{{i}}">
|
||||||
<td style="width:20%">{{ data[i].service_provider }}</td>
|
<td style="width:20%">{{ data.other_services[i].service_provider }}</td>
|
||||||
<td style="width:20%">{{ data[i].carrier }}</td>
|
<td style="width:20%">{{ data.other_services[i].carrier }}</td>
|
||||||
<td style="width:40%">{{ data[i].service_name }}</td>
|
<td style="width:40%">{{ data.other_services[i].service_name }}</td>
|
||||||
<td style="width:10%">{{ format_currency(data[i].total_price, 'EUR', 2) }}</td>
|
<td style="width:10%">{{ format_currency(data.other_services[i].total_price, 'EUR', 2) }}</td>
|
||||||
<td style="width:10%">
|
<td style="width:10%">
|
||||||
<button id="data-list-{{i}}" onclick='cur_frm.select_row({{JSON.stringify(data[i])}})' type="button" class="btn btn-success">
|
<button id="data-list-{{i}}" onclick='cur_frm.select_row({{JSON.stringify(data.other_services[i])}})' type="button" class="btn btn-primary">
|
||||||
<span class="glyphicon glyphicon-check"></span>
|
<span class="glyphicon glyphicon-ok"></span>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% } %}
|
{% } %}
|
||||||
{% } %}
|
</tbody>
|
||||||
</tbody>
|
</table>
|
||||||
</table>
|
{% } else { %}
|
||||||
|
<div><strong class="text-muted">{{ __("No Services Available") }}</strong></div>
|
||||||
|
{% } %}
|
||||||
</div>
|
</div>
|
||||||
{% } else { %}
|
{% } else { %}
|
||||||
<div><strong class="text-muted">{{ __("No Services Available") }}</strong></div>
|
<div><strong class="text-muted">{{ __("No Services Available") }}</strong></div>
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
"modified": "2020-07-09 12:55:01.134270",
|
"modified": "2020-07-09 12:55:01.134270",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Shipment Delivery Notes",
|
"name": "Shipment Delivery Note",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"quick_entry": 1,
|
"quick_entry": 1,
|
||||||
@ -6,5 +6,5 @@ from __future__ import unicode_literals
|
|||||||
# import frappe
|
# import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class ShipmentDeliveryNotes(Document):
|
class ShipmentDeliveryNote(Document):
|
||||||
pass
|
pass
|
||||||
@ -30,7 +30,7 @@
|
|||||||
"modified": "2020-07-09 12:55:14.217387",
|
"modified": "2020-07-09 12:55:14.217387",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Shipment Notification Subscriptions",
|
"name": "Shipment Notification Subscription",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"quick_entry": 1,
|
"quick_entry": 1,
|
||||||
@ -6,5 +6,5 @@ from __future__ import unicode_literals
|
|||||||
# import frappe
|
# import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class ShipmentNotificationSubscriptions(Document):
|
class ShipmentNotificationSubscription(Document):
|
||||||
pass
|
pass
|
||||||
@ -1,26 +1,18 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"autoname": "field:preset_name",
|
"autoname": "field:parcel_template_name",
|
||||||
"creation": "2020-07-09 11:43:43.470339",
|
"creation": "2020-07-09 11:43:43.470339",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"preset_name",
|
"parcel_template_name",
|
||||||
"length",
|
"length",
|
||||||
"width",
|
"width",
|
||||||
"height",
|
"height",
|
||||||
"weight"
|
"weight"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
|
||||||
"fieldname": "preset_name",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"in_list_view": 1,
|
|
||||||
"label": "Preset Name",
|
|
||||||
"reqd": 1,
|
|
||||||
"unique": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "length",
|
"fieldname": "length",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
@ -49,10 +41,18 @@
|
|||||||
"label": "Weight (kg)",
|
"label": "Weight (kg)",
|
||||||
"precision": "1",
|
"precision": "1",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "parcel_template_name",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Parcel Template Name",
|
||||||
|
"reqd": 1,
|
||||||
|
"unique": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-07-10 12:53:22.772826",
|
"modified": "2020-09-28 12:51:00.320421",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Shipment Parcel Template",
|
"name": "Shipment Parcel Template",
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
"modified": "2020-07-09 12:55:27.615463",
|
"modified": "2020-07-09 12:55:27.615463",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Shipment Status Update Subscriptions",
|
"name": "Shipment Status Update Subscription",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"quick_entry": 1,
|
"quick_entry": 1,
|
||||||
@ -6,5 +6,5 @@ from __future__ import unicode_literals
|
|||||||
# import frappe
|
# import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class ShipmentStatusUpdateSubscriptions(Document):
|
class ShipmentStatusUpdateSubscription(Document):
|
||||||
pass
|
pass
|
||||||
Loading…
x
Reference in New Issue
Block a user