From 82763f052f502d94a339ae588a8540b8c03b810d Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Mon, 8 Jun 2015 16:57:23 +0530 Subject: [PATCH 1/3] Status Indicators fixed in Material Request List --- .../stock/doctype/material_request/material_request.json | 4 ++-- .../doctype/material_request/material_request_list.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json index 894b9e1343..aec242f285 100644 --- a/erpnext/stock/doctype/material_request/material_request.json +++ b/erpnext/stock/doctype/material_request/material_request.json @@ -148,7 +148,7 @@ "no_copy": 1, "oldfieldname": "status", "oldfieldtype": "Select", - "options": "\nDraft\nSubmitted\nStopped\nCancelled", + "options": "\nDraft\nSubmitted\nIssued\nOrdered\nTransfered\nStopped\nCancelled", "permlevel": 0, "print_hide": 1, "print_width": "100px", @@ -221,7 +221,7 @@ "icon": "icon-ticket", "idx": 1, "is_submittable": 1, - "modified": "2015-05-27 15:36:06.818491", + "modified": "2015-06-08 07:24:47.954499", "modified_by": "Administrator", "module": "Stock", "name": "Material Request", diff --git a/erpnext/stock/doctype/material_request/material_request_list.js b/erpnext/stock/doctype/material_request/material_request_list.js index 293d96026a..390e22272f 100644 --- a/erpnext/stock/doctype/material_request/material_request_list.js +++ b/erpnext/stock/doctype/material_request/material_request_list.js @@ -6,7 +6,13 @@ frappe.listview_settings['Material Request'] = { } else if(doc.docstatus==1 && flt(doc.per_ordered) < 100) { return [__("Pending"), "orange", "per_ordered,<,100"]; } else if(doc.docstatus==1 && flt(doc.per_ordered) == 100) { - return [__("Ordered"), "green", "per_ordered,=,100"]; + if (doc.material_request_type == "Purchase") { + return [__("Ordered"), "green", "per_ordered,=,100"]; + } else if (doc.material_request_type == "Material Transfer") { + return [__("Transfered"), "green", "per_ordered,=,100"]; + } else if (doc.material_request_type == "Material Issue") { + return [__("Issued"), "green", "per_ordered,=,100"]; + } } } }; From f64fae752f204240c9507747f1cf0d6f334f1497 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 9 Jun 2015 15:17:33 +0530 Subject: [PATCH 2/3] fixes --- erpnext/patches/v5_0/item_variants.py | 33 +++++++++++++++++++ .../material_request/material_request.json | 4 +-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/v5_0/item_variants.py diff --git a/erpnext/patches/v5_0/item_variants.py b/erpnext/patches/v5_0/item_variants.py new file mode 100644 index 0000000000..aeaf729681 --- /dev/null +++ b/erpnext/patches/v5_0/item_variants.py @@ -0,0 +1,33 @@ +import frappe + +def execute(): + variant_item = frappe.db.get_all("Item", + fields=["name"], + filters={"has_variants": 1}) + + for d in variant_item: + pass + + def get_variant_item_codes(self): + """Get all possible suffixes for variants""" + variant_dict = {} + for d in self.attributes: + variant_dict.setdefault(d.attribute, []).append(d.attribute_value) + + all_attributes = [d.name for d in frappe.get_all("Item Attribute", order_by = "priority asc")] + + # sort attributes by their priority + attributes = filter(None, map(lambda d: d if d in variant_dict else None, all_attributes)) + + def add_attribute_suffixes(item_code, my_attributes, attributes): + attr = frappe.get_doc("Item Attribute", attributes[0]) + for value in attr.item_attribute_values: + if value.attribute_value in variant_dict[attr.name]: + _my_attributes = copy.deepcopy(my_attributes) + _my_attributes.append([attr.name, value.attribute_value]) + if len(attributes) > 1: + add_attribute_suffixes(item_code + "-" + value.abbr, _my_attributes, attributes[1:]) + else: + self.append('variants', {"variant": item_code + "-" + value.abbr, + "attributes": json.dumps(_my_attributes)}) + add_attribute_suffixes(self.item, [], attributes) \ No newline at end of file diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json index aec242f285..a3026c4ca4 100644 --- a/erpnext/stock/doctype/material_request/material_request.json +++ b/erpnext/stock/doctype/material_request/material_request.json @@ -148,7 +148,7 @@ "no_copy": 1, "oldfieldname": "status", "oldfieldtype": "Select", - "options": "\nDraft\nSubmitted\nIssued\nOrdered\nTransfered\nStopped\nCancelled", + "options": "\nDraft\nSubmitted\nStopped\nCancelled", "permlevel": 0, "print_hide": 1, "print_width": "100px", @@ -221,7 +221,7 @@ "icon": "icon-ticket", "idx": 1, "is_submittable": 1, - "modified": "2015-06-08 07:24:47.954499", + "modified": "2015-06-09 05:47:05.934432", "modified_by": "Administrator", "module": "Stock", "name": "Material Request", From 5d288e407c7b4b3287eebf1af276834b10edff3d Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 9 Jun 2015 15:46:42 +0530 Subject: [PATCH 3/3] item variants patch removed --- erpnext/patches/v5_0/item_variants.py | 33 --------------------------- 1 file changed, 33 deletions(-) delete mode 100644 erpnext/patches/v5_0/item_variants.py diff --git a/erpnext/patches/v5_0/item_variants.py b/erpnext/patches/v5_0/item_variants.py deleted file mode 100644 index aeaf729681..0000000000 --- a/erpnext/patches/v5_0/item_variants.py +++ /dev/null @@ -1,33 +0,0 @@ -import frappe - -def execute(): - variant_item = frappe.db.get_all("Item", - fields=["name"], - filters={"has_variants": 1}) - - for d in variant_item: - pass - - def get_variant_item_codes(self): - """Get all possible suffixes for variants""" - variant_dict = {} - for d in self.attributes: - variant_dict.setdefault(d.attribute, []).append(d.attribute_value) - - all_attributes = [d.name for d in frappe.get_all("Item Attribute", order_by = "priority asc")] - - # sort attributes by their priority - attributes = filter(None, map(lambda d: d if d in variant_dict else None, all_attributes)) - - def add_attribute_suffixes(item_code, my_attributes, attributes): - attr = frappe.get_doc("Item Attribute", attributes[0]) - for value in attr.item_attribute_values: - if value.attribute_value in variant_dict[attr.name]: - _my_attributes = copy.deepcopy(my_attributes) - _my_attributes.append([attr.name, value.attribute_value]) - if len(attributes) > 1: - add_attribute_suffixes(item_code + "-" + value.abbr, _my_attributes, attributes[1:]) - else: - self.append('variants', {"variant": item_code + "-" + value.abbr, - "attributes": json.dumps(_my_attributes)}) - add_attribute_suffixes(self.item, [], attributes) \ No newline at end of file