diff --git a/erpnext/stock/desk_page/stock/stock.json b/erpnext/stock/desk_page/stock/stock.json index 390fcd91e3..9068e338c3 100644 --- a/erpnext/stock/desk_page/stock/stock.json +++ b/erpnext/stock/desk_page/stock/stock.json @@ -8,7 +8,7 @@ { "hidden": 0, "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, @@ -58,7 +58,7 @@ "idx": 0, "is_standard": 1, "label": "Stock", - "modified": "2020-10-07 18:40:17.130207", + "modified": "2020-12-02 15:47:41.532942", "modified_by": "Administrator", "module": "Stock", "name": "Stock", diff --git a/erpnext/stock/doctype/shipment/shipment.json b/erpnext/stock/doctype/shipment/shipment.json index 1ae7862bc9..37a9cc6c02 100644 --- a/erpnext/stock/doctype/shipment/shipment.json +++ b/erpnext/stock/doctype/shipment/shipment.json @@ -234,6 +234,7 @@ "options": "Shipment Parcel Template" }, { + "depends_on": "eval:doc.docstatus !== 1\n", "fieldname": "add_template", "fieldtype": "Button", "label": "Add Template" @@ -262,6 +263,7 @@ "reqd": 1 }, { + "allow_on_submit": 1, "fieldname": "pickup_date", "fieldtype": "Date", "in_list_view": 1, @@ -269,12 +271,14 @@ "reqd": 1 }, { + "allow_on_submit": 1, "default": "09:00", "fieldname": "pickup_from", "fieldtype": "Time", "label": "Pickup from" }, { + "allow_on_submit": 1, "default": "17:00", "fieldname": "pickup_to", "fieldtype": "Time", @@ -316,57 +320,77 @@ { "fieldname": "service_provider", "fieldtype": "Data", - "label": "Service Provider" + "label": "Service Provider", + "no_copy": 1, + "print_hide": 1 }, { "fieldname": "shipment_id", "fieldtype": "Data", - "label": "Shipment ID" + "label": "Shipment ID", + "no_copy": 1, + "print_hide": 1 }, { "fieldname": "shipment_amount", "fieldtype": "Currency", "label": "Shipment Amount", - "precision": "2" + "no_copy": 1, + "precision": "2", + "print_hide": 1 }, { "fieldname": "status", "fieldtype": "Select", "label": "Status", - "options": "Draft\nSubmitted\nBooked\nCancelled\nCompleted" + "no_copy": 1, + "options": "Draft\nSubmitted\nBooked\nCancelled\nCompleted", + "print_hide": 1 }, { "fieldname": "tracking_url", "fieldtype": "Small Text", "hidden": 1, "label": "Tracking URL", + "no_copy": 1, + "print_hide": 1, "read_only": 1 }, { "fieldname": "carrier", "fieldtype": "Data", - "label": "Carrier" + "label": "Carrier", + "no_copy": 1, + "print_hide": 1 }, { "fieldname": "carrier_service", "fieldtype": "Data", - "label": "Carrier Service" + "label": "Carrier Service", + "no_copy": 1, + "print_hide": 1 }, { "fieldname": "awb_number", "fieldtype": "Data", - "label": "AWB Number" + "label": "AWB Number", + "no_copy": 1, + "print_hide": 1 }, { "fieldname": "tracking_status", "fieldtype": "Select", "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", "fieldtype": "Data", "label": "Tracking Status Info", + "no_copy": 1, + "print_hide": 1, "read_only": 1 }, { @@ -406,7 +430,7 @@ ], "is_submittable": 1, "links": [], - "modified": "2020-11-23 17:00:51.600965", + "modified": "2020-12-02 15:43:44.607039", "modified_by": "Administrator", "module": "Stock", "name": "Shipment", diff --git a/erpnext/stock/doctype/shipment/shipment.py b/erpnext/stock/doctype/shipment/shipment.py index 508af39cd5..de0c243b05 100644 --- a/erpnext/stock/doctype/shipment/shipment.py +++ b/erpnext/stock/doctype/shipment/shipment.py @@ -13,6 +13,7 @@ from frappe.contacts.doctype.contact.contact import get_default_contact class Shipment(Document): def validate(self): self.validate_weight() + self.set_value_of_goods() if self.docstatus == 0: self.status = 'Draft' @@ -31,6 +32,12 @@ class Shipment(Document): if flt(parcel.weight) <= 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() def get_address_name(ref_doctype, docname): # Return address name diff --git a/erpnext/stock/doctype/shipment/test_shipment.py b/erpnext/stock/doctype/shipment/test_shipment.py index e238e878db..e1fa207a21 100644 --- a/erpnext/stock/doctype/shipment/test_shipment.py +++ b/erpnext/stock/doctype/shipment/test_shipment.py @@ -16,7 +16,6 @@ class TestShipment(unittest.TestCase): shipment.submit() second_shipment = make_shipment(delivery_note.name) 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(second_shipment.shipment_delivery_note[0].delivery_note, delivery_note.name) @@ -49,7 +48,7 @@ def create_test_delivery_note(): return delivery_note -def create_test_shipment(delivery_notes=[]): +def create_test_shipment(delivery_notes = None): company = get_shipment_company() company_address = get_shipment_company_address(company.name) customer = get_shipment_customer() @@ -74,7 +73,7 @@ def create_test_shipment(delivery_notes=[]): shipment.pickup_to = '17:00' shipment.description_of_content = 'unit test entry' for delivery_note in delivery_notes: - shipment.append('shipment_delivery_notes', + shipment.append('shipment_delivery_note', { "delivery_note": delivery_note.name } @@ -229,7 +228,7 @@ def create_shipment_item(item_name, company_name): item.item_name = item_name item.item_code = item_name item.item_group = 'All Item Groups' - item.opening_stock = 'Nos' + item.stock_uom = 'Nos' item.standard_rate = 50 item.append('item_defaults', { diff --git a/erpnext/stock/doctype/shipment_delivery_note/shipment_delivery_note.json b/erpnext/stock/doctype/shipment_delivery_note/shipment_delivery_note.json index 9651e3f945..8625913718 100644 --- a/erpnext/stock/doctype/shipment_delivery_note/shipment_delivery_note.json +++ b/erpnext/stock/doctype/shipment_delivery_note/shipment_delivery_note.json @@ -18,7 +18,6 @@ "reqd": 1 }, { - "fetch_from": "delivery_note.grand_total", "fieldname": "grand_total", "fieldtype": "Currency", "in_list_view": 1, @@ -28,7 +27,7 @@ ], "istable": 1, "links": [], - "modified": "2020-07-09 12:55:01.134270", + "modified": "2020-12-02 15:44:34.028703", "modified_by": "Administrator", "module": "Stock", "name": "Shipment Delivery Note", diff --git a/erpnext/stock/doctype/shipment_notification_subscription/__init__.py b/erpnext/stock/doctype/shipment_notification_subscription/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/stock/doctype/shipment_notification_subscription/shipment_notification_subscription.json b/erpnext/stock/doctype/shipment_notification_subscription/shipment_notification_subscription.json deleted file mode 100644 index d927d9902e..0000000000 --- a/erpnext/stock/doctype/shipment_notification_subscription/shipment_notification_subscription.json +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/erpnext/stock/doctype/shipment_notification_subscription/shipment_notification_subscription.py b/erpnext/stock/doctype/shipment_notification_subscription/shipment_notification_subscription.py deleted file mode 100644 index c816e4343c..0000000000 --- a/erpnext/stock/doctype/shipment_notification_subscription/shipment_notification_subscription.py +++ /dev/null @@ -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 diff --git a/erpnext/stock/doctype/shipment_status_update_subscription/__init__.py b/erpnext/stock/doctype/shipment_status_update_subscription/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/stock/doctype/shipment_status_update_subscription/shipment_status_update_subscription.json b/erpnext/stock/doctype/shipment_status_update_subscription/shipment_status_update_subscription.json deleted file mode 100644 index a7fe4a4a0a..0000000000 --- a/erpnext/stock/doctype/shipment_status_update_subscription/shipment_status_update_subscription.json +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/erpnext/stock/doctype/shipment_status_update_subscription/shipment_status_update_subscription.py b/erpnext/stock/doctype/shipment_status_update_subscription/shipment_status_update_subscription.py deleted file mode 100644 index 1b006d7efc..0000000000 --- a/erpnext/stock/doctype/shipment_status_update_subscription/shipment_status_update_subscription.py +++ /dev/null @@ -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