fix: travis build error

- Removed shipment notification and subscription files
- Minor changes on shipment field configuration
- Add shipment to desk
This commit is contained in:
jbienesdev 2020-12-02 07:54:25 +00:00
parent b4b542d1c3
commit 8e68f128c1
11 changed files with 46 additions and 117 deletions

View File

@ -8,7 +8,7 @@
{ {
"hidden": 0, "hidden": 0,
"label": "Stock Transactions", "label": "Stock Transactions",
"links": "[\n {\n \"dependencies\": [\n \"Item\"\n ],\n \"label\": \"Material Request\",\n \"name\": \"Material Request\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\"\n ],\n \"label\": \"Stock Entry\",\n \"name\": \"Stock Entry\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\",\n \"Customer\"\n ],\n \"label\": \"Delivery Note\",\n \"name\": \"Delivery Note\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\",\n \"Supplier\"\n ],\n \"label\": \"Purchase Receipt\",\n \"name\": \"Purchase Receipt\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\"\n ],\n \"label\": \"Pick List\",\n \"name\": \"Pick List\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Delivery Trip\",\n \"name\": \"Delivery Trip\",\n \"type\": \"doctype\"\n }\n]" "links": "[\n {\n \"dependencies\": [\n \"Item\"\n ],\n \"label\": \"Material Request\",\n \"name\": \"Material Request\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\"\n ],\n \"label\": \"Stock Entry\",\n \"name\": \"Stock Entry\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\",\n \"Customer\"\n ],\n \"label\": \"Delivery Note\",\n \"name\": \"Delivery Note\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\",\n \"Supplier\"\n ],\n \"label\": \"Purchase Receipt\",\n \"name\": \"Purchase Receipt\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\"\n ],\n \"label\": \"Pick List\",\n \"name\": \"Pick List\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Shipment\",\n \"name\": \"Shipment\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Delivery Trip\",\n \"name\": \"Delivery Trip\",\n \"type\": \"doctype\"\n }\n]"
}, },
{ {
"hidden": 0, "hidden": 0,
@ -58,7 +58,7 @@
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "Stock", "label": "Stock",
"modified": "2020-10-07 18:40:17.130207", "modified": "2020-12-02 15:47:41.532942",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Stock", "name": "Stock",

View File

@ -234,6 +234,7 @@
"options": "Shipment Parcel Template" "options": "Shipment Parcel Template"
}, },
{ {
"depends_on": "eval:doc.docstatus !== 1\n",
"fieldname": "add_template", "fieldname": "add_template",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Add Template" "label": "Add Template"
@ -262,6 +263,7 @@
"reqd": 1 "reqd": 1
}, },
{ {
"allow_on_submit": 1,
"fieldname": "pickup_date", "fieldname": "pickup_date",
"fieldtype": "Date", "fieldtype": "Date",
"in_list_view": 1, "in_list_view": 1,
@ -269,12 +271,14 @@
"reqd": 1 "reqd": 1
}, },
{ {
"allow_on_submit": 1,
"default": "09:00", "default": "09:00",
"fieldname": "pickup_from", "fieldname": "pickup_from",
"fieldtype": "Time", "fieldtype": "Time",
"label": "Pickup from" "label": "Pickup from"
}, },
{ {
"allow_on_submit": 1,
"default": "17:00", "default": "17:00",
"fieldname": "pickup_to", "fieldname": "pickup_to",
"fieldtype": "Time", "fieldtype": "Time",
@ -316,57 +320,77 @@
{ {
"fieldname": "service_provider", "fieldname": "service_provider",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Service Provider" "label": "Service Provider",
"no_copy": 1,
"print_hide": 1
}, },
{ {
"fieldname": "shipment_id", "fieldname": "shipment_id",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Shipment ID" "label": "Shipment ID",
"no_copy": 1,
"print_hide": 1
}, },
{ {
"fieldname": "shipment_amount", "fieldname": "shipment_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Shipment Amount", "label": "Shipment Amount",
"precision": "2" "no_copy": 1,
"precision": "2",
"print_hide": 1
}, },
{ {
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Status", "label": "Status",
"options": "Draft\nSubmitted\nBooked\nCancelled\nCompleted" "no_copy": 1,
"options": "Draft\nSubmitted\nBooked\nCancelled\nCompleted",
"print_hide": 1
}, },
{ {
"fieldname": "tracking_url", "fieldname": "tracking_url",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 1, "hidden": 1,
"label": "Tracking URL", "label": "Tracking URL",
"no_copy": 1,
"print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "carrier", "fieldname": "carrier",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Carrier" "label": "Carrier",
"no_copy": 1,
"print_hide": 1
}, },
{ {
"fieldname": "carrier_service", "fieldname": "carrier_service",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Carrier Service" "label": "Carrier Service",
"no_copy": 1,
"print_hide": 1
}, },
{ {
"fieldname": "awb_number", "fieldname": "awb_number",
"fieldtype": "Data", "fieldtype": "Data",
"label": "AWB Number" "label": "AWB Number",
"no_copy": 1,
"print_hide": 1
}, },
{ {
"fieldname": "tracking_status", "fieldname": "tracking_status",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Tracking Status", "label": "Tracking Status",
"options": "\nIn Progress\nDelivered\nReturned\nLost" "no_copy": 1,
"options": "\nIn Progress\nDelivered\nReturned\nLost",
"print_hide": 1
}, },
{ {
"fieldname": "tracking_status_info", "fieldname": "tracking_status_info",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Tracking Status Info", "label": "Tracking Status Info",
"no_copy": 1,
"print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{ {
@ -406,7 +430,7 @@
], ],
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-11-23 17:00:51.600965", "modified": "2020-12-02 15:43:44.607039",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Shipment", "name": "Shipment",

View File

@ -13,6 +13,7 @@ from frappe.contacts.doctype.contact.contact import get_default_contact
class Shipment(Document): class Shipment(Document):
def validate(self): def validate(self):
self.validate_weight() self.validate_weight()
self.set_value_of_goods()
if self.docstatus == 0: if self.docstatus == 0:
self.status = 'Draft' self.status = 'Draft'
@ -31,6 +32,12 @@ class Shipment(Document):
if flt(parcel.weight) <= 0: if flt(parcel.weight) <= 0:
frappe.throw(_('Parcel weight cannot be 0')) frappe.throw(_('Parcel weight cannot be 0'))
def set_value_of_goods(self):
value_of_goods = 0
for entry in self.get("shipment_delivery_note"):
value_of_goods += flt(entry.get("grand_total"))
self.value_of_goods = value_of_goods if value_of_goods else self.value_of_goods
@frappe.whitelist() @frappe.whitelist()
def get_address_name(ref_doctype, docname): def get_address_name(ref_doctype, docname):
# Return address name # Return address name

View File

@ -16,7 +16,6 @@ class TestShipment(unittest.TestCase):
shipment.submit() shipment.submit()
second_shipment = make_shipment(delivery_note.name) second_shipment = make_shipment(delivery_note.name)
self.assertEqual(second_shipment.value_of_goods, delivery_note.grand_total) self.assertEqual(second_shipment.value_of_goods, delivery_note.grand_total)
self.assertEqual(second_shipment.grand_total, delivery_note.grand_total)
self.assertEqual(len(second_shipment.shipment_delivery_note), 1) self.assertEqual(len(second_shipment.shipment_delivery_note), 1)
self.assertEqual(second_shipment.shipment_delivery_note[0].delivery_note, delivery_note.name) self.assertEqual(second_shipment.shipment_delivery_note[0].delivery_note, delivery_note.name)
@ -49,7 +48,7 @@ def create_test_delivery_note():
return delivery_note return delivery_note
def create_test_shipment(delivery_notes=[]): def create_test_shipment(delivery_notes = None):
company = get_shipment_company() company = get_shipment_company()
company_address = get_shipment_company_address(company.name) company_address = get_shipment_company_address(company.name)
customer = get_shipment_customer() customer = get_shipment_customer()
@ -74,7 +73,7 @@ def create_test_shipment(delivery_notes=[]):
shipment.pickup_to = '17:00' shipment.pickup_to = '17:00'
shipment.description_of_content = 'unit test entry' shipment.description_of_content = 'unit test entry'
for delivery_note in delivery_notes: for delivery_note in delivery_notes:
shipment.append('shipment_delivery_notes', shipment.append('shipment_delivery_note',
{ {
"delivery_note": delivery_note.name "delivery_note": delivery_note.name
} }
@ -229,7 +228,7 @@ def create_shipment_item(item_name, company_name):
item.item_name = item_name item.item_name = item_name
item.item_code = item_name item.item_code = item_name
item.item_group = 'All Item Groups' item.item_group = 'All Item Groups'
item.opening_stock = 'Nos' item.stock_uom = 'Nos'
item.standard_rate = 50 item.standard_rate = 50
item.append('item_defaults', item.append('item_defaults',
{ {

View File

@ -18,7 +18,6 @@
"reqd": 1 "reqd": 1
}, },
{ {
"fetch_from": "delivery_note.grand_total",
"fieldname": "grand_total", "fieldname": "grand_total",
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
@ -28,7 +27,7 @@
], ],
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2020-07-09 12:55:01.134270", "modified": "2020-12-02 15:44:34.028703",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Shipment Delivery Note", "name": "Shipment Delivery Note",

View File

@ -1,40 +0,0 @@
{
"actions": [],
"creation": "2020-07-09 12:49:09.185552",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"email",
"unsubscribed"
],
"fields": [
{
"fieldname": "email",
"fieldtype": "Data",
"in_list_view": 1,
"label": "email",
"reqd": 1,
"unique": 1
},
{
"default": "0",
"fieldname": "unsubscribed",
"fieldtype": "Check",
"in_list_view": 1,
"label": "unsubscribed"
}
],
"istable": 1,
"links": [],
"modified": "2020-07-09 12:55:14.217387",
"modified_by": "Administrator",
"module": "Stock",
"name": "Shipment Notification Subscription",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -1,10 +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.model.document import Document
class ShipmentNotificationSubscription(Document):
pass

View File

@ -1,40 +0,0 @@
{
"actions": [],
"creation": "2020-07-09 12:51:10.656612",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"email",
"unsubscribed"
],
"fields": [
{
"fieldname": "email",
"fieldtype": "Data",
"in_list_view": 1,
"label": "email",
"reqd": 1,
"unique": 1
},
{
"default": "0",
"fieldname": "unsubscribed",
"fieldtype": "Check",
"in_list_view": 1,
"label": "unsubscribed"
}
],
"istable": 1,
"links": [],
"modified": "2020-07-09 12:55:27.615463",
"modified_by": "Administrator",
"module": "Stock",
"name": "Shipment Status Update Subscription",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -1,10 +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.model.document import Document
class ShipmentStatusUpdateSubscription(Document):
pass