From 5bb85e7a9536ac7aeb51a5ec51ef791c114e34f5 Mon Sep 17 00:00:00 2001 From: bhupen Date: Fri, 16 Dec 2016 12:08:45 +0530 Subject: [PATCH 1/4] partially orderd status will be shown in material request --- .../stock/doctype/material_request/material_request_list.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/material_request/material_request_list.js b/erpnext/stock/doctype/material_request/material_request_list.js index eb14930786..b6ceeac85c 100644 --- a/erpnext/stock/doctype/material_request/material_request_list.js +++ b/erpnext/stock/doctype/material_request/material_request_list.js @@ -3,10 +3,10 @@ frappe.listview_settings['Material Request'] = { get_indicator: function(doc) { if(doc.status=="Stopped") { return [__("Stopped"), "red", "status,=,Stopped"]; - } else if(doc.docstatus==1 && flt(doc.per_ordered, 2) == 0.00) { + } else if(doc.docstatus==1 && flt(doc.per_ordered, 2) == 0) { return [__("Pending"), "orange", "per_ordered,=,0"]; - } else if(doc.docstatus==1 && flt(doc.per_ordered, 2) < 100) { - return [__("Partially Ordered"), "orange", "per_ordered,<,100"]; + } else if(doc.docstatus==1 && flt(doc.per_ordered, 2) < 100) { + return [__("Partially ordred"), "yellow", "per_ordered,<,100"]; } else if(doc.docstatus==1 && flt(doc.per_ordered, 2) == 100) { if (doc.material_request_type == "Purchase") { return [__("Ordered"), "green", "per_ordered,=,100"]; From 914ae77a22e45ea0a505f6b806d8f6d27729b997 Mon Sep 17 00:00:00 2001 From: bhupen Date: Fri, 16 Dec 2016 13:00:16 +0530 Subject: [PATCH 2/4] Limit instead of Allowance in stock settings --- .../stock_settings/stock_settings.json | 69 ++++++++++++++++++- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json index 65016828e2..4801d40be2 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.json +++ b/erpnext/stock/doctype/stock_settings/stock_settings.json @@ -8,11 +8,13 @@ "description": "Settings", "docstatus": 0, "doctype": "DocType", + "editable_grid": 0, "fields": [ { "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "default": "Item Code", "fieldname": "item_naming_by", "fieldtype": "Select", @@ -21,6 +23,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Item Naming By", "length": 0, "no_copy": 0, @@ -29,6 +32,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -39,6 +43,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "description": "", "fieldname": "item_group", "fieldtype": "Link", @@ -47,6 +52,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Default Item Group", "length": 0, "no_copy": 0, @@ -55,6 +61,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -65,6 +72,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "stock_uom", "fieldtype": "Link", "hidden": 0, @@ -72,6 +80,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Default Stock UOM", "length": 0, "no_copy": 0, @@ -80,6 +89,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -90,6 +100,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "default_warehouse", "fieldtype": "Link", "hidden": 0, @@ -97,6 +108,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Default Warehouse", "length": 0, "no_copy": 0, @@ -106,6 +118,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -116,6 +129,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "column_break_4", "fieldtype": "Column Break", "hidden": 0, @@ -123,12 +137,14 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -139,6 +155,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "valuation_method", "fieldtype": "Select", "hidden": 0, @@ -146,6 +163,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Default Valuation Method", "length": 0, "no_copy": 0, @@ -154,6 +172,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -164,6 +183,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "description": "Percentage you are allowed to receive or deliver more against the quantity ordered. For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units.", "fieldname": "tolerance", "fieldtype": "Float", @@ -172,13 +192,15 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Allowance Percent", + "in_standard_filter": 0, + "label": "Limit Percent", "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -189,6 +211,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "default": "1", "fieldname": "show_barcode_field", "fieldtype": "Check", @@ -197,6 +220,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Show Barcode Field", "length": 0, "no_copy": 0, @@ -205,6 +229,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -215,6 +240,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "section_break_7", "fieldtype": "Section Break", "hidden": 0, @@ -222,6 +248,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -229,6 +256,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -239,6 +267,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "auto_insert_price_list_rate_if_missing", "fieldtype": "Check", "hidden": 0, @@ -246,6 +275,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Auto insert Price List rate if missing", "length": 0, "no_copy": 0, @@ -254,6 +284,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -264,6 +295,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "allow_negative_stock", "fieldtype": "Check", "hidden": 0, @@ -271,6 +303,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Allow Negative Stock", "length": 0, "no_copy": 0, @@ -278,6 +311,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -288,6 +322,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "column_break_10", "fieldtype": "Column Break", "hidden": 0, @@ -295,6 +330,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -302,6 +338,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -312,6 +349,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "default": "1", "fieldname": "automatically_set_serial_nos_based_on_fifo", "fieldtype": "Check", @@ -320,6 +358,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Automatically Set Serial Nos based on FIFO", "length": 0, "no_copy": 0, @@ -328,6 +367,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -338,6 +378,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "auto_material_request", "fieldtype": "Section Break", "hidden": 0, @@ -345,6 +386,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Auto Material Request", "length": 0, "no_copy": 0, @@ -352,6 +394,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -362,6 +405,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "auto_indent", "fieldtype": "Check", "hidden": 0, @@ -369,6 +413,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Raise Material Request when stock reaches re-order level", "length": 0, "no_copy": 0, @@ -376,6 +421,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -386,6 +432,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "reorder_email_notify", "fieldtype": "Check", "hidden": 0, @@ -393,6 +440,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Notify by Email on creation of automatic Material Request", "length": 0, "no_copy": 0, @@ -400,6 +448,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -410,6 +459,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "freeze_stock_entries", "fieldtype": "Section Break", "hidden": 0, @@ -417,6 +467,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Freeze Stock Entries", "length": 0, "no_copy": 0, @@ -424,6 +475,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -434,6 +486,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "stock_frozen_upto", "fieldtype": "Date", "hidden": 0, @@ -441,6 +494,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Stock Frozen Upto", "length": 0, "no_copy": 0, @@ -448,6 +502,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -458,6 +513,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "stock_frozen_upto_days", "fieldtype": "Int", "hidden": 0, @@ -465,6 +521,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Freeze Stocks Older Than [Days]", "length": 0, "no_copy": 0, @@ -472,6 +529,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -482,6 +540,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "stock_auth_role", "fieldtype": "Link", "hidden": 0, @@ -489,6 +548,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Role Allowed to edit frozen stock", "length": 0, "no_copy": 0, @@ -497,6 +557,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -506,15 +567,16 @@ ], "hide_heading": 0, "hide_toolbar": 0, - "icon": "fa fa-cog", + "icon": "icon-cog", "idx": 1, + "image_view": 0, "in_create": 0, "in_dialog": 0, "is_submittable": 0, "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2016-05-12 12:28:29.374452", + "modified": "2016-12-16 02:18:58.187847", "modified_by": "Administrator", "module": "Stock", "name": "Stock Settings", @@ -530,6 +592,7 @@ "export": 0, "if_owner": 0, "import": 0, + "is_custom": 0, "permlevel": 0, "print": 1, "read": 1, From a83de5eac1e8380ed23c65d64f6fb47076f2de94 Mon Sep 17 00:00:00 2001 From: bhupen Date: Thu, 22 Dec 2016 14:17:22 +0530 Subject: [PATCH 3/4] applicabe charges field is now editable --- .../landed_cost_item/landed_cost_item.json | 35 ++++- .../landed_cost_taxes_and_charges.json | 12 +- .../landed_cost_voucher.js | 24 +++- .../landed_cost_voucher.json | 123 +++++++++++++----- .../landed_cost_voucher.py | 22 ++-- 5 files changed, 163 insertions(+), 53 deletions(-) diff --git a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.json b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.json index e679054815..61c19f0583 100644 --- a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.json +++ b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.json @@ -9,11 +9,13 @@ "doctype": "DocType", "document_type": "Document", "editable_grid": 1, + "engine": "InnoDB", "fields": [ { "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "item_code", "fieldtype": "Link", "hidden": 0, @@ -21,6 +23,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Item Code", "length": 0, "no_copy": 0, @@ -29,6 +32,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -40,6 +44,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "description", "fieldtype": "Text Editor", "hidden": 0, @@ -47,6 +52,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Description", "length": 0, "no_copy": 0, @@ -57,6 +63,7 @@ "print_hide_if_no_value": 0, "print_width": "300px", "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -68,6 +75,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "receipt_document_type", "fieldtype": "Select", "hidden": 0, @@ -75,6 +83,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Receipt Document Type", "length": 0, "no_copy": 1, @@ -84,6 +93,7 @@ "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -94,6 +104,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "receipt_document", "fieldtype": "Dynamic Link", "hidden": 0, @@ -101,6 +112,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Receipt Document", "length": 0, "no_copy": 1, @@ -110,6 +122,7 @@ "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -120,6 +133,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "col_break2", "fieldtype": "Column Break", "hidden": 0, @@ -127,12 +141,14 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -143,6 +159,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "qty", "fieldtype": "Float", "hidden": 0, @@ -150,6 +167,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Qty", "length": 0, "no_copy": 0, @@ -157,6 +175,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -167,6 +186,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "rate", "fieldtype": "Currency", "hidden": 0, @@ -174,6 +194,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Rate", "length": 0, "no_copy": 0, @@ -182,6 +203,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -192,6 +214,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "amount", "fieldtype": "Currency", "hidden": 0, @@ -199,6 +222,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Amount", "length": 0, "no_copy": 0, @@ -209,6 +233,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -219,6 +244,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "applicable_charges", "fieldtype": "Currency", "hidden": 0, @@ -226,6 +252,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Applicable Charges", "length": 0, "no_copy": 0, @@ -233,7 +260,8 @@ "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 1, + "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -244,6 +272,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "purchase_receipt_item", "fieldtype": "Data", "hidden": 1, @@ -251,6 +280,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Purchase Receipt Item", "length": 0, "no_copy": 1, @@ -258,6 +288,7 @@ "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -275,7 +306,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-07-11 03:28:01.757912", + "modified": "2016-12-20 04:50:19.785273", "modified_by": "Administrator", "module": "Stock", "name": "Landed Cost Item", diff --git a/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.json b/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.json index b1f5a8ccdb..dbc6a88ba3 100644 --- a/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.json +++ b/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.json @@ -9,11 +9,13 @@ "doctype": "DocType", "document_type": "", "editable_grid": 1, + "engine": "InnoDB", "fields": [ { "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "description", "fieldtype": "Text Editor", "hidden": 0, @@ -21,6 +23,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Description", "length": 0, "no_copy": 0, @@ -28,6 +31,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -38,6 +42,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "col_break3", "fieldtype": "Column Break", "hidden": 0, @@ -45,12 +50,14 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -62,6 +69,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "amount", "fieldtype": "Currency", "hidden": 0, @@ -69,6 +77,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Amount", "length": 0, "no_copy": 0, @@ -77,6 +86,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -94,7 +104,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-07-11 03:28:01.958276", + "modified": "2016-12-20 05:44:54.700163", "modified_by": "Administrator", "module": "Stock", "name": "Landed Cost Taxes and Charges", diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js index 525853bf44..5035379e8b 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js @@ -32,7 +32,7 @@ erpnext.stock.LandedCostVoucher = erpnext.stock.StockController.extend({ }, - refresh: function() { + refresh: function(frm) { var help_content = [ '

', '', @@ -70,12 +70,15 @@ erpnext.stock.LandedCostVoucher = erpnext.stock.StockController.extend({ } else { return this.frm.call({ doc: me.frm.doc, - method: "get_items_from_purchase_receipts" + method: "get_items_from_purchase_receipts", + callback: function(r, rt) { + me.set_applicable_charges_for_item(); + } }); } }, - amount: function() { + amount: function(frm) { this.set_total_taxes_and_charges(); this.set_applicable_charges_for_item(); }, @@ -90,17 +93,28 @@ erpnext.stock.LandedCostVoucher = erpnext.stock.StockController.extend({ set_applicable_charges_for_item: function() { var me = this; + + + console.log(this.frm) if(this.frm.doc.taxes.length) { + var total_item_cost = 0.0; + var based_on = this.frm.doc.distribute_charges_based_on.toLowerCase(); $.each(this.frm.doc.items || [], function(i, d) { - total_item_cost += flt(d.amount) + total_item_cost += flt(d[based_on]) }); $.each(this.frm.doc.items || [], function(i, item) { - item.applicable_charges = flt(item.amount) * flt(me.frm.doc.total_taxes_and_charges) / flt(total_item_cost) + + item.applicable_charges = flt(item[based_on]) * flt(me.frm.doc.total_taxes_and_charges) / flt(total_item_cost) + + }); refresh_field("items"); } + }, + distribute_charges_based_on: function (frm) { + this.set_applicable_charges_for_item(); } }); diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json index 227541f375..db6e40207a 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json @@ -10,6 +10,7 @@ "doctype": "DocType", "document_type": "Document", "editable_grid": 0, + "engine": "InnoDB", "fields": [ { "allow_on_submit": 0, @@ -96,6 +97,34 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "purchase_receipt_items", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Purchase Receipt Items", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -151,6 +180,35 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sec_break1", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Additional Charges", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -184,7 +242,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "sec_break1", + "fieldname": "section_break_9", "fieldtype": "Section Break", "hidden": 0, "ignore_user_permissions": 0, @@ -194,7 +252,6 @@ "in_standard_filter": 0, "length": 0, "no_copy": 0, - "options": "Simple", "permlevel": 0, "precision": "", "print_hide": 0, @@ -235,34 +292,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Amended From", - "length": 0, - "no_copy": 1, - "options": "Landed Cost Voucher", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_on_submit": 0, "bold": 0, @@ -295,7 +324,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "Amount", + "default": "", "fieldname": "distribute_charges_based_on", "fieldtype": "Select", "hidden": 0, @@ -320,6 +349,34 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Landed Cost Voucher", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -378,7 +435,7 @@ ], "hide_heading": 0, "hide_toolbar": 0, - "icon": "fa fa-usd", + "icon": "icon-usd", "idx": 0, "image_view": 0, "in_create": 0, @@ -387,7 +444,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-11-07 05:09:46.981120", + "modified": "2016-12-21 01:40:13.959409", "modified_by": "Administrator", "module": "Stock", "name": "Landed Cost Voucher", diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py index cdf7263126..aacf02c4e0 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py @@ -29,9 +29,6 @@ class LandedCostVoucher(Document): item.receipt_document = pr.receipt_document item.purchase_receipt_item = d.name - if self.get("taxes"): - self.set_applicable_charges_for_item() - def validate(self): self.check_mandatory() self.validate_purchase_receipts() @@ -39,15 +36,13 @@ class LandedCostVoucher(Document): if not self.get("items"): self.get_items_from_purchase_receipts() else: - self.set_applicable_charges_for_item() + self.validate_applicable_charges_for_item() def check_mandatory(self): if not self.get("purchase_receipts"): frappe.throw(_("Please enter Receipt Document")) - if not self.get("taxes"): - frappe.throw(_("Please enter Taxes and Charges")) - + def validate_purchase_receipts(self): receipt_documents = [] @@ -67,15 +62,18 @@ class LandedCostVoucher(Document): def set_total_taxes_and_charges(self): self.total_taxes_and_charges = sum([flt(d.amount) for d in self.get("taxes")]) - def set_applicable_charges_for_item(self): + def validate_applicable_charges_for_item(self): based_on = self.distribute_charges_based_on.lower() + total = sum([flt(d.get(based_on)) for d in self.get("items")]) - + if not total: - frappe.throw(_("Total {0} for all items is zero, may you should change 'Distribute Charges Based On'").format(based_on)) + frappe.throw(_("Total {0} for all items is zero, may be you should change 'Distribute Charges Based On'").format(based_on)) + + if self.total_taxes_and_charges != sum([flt(d.applicable_charges) for d in self.get("items")]): + frappe.throw(_("Total Applicable Charges in Purchase Receipt Items table must be same as Total Taxes and Charges")) + - for item in self.get("items"): - item.applicable_charges = flt(item.get(based_on)) * flt(self.total_taxes_and_charges) / flt(total) def on_submit(self): self.update_landed_cost() From 1e1e28b0ae8f8d8ebc6193f9c0c70cbb1518be14 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 23 Dec 2016 15:48:57 +0530 Subject: [PATCH 4/4] Update landed_cost_voucher.js --- .../doctype/landed_cost_voucher/landed_cost_voucher.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js index 5035379e8b..b97378f6d8 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js @@ -94,8 +94,6 @@ erpnext.stock.LandedCostVoucher = erpnext.stock.StockController.extend({ set_applicable_charges_for_item: function() { var me = this; - - console.log(this.frm) if(this.frm.doc.taxes.length) { var total_item_cost = 0.0; @@ -105,10 +103,7 @@ erpnext.stock.LandedCostVoucher = erpnext.stock.StockController.extend({ }); $.each(this.frm.doc.items || [], function(i, item) { - - item.applicable_charges = flt(item[based_on]) * flt(me.frm.doc.total_taxes_and_charges) / flt(total_item_cost) - - + item.applicable_charges = flt(item[based_on]) * flt(me.frm.doc.total_taxes_and_charges) / flt(total_item_cost) }); refresh_field("items"); }