From 66df3566a99a0b9b32b449b3d32d7f6f30d3bccc Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 10 Feb 2015 13:05:08 +0530 Subject: [PATCH 1/8] html item desc removed from item master, item image added in oppurtunity --- .../crm/doctype/opportunity/opportunity.js | 17 +++++++- .../crm/doctype/opportunity/opportunity.py | 27 ++++++------- .../opportunity_item/opportunity_item.json | 37 ++++++++++++++++-- erpnext/stock/doctype/item/item.js | 24 ------------ erpnext/stock/doctype/item/item.json | 39 +++++++++---------- 5 files changed, 80 insertions(+), 64 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index a0ebcce6eb..8f93b2df85 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -94,8 +94,21 @@ cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) { cur_frm.cscript.item_code = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; if (d.item_code) { - return get_server_fields('get_item_details', d.item_code, - 'items', doc, cdt, cdn, 1); + return frappe.call({ + method: "erpnext.selling.doctype.opportunity.opportunity.get_item_details", + args: {"item_code":d.item_code}, + callback: function(r, rt) { + if(r.message) { + frappe.model.set_value(d.doctype, d.name, "description", r.message.description); + frappe.model.set_value(d.doctype, d.name, "item_name", r.message.item_name); + frappe.model.set_value(d.doctype, d.name, "brand", r.message.brand); + frappe.model.set_value(d.doctype, d.name, "uom", r.message.uom); + frappe.model.set_value(d.doctype, d.name, "item_group", r.message.item_group); + frappe.model.set_value(d.doctype, d.name, "image", r.message.image); + refresh_field('image_view', d.name, 'items'); + } + } + }) } } diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 31af3cdd26..39dd61439c 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -59,18 +59,6 @@ class Opportunity(TransactionBase): def validate_cust_name(self): self.customer_name = self.customer or self.lead - - def get_item_details(self, item_code): - item = frappe.db.sql("""select item_name, stock_uom, description_html, description, item_group, brand - from `tabItem` where name = %s""", item_code, as_dict=1) - ret = { - 'item_name': item and item[0]['item_name'] or '', - 'uom': item and item[0]['stock_uom'] or '', - 'description': item and item[0]['description_html'] or item[0]['description'] or '', - 'item_group': item and item[0]['item_group'] or '', - 'brand': item and item[0]['brand'] or '' - } - return ret def get_cust_address(self,name): details = frappe.db.sql("""select customer_name, address, territory, customer_group @@ -140,7 +128,20 @@ class Opportunity(TransactionBase): msgprint("Customer is mandatory if 'Opportunity From' is selected as Customer", raise_exception=1) else: self.lead = None - + +@frappe.whitelist() +def get_item_details(item_code): + item = frappe.db.sql("""select item_name, stock_uom, image, description, item_group, brand + from `tabItem` where name = %s""", item_code, as_dict=1) + return { + 'item_name': item and item[0]['item_name'] or '', + 'uom': item and item[0]['stock_uom'] or '', + 'description': item and item[0]['description'] or '', + 'image': item and item[0]['image'] or '', + 'item_group': item and item[0]['item_group'] or '', + 'brand': item and item[0]['brand'] or '' + } + @frappe.whitelist() def make_quotation(source_name, target_doc=None): def set_missing_values(source, target): diff --git a/erpnext/selling/doctype/opportunity_item/opportunity_item.json b/erpnext/selling/doctype/opportunity_item/opportunity_item.json index b6527e0af9..d81b1b7ff7 100644 --- a/erpnext/selling/doctype/opportunity_item/opportunity_item.json +++ b/erpnext/selling/doctype/opportunity_item/opportunity_item.json @@ -14,6 +14,11 @@ "permlevel": 0, "reqd": 0 }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, { "fieldname": "item_name", "fieldtype": "Data", @@ -52,9 +57,10 @@ "search_index": 0 }, { - "fieldname": "col_break1", - "fieldtype": "Column Break", - "permlevel": 0 + "fieldname": "section_break_6", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" }, { "fieldname": "description", @@ -68,6 +74,29 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "column_break_8", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 0, + "label": "Image", + "options": "", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -115,7 +144,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:58.657537", + "modified": "2015-02-10 13:03:39.188558", "modified_by": "Administrator", "module": "Selling", "name": "Opportunity Item", diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 4e82c55898..af7e7f0f24 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -150,22 +150,6 @@ cur_frm.fields_dict['item_group'].get_query = function(doc,cdt,cdn) { } } -cur_frm.cscript.add_image = function(doc, dt, dn) { - if(!doc.image) { - msgprint(__('Please select an "Image" first')); - return; - } - - doc.description_html = repl('' + - '' + - '' + - '
%(desc)s
', { - imgurl: frappe.utils.get_file_link(doc.image), - desc: doc.description.replace(/\n/g, "
")}); - - refresh_field('description_html'); -} - // Quotation to validation - either customer or lead mandatory cur_frm.cscript.weight_to_validate = function(doc, cdt, cdn){ if((doc.nett_weight || doc.gross_weight) && !doc.weight_uom) { @@ -195,12 +179,4 @@ cur_frm.cscript.copy_from_item_group = function(doc) { cur_frm.cscript.image = function() { refresh_field("image_view"); - - if(!cur_frm.doc.image) return; - - if(!cur_frm.doc.description_html) - cur_frm.cscript.add_image(cur_frm.doc); - else { - msgprint(__("You may need to update: {0}", [frappe.meta.get_docfield(cur_frm.doc.doctype, "description_html").label])); - } } diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 36d2109784..c2f2a9b0d3 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -79,6 +79,12 @@ "read_only": 0, "reqd": 1 }, + { + "fieldname": "column_break0", + "fieldtype": "Column Break", + "permlevel": 0, + "read_only": 0 + }, { "description": "Unit of measurement of this item (e.g. Kg, Unit, No, Pair).", "fieldname": "stock_uom", @@ -112,9 +118,15 @@ "permlevel": 0, "read_only": 0 }, + { + "fieldname": "section_break_11", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" + }, { "fieldname": "description", - "fieldtype": "Small Text", + "fieldtype": "Text Editor", "in_filter": 0, "in_list_view": 0, "label": "Description", @@ -126,10 +138,10 @@ "search_index": 0 }, { - "fieldname": "column_break0", + "fieldname": "column_break_13", "fieldtype": "Column Break", "permlevel": 0, - "read_only": 0 + "precision": "" }, { "fieldname": "image", @@ -137,7 +149,7 @@ "label": "Image", "options": "", "permlevel": 0, - "read_only": 0 + "precision": "" }, { "fieldname": "image_view", @@ -146,22 +158,7 @@ "label": "Image View", "options": "image", "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "description_html", - "fieldtype": "Small Text", - "label": "Description HTML", - "permlevel": 0, - "read_only": 0 - }, - { - "description": "Generates HTML to include selected image in the description", - "fieldname": "add_image", - "fieldtype": "Button", - "label": "Generate Description HTML", - "permlevel": 0, - "read_only": 0 + "precision": "" }, { "fieldname": "variants_section", @@ -864,7 +861,7 @@ "icon": "icon-tag", "idx": 1, "max_attachments": 1, - "modified": "2015-02-05 05:11:39.507487", + "modified": "2015-02-10 12:59:15.652054", "modified_by": "Administrator", "module": "Stock", "name": "Item", From c48f06c095346e3018831a758f892e5c4b087abd Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 10 Feb 2015 16:49:16 +0530 Subject: [PATCH 2/8] Image field and view added to all selling doctypes --- .../crm/doctype/opportunity/opportunity.js | 11 +++--- erpnext/public/js/controllers/transaction.js | 1 + .../quotation_item/quotation_item.json | 17 ++++++++- .../sales_order_item/sales_order_item.json | 33 +++++++++++++++-- .../material_request_item.json | 35 ++++++++++++++++--- .../stock_entry_detail.json | 35 ++++++++++++++++--- erpnext/stock/get_item_details.py | 3 +- 7 files changed, 115 insertions(+), 20 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index 8f93b2df85..10cfc3ab00 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -99,13 +99,10 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) { args: {"item_code":d.item_code}, callback: function(r, rt) { if(r.message) { - frappe.model.set_value(d.doctype, d.name, "description", r.message.description); - frappe.model.set_value(d.doctype, d.name, "item_name", r.message.item_name); - frappe.model.set_value(d.doctype, d.name, "brand", r.message.brand); - frappe.model.set_value(d.doctype, d.name, "uom", r.message.uom); - frappe.model.set_value(d.doctype, d.name, "item_group", r.message.item_group); - frappe.model.set_value(d.doctype, d.name, "image", r.message.image); - refresh_field('image_view', d.name, 'items'); + $.each(r.message, function(k, v) { + frappe.model.set_value(cdt, cdn, k, v); + }); + refresh_field('image_view', d.name, 'items'); } } }) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index c8b028b12c..cea4d03835 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -68,6 +68,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ item_code: function(doc, cdt, cdn) { var me = this; + var d = locals[cdt][cdn]; var item = frappe.get_doc(cdt, cdn); if(item.item_code || item.barcode || item.serial_no) { if(!this.validate_company_and_party()) { diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json index 04f0f10faf..a1031a3158 100644 --- a/erpnext/selling/doctype/quotation_item/quotation_item.json +++ b/erpnext/selling/doctype/quotation_item/quotation_item.json @@ -66,6 +66,21 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -332,7 +347,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:59.329982", + "modified": "2015-02-10 15:21:17.447331", "modified_by": "Administrator", "module": "Selling", "name": "Quotation Item", diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json index 640e992ce6..4d676efaff 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json @@ -29,6 +29,11 @@ "print_hide": 1, "read_only": 1 }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, { "fieldname": "item_name", "fieldtype": "Data", @@ -44,9 +49,10 @@ "width": "150" }, { - "fieldname": "col_break1", - "fieldtype": "Column Break", - "permlevel": 0 + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" }, { "fieldname": "description", @@ -63,6 +69,27 @@ "search_index": 1, "width": "300px" }, + { + "fieldname": "column_break_7", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.json b/erpnext/stock/doctype/material_request_item/material_request_item.json index c6574eaa72..e5b7b696c2 100644 --- a/erpnext/stock/doctype/material_request_item/material_request_item.json +++ b/erpnext/stock/doctype/material_request_item/material_request_item.json @@ -19,6 +19,11 @@ "search_index": 1, "width": "100px" }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, { "fieldname": "item_name", "fieldtype": "Data", @@ -35,9 +40,10 @@ "width": "100px" }, { - "fieldname": "col_break1", - "fieldtype": "Column Break", - "permlevel": 0 + "fieldname": "section_break_4", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" }, { "fieldname": "description", @@ -51,6 +57,27 @@ "reqd": 1, "width": "250px" }, + { + "fieldname": "column_break_6", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_warehouse", "fieldtype": "Section Break", @@ -235,7 +262,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:59.597199", + "modified": "2015-02-10 16:14:59.940476", "modified_by": "Administrator", "module": "Stock", "name": "Material Request Item", diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json index 7e737ef509..98b5038e0e 100644 --- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json +++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json @@ -54,6 +54,11 @@ "reqd": 1, "search_index": 1 }, + { + "fieldname": "col_break2", + "fieldtype": "Column Break", + "permlevel": 0 + }, { "fieldname": "item_name", "fieldtype": "Data", @@ -63,9 +68,10 @@ "read_only": 1 }, { - "fieldname": "col_break2", - "fieldtype": "Column Break", - "permlevel": 0 + "fieldname": "section_break_8", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" }, { "fieldname": "description", @@ -79,6 +85,27 @@ "read_only": 0, "width": "300px" }, + { + "fieldname": "column_break_10", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -302,7 +329,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-08-11 03:54:49.688635", + "modified": "2015-02-10 16:18:48.313676", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry Detail", diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 9d0f3b86a4..29897ef072 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -147,7 +147,8 @@ def get_basic_details(args, item): out = frappe._dict({ "item_code": item.name, "item_name": item.item_name, - "description": cstr(item.description_html).strip() or cstr(item.description).strip(), + "description": cstr(item.description).strip(), + "image": cstr(item.image).strip(), "warehouse": user_default_warehouse or args.warehouse or item.default_warehouse, "income_account": get_default_income_account(args, item), "expense_account": get_default_expense_account(args, item), From 6f51c2e4cc1e36fee2d271bfa3d0a539a3441e7e Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 10 Feb 2015 17:12:09 +0530 Subject: [PATCH 3/8] Image field and view added to all buying doctypes --- .../purchase_order_item.json | 35 ++++++++++++++++--- .../supplier_quotation_item.json | 35 ++++++++++++++++--- 2 files changed, 62 insertions(+), 8 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json index 4b23c9f411..65bb7f4d39 100755 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -44,6 +44,12 @@ "reqd": 1, "search_index": 1 }, + { + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, { "fieldname": "schedule_date", "fieldtype": "Date", @@ -61,9 +67,10 @@ "search_index": 1 }, { - "fieldname": "col_break1", - "fieldtype": "Column Break", - "permlevel": 0 + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" }, { "fieldname": "description", @@ -78,6 +85,26 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -455,7 +482,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:59.868306", + "modified": "2015-02-10 17:11:03.236900", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order Item", diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json index 349e38ea2a..b42b2b678d 100644 --- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json +++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json @@ -29,6 +29,12 @@ "print_hide": 1, "read_only": 1 }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, { "fieldname": "item_name", "fieldtype": "Data", @@ -45,9 +51,10 @@ "search_index": 1 }, { - "fieldname": "col_break1", - "fieldtype": "Column Break", - "permlevel": 0 + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" }, { "fieldname": "description", @@ -62,6 +69,26 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -331,7 +358,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:59.198926", + "modified": "2015-02-10 17:08:37.920315", "modified_by": "Administrator", "module": "Buying", "name": "Supplier Quotation Item", From 3361df709c63be8f0ef49a5c186c1308427e3f6f Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Thu, 12 Feb 2015 10:39:43 +0530 Subject: [PATCH 4/8] Image field and view added to all stock doctypes --- .../delivery_note_item.json | 29 ++++++++++++++- .../purchase_receipt_item.json | 35 ++++++++++++++++--- .../stock/doctype/stock_entry/stock_entry.py | 3 +- 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json index b94a267f64..0ac66ac021 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -56,6 +56,12 @@ "print_hide": 1, "read_only": 1 }, + { + "fieldname": "section_break_6", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" + }, { "fieldname": "description", "fieldtype": "Small Text", @@ -69,6 +75,27 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "column_break_8", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -438,7 +465,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:59.711539", + "modified": "2015-02-12 10:34:45.460334", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json index 5e9594e535..984732e66d 100755 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -20,6 +20,12 @@ "search_index": 1, "width": "100px" }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, { "fieldname": "item_name", "fieldtype": "Data", @@ -35,9 +41,10 @@ "search_index": 0 }, { - "fieldname": "col_break1", - "fieldtype": "Column Break", - "permlevel": 0 + "fieldname": "section_break_4", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" }, { "fieldname": "description", @@ -52,6 +59,26 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "received_and_accepted", "fieldtype": "Section Break", @@ -559,7 +586,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:30:00.032715", + "modified": "2015-02-12 10:37:31.933726", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index ab9017036a..8b47df7fe3 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -432,7 +432,7 @@ class StockEntry(StockController): }) def get_item_details(self, args): - item = frappe.db.sql("""select stock_uom, description, item_name, + item = frappe.db.sql("""select stock_uom, description, image, item_name, expense_account, buying_cost_center, item_group from `tabItem` where name = %s and (ifnull(end_of_life,'0000-00-00')='0000-00-00' or end_of_life > now())""", (args.get('item_code')), as_dict = 1) @@ -444,6 +444,7 @@ class StockEntry(StockController): 'uom' : item.stock_uom, 'stock_uom' : item.stock_uom, 'description' : item.description, + 'image' : item.image, 'item_name' : item.item_name, 'expense_account' : args.get("expense_account") \ or frappe.db.get_value("Company", args.get("company"), "stock_adjustment_account"), From 7f70367ddebfb7c992c40f0adb1dc046ef7fa98f Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Thu, 12 Feb 2015 12:54:52 +0530 Subject: [PATCH 5/8] image view fixed for stock entry and bom --- erpnext/manufacturing/doctype/bom/bom.js | 7 +++- erpnext/manufacturing/doctype/bom/bom.json | 27 ++++++++++++++ erpnext/manufacturing/doctype/bom/bom.py | 17 +++++---- .../bom_explosion_item.json | 33 +++++++++++++++-- .../doctype/bom_item/bom_item.json | 37 ++++++++++++++++--- .../stock/doctype/stock_entry/stock_entry.js | 31 +++++++++++----- .../stock/doctype/stock_entry/stock_entry.py | 4 +- 7 files changed, 128 insertions(+), 28 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index a230cf4ab9..22bddaa69a 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -23,6 +23,7 @@ cur_frm.cscript.update_cost = function() { } cur_frm.add_fetch("item", "description", "description"); +cur_frm.add_fetch("item", "image", "image"); cur_frm.add_fetch("item", "item_name", "item_name"); cur_frm.add_fetch("item", "stock_uom", "uom"); @@ -201,4 +202,8 @@ frappe.ui.form.on("BOM Operation", "operations_remove", function(frm) { frappe.ui.form.on("BOM Item", "items_remove", function(frm) { erpnext.bom.calculate_rm_cost(frm.doc); erpnext.bom.calculate_total(frm.doc); -}); \ No newline at end of file +}); + +cur_frm.cscript.image = function() { + refresh_field("image_view"); +} \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/bom/bom.json b/erpnext/manufacturing/doctype/bom/bom.json index 05350d5877..8866100cc5 100644 --- a/erpnext/manufacturing/doctype/bom/bom.json +++ b/erpnext/manufacturing/doctype/bom/bom.json @@ -213,6 +213,12 @@ "permlevel": 0, "read_only": 1 }, + { + "fieldname": "section_break_25", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" + }, { "fieldname": "description", "fieldtype": "Small Text", @@ -221,6 +227,27 @@ "permlevel": 0, "read_only": 1 }, + { + "fieldname": "column_break_27", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "Image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "depends_on": "eval:!doc.__islocal", "fieldname": "section_break0", diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 702fdef4ec..6c50c86d0e 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -55,7 +55,7 @@ class BOM(Document): def get_item_det(self, item_code): item = frappe.db.sql("""select name, item_name, is_asset_item, is_purchase_item, - docstatus, description, is_sub_contracted_item, stock_uom, default_bom, + docstatus, description, image, is_sub_contracted_item, stock_uom, default_bom, last_purchase_rate from `tabItem` where name=%s""", item_code, as_dict = 1) @@ -96,6 +96,7 @@ class BOM(Document): ret_item = { 'item_name' : item and args['item_name'] or '', 'description' : item and args['description'] or '', + 'image' : item and args['image'] or '', 'stock_uom' : item and args['stock_uom'] or '', 'bom_no' : args['bom_no'], 'rate' : rate @@ -298,12 +299,13 @@ class BOM(Document): self.get_child_exploded_items(d.bom_no, d.qty) else: self.add_to_cur_exploded_items(frappe._dict({ - 'item_code' : d.item_code, - 'item_name' : d.item_name, - 'description' : d.description, - 'stock_uom' : d.stock_uom, - 'qty' : flt(d.qty), - 'rate' : flt(d.rate), + 'item_code' : d.item_code, + 'item_name' : d.item_name, + 'description' : d.description, + 'image' : d.image, + 'stock_uom' : d.stock_uom, + 'qty' : flt(d.qty), + 'rate' : flt(d.rate), })) def add_to_cur_exploded_items(self, args): @@ -367,6 +369,7 @@ def get_bom_items_as_dict(bom, qty=1, fetch_exploded=1): item.item_name, sum(ifnull(bom_item.qty, 0)/ifnull(bom.quantity, 1)) * %(qty)s as qty, item.description, + item.image, item.stock_uom, item.default_warehouse, item.expense_account as expense_account, diff --git a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json index 71b6da5f8d..aa5294ce5a 100644 --- a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json +++ b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json @@ -16,6 +16,12 @@ "permlevel": 0, "read_only": 1 }, + { + "fieldname": "cb", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, { "fieldname": "item_name", "fieldtype": "Data", @@ -26,8 +32,8 @@ "read_only": 1 }, { - "fieldname": "column_break_2", - "fieldtype": "Column Break", + "fieldname": "section_break_3", + "fieldtype": "Section Break", "permlevel": 0, "precision": "" }, @@ -43,6 +49,27 @@ "read_only": 1, "width": "300px" }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "section_break_4", "fieldtype": "Section Break", @@ -111,7 +138,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-20 13:28:52.258152", + "modified": "2015-02-12 12:23:57.127210", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Explosion Item", diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.json b/erpnext/manufacturing/doctype/bom_item/bom_item.json index 6786ead00b..2459b8e1bd 100644 --- a/erpnext/manufacturing/doctype/bom_item/bom_item.json +++ b/erpnext/manufacturing/doctype/bom_item/bom_item.json @@ -24,6 +24,12 @@ "permlevel": 0, "precision": "" }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, { "fieldname": "bom_no", "fieldtype": "Link", @@ -40,9 +46,10 @@ "width": "150px" }, { - "fieldname": "col_break1", - "fieldtype": "Column Break", - "permlevel": 0 + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" }, { "fieldname": "description", @@ -55,6 +62,26 @@ "reqd": 0, "width": "250px" }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -133,8 +160,8 @@ } ], "idx": 1, - "istable": 1, - "modified": "2015-01-20 13:28:35.152945", + "istable": 1, + "modified": "2015-02-12 10:41:31.336921", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Item", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index a77aa748ea..527cbf3032 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -384,9 +384,9 @@ cur_frm.fields_dict['items'].grid.get_field('batch_no').get_query = function(doc return{ query: "erpnext.stock.doctype.stock_entry.stock_entry.get_batch_no", filters:{ - 'item_code': d.item_code, - 's_warehouse': d.s_warehouse, - 'posting_date': doc.posting_date + 'item_code' : d.item_code, + 's_warehouse' : d.s_warehouse, + 'posting_date' : doc.posting_date } } } else { @@ -398,17 +398,28 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; if(d.item_code) { args = { - 'item_code' : d.item_code, - 'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse), + 'item_code' : d.item_code, + 'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse), 'transfer_qty' : d.transfer_qty, - 'serial_no' : d.serial_no, - 'bom_no' : d.bom_no, + 'serial_no ' : d.serial_no, + 'bom_no' : d.bom_no, 'expense_account' : d.expense_account, 'cost_center' : d.cost_center, - 'company' : cur_frm.doc.company + 'company' : cur_frm.doc.company }; - return get_server_fields('get_item_details', JSON.stringify(args), - 'items', doc, cdt, cdn, 1); + return frappe.call({ + doc: cur_frm.doc, + method: "get_item_details", + args: args, + callback: function(r) { + if(r.message) { + $.each(r.message, function(k, v) { + frappe.model.set_value(cdt, cdn, k, v); + }); + refresh_field('image_view', d.name, 'items'); + } + } + }); } } diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 8b47df7fe3..62c83edf90 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -431,7 +431,7 @@ class StockEntry(StockController): "planned_qty": (self.docstatus==1 and -1 or 1 ) * flt(self.fg_completed_qty) }) - def get_item_details(self, args): + def get_item_details(self, args=None): item = frappe.db.sql("""select stock_uom, description, image, item_name, expense_account, buying_cost_center, item_group from `tabItem` where name = %s and (ifnull(end_of_life,'0000-00-00')='0000-00-00' or end_of_life > now())""", @@ -452,7 +452,7 @@ class StockEntry(StockController): 'qty' : 0, 'transfer_qty' : 0, 'conversion_factor' : 1, - 'batch_no' : '', + 'batch_no' : '', 'actual_qty' : 0, 'incoming_rate' : 0 } From d8b35639d8c121fe44c72f501e523d1158b234a7 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Thu, 12 Feb 2015 15:21:46 +0530 Subject: [PATCH 6/8] image feild made hidden --- .../doctype/purchase_order_item/purchase_order_item.json | 6 ++++-- .../supplier_quotation_item/supplier_quotation_item.json | 6 ++++-- .../doctype/bom_explosion_item/bom_explosion_item.json | 6 ++++-- erpnext/manufacturing/doctype/bom_item/bom_item.json | 6 ++++-- erpnext/patches.txt | 1 + erpnext/patches/v5_0/update_item_desc_and_image.py | 7 +++++++ .../selling/doctype/opportunity_item/opportunity_item.json | 7 ++++--- erpnext/selling/doctype/quotation_item/quotation_item.json | 6 ++++-- .../selling/doctype/sales_order_item/sales_order_item.json | 4 +++- .../doctype/delivery_note_item/delivery_note_item.json | 6 ++++-- .../material_request_item/material_request_item.json | 6 ++++-- .../purchase_receipt_item/purchase_receipt_item.json | 6 ++++-- .../doctype/stock_entry_detail/stock_entry_detail.json | 6 ++++-- 13 files changed, 51 insertions(+), 22 deletions(-) create mode 100644 erpnext/patches/v5_0/update_item_desc_and_image.py diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json index 65bb7f4d39..0df7c8b000 100755 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -93,9 +93,11 @@ { "fieldname": "image", "fieldtype": "Attach", + "hidden": 1, "label": "Image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", @@ -482,7 +484,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-02-10 17:11:03.236900", + "modified": "2015-02-12 15:11:13.784588", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order Item", diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json index b42b2b678d..08d5871b72 100644 --- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json +++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json @@ -77,9 +77,11 @@ { "fieldname": "image", "fieldtype": "Attach", + "hidden": 1, "label": "Image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", @@ -358,7 +360,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-02-10 17:08:37.920315", + "modified": "2015-02-12 15:16:13.616428", "modified_by": "Administrator", "module": "Buying", "name": "Supplier Quotation Item", diff --git a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json index aa5294ce5a..59ef647bf5 100644 --- a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json +++ b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json @@ -58,9 +58,11 @@ { "fieldname": "image", "fieldtype": "Attach", + "hidden": 1, "label": "Image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", @@ -138,7 +140,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-02-12 12:23:57.127210", + "modified": "2015-02-12 15:16:56.092124", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Explosion Item", diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.json b/erpnext/manufacturing/doctype/bom_item/bom_item.json index 2459b8e1bd..4870241836 100644 --- a/erpnext/manufacturing/doctype/bom_item/bom_item.json +++ b/erpnext/manufacturing/doctype/bom_item/bom_item.json @@ -70,9 +70,11 @@ { "fieldname": "image", "fieldtype": "Attach", + "hidden": 1, "label": "Image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", @@ -161,7 +163,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-02-12 10:41:31.336921", + "modified": "2015-02-12 15:17:18.324810", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Item", diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 6ea16dbf59..8156c02189 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -117,3 +117,4 @@ erpnext.patches.v5_0.new_crm_module erpnext.patches.v5_0.rename_customer_issue erpnext.patches.v5_0.update_material_transfer_for_manufacture erpnext.patches.v5_0.manufacturing_activity_type +erpnext.patches.v5_0.update_item_desc_and_image diff --git a/erpnext/patches/v5_0/update_item_desc_and_image.py b/erpnext/patches/v5_0/update_item_desc_and_image.py new file mode 100644 index 0000000000..4e03f59477 --- /dev/null +++ b/erpnext/patches/v5_0/update_item_desc_and_image.py @@ -0,0 +1,7 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +import frappe + +def execute(): + pass \ No newline at end of file diff --git a/erpnext/selling/doctype/opportunity_item/opportunity_item.json b/erpnext/selling/doctype/opportunity_item/opportunity_item.json index d81b1b7ff7..e9342dc7df 100644 --- a/erpnext/selling/doctype/opportunity_item/opportunity_item.json +++ b/erpnext/selling/doctype/opportunity_item/opportunity_item.json @@ -83,11 +83,12 @@ { "fieldname": "image", "fieldtype": "Attach", - "hidden": 0, + "hidden": 1, "label": "Image", "options": "", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", @@ -144,7 +145,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-02-10 13:03:39.188558", + "modified": "2015-02-12 15:18:08.997193", "modified_by": "Administrator", "module": "Selling", "name": "Opportunity Item", diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json index a1031a3158..401842e039 100644 --- a/erpnext/selling/doctype/quotation_item/quotation_item.json +++ b/erpnext/selling/doctype/quotation_item/quotation_item.json @@ -69,9 +69,11 @@ { "fieldname": "image", "fieldtype": "Attach", + "hidden": 1, "label": "Image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", @@ -347,7 +349,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-02-10 15:21:17.447331", + "modified": "2015-02-12 15:18:41.236797", "modified_by": "Administrator", "module": "Selling", "name": "Quotation Item", diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json index 4d676efaff..0a71c1874a 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json @@ -78,9 +78,11 @@ { "fieldname": "image", "fieldtype": "Attach", + "hidden": 1, "label": "Image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json index 0ac66ac021..c67c5775c2 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -84,9 +84,11 @@ { "fieldname": "image", "fieldtype": "Attach", + "hidden": 1, "label": "Image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", @@ -465,7 +467,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-02-12 10:34:45.460334", + "modified": "2015-02-12 15:19:29.701710", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.json b/erpnext/stock/doctype/material_request_item/material_request_item.json index e5b7b696c2..f6f8831187 100644 --- a/erpnext/stock/doctype/material_request_item/material_request_item.json +++ b/erpnext/stock/doctype/material_request_item/material_request_item.json @@ -66,9 +66,11 @@ { "fieldname": "image", "fieldtype": "Attach", + "hidden": 1, "label": "Image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", @@ -262,7 +264,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-02-10 16:14:59.940476", + "modified": "2015-02-12 15:20:02.832792", "modified_by": "Administrator", "module": "Stock", "name": "Material Request Item", diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json index 984732e66d..816b0b7a46 100755 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -67,9 +67,11 @@ { "fieldname": "image", "fieldtype": "Attach", + "hidden": 1, "label": "Image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", @@ -586,7 +588,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-02-12 10:37:31.933726", + "modified": "2015-02-12 15:20:26.299671", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json index 98b5038e0e..dda2580ba4 100644 --- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json +++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json @@ -94,9 +94,11 @@ { "fieldname": "image", "fieldtype": "Attach", + "hidden": 1, "label": "Image", "permlevel": 0, - "precision": "" + "precision": "", + "print_hide": 1 }, { "fieldname": "image_view", @@ -329,7 +331,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-02-10 16:18:48.313676", + "modified": "2015-02-12 15:20:56.815434", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry Detail", From d98c4e007b0b0212a92227edce0b1e15e87c0001 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 17 Feb 2015 12:58:35 +0530 Subject: [PATCH 7/8] patch --- .../patches/v5_0/update_item_desc_and_image.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v5_0/update_item_desc_and_image.py b/erpnext/patches/v5_0/update_item_desc_and_image.py index 4e03f59477..456c505eef 100644 --- a/erpnext/patches/v5_0/update_item_desc_and_image.py +++ b/erpnext/patches/v5_0/update_item_desc_and_image.py @@ -4,4 +4,19 @@ import frappe def execute(): - pass \ No newline at end of file + dt_list= {"Purchase Order Item","Supplier Quotation Item", "BOM", "Bom Explosion Item" , \ + "Bom Item", "Opportunity Item" , "Quotation Item" , "Sales Order Item" , "Delivery Note Item" , \ + "Material Request Item" , "Purchase Receipt Item" , "Stock Entry Detail"} + + for dt in dt_list: + names = frappe.db.sql("""select name, description from `tab{0}` doc where doc.description is not null""".format(dt),as_dict=1) + for d in names: + try: + data = d.description + image_url = data.split('')[1].split('')[0] + frappe.db.sql("""update `tab{0}` doc set doc.description = %s, doc.image = %s + where doc.name = %s """.format(dt),(desc, image_url, d.name)) + except: + pass + \ No newline at end of file From 42e42b764727019171b7641203953c6370f13b52 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 17 Feb 2015 17:41:07 +0530 Subject: [PATCH 8/8] fixes in patch --- erpnext/patches/v5_0/update_item_desc_and_image.py | 14 ++++++++------ erpnext/public/js/controllers/transaction.js | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/erpnext/patches/v5_0/update_item_desc_and_image.py b/erpnext/patches/v5_0/update_item_desc_and_image.py index 456c505eef..371dd2fd41 100644 --- a/erpnext/patches/v5_0/update_item_desc_and_image.py +++ b/erpnext/patches/v5_0/update_item_desc_and_image.py @@ -2,19 +2,21 @@ # License: GNU General Public License v3. See license.txt import frappe +from frappe.website.utils import find_first_image +import re def execute(): - dt_list= {"Purchase Order Item","Supplier Quotation Item", "BOM", "Bom Explosion Item" , \ - "Bom Item", "Opportunity Item" , "Quotation Item" , "Sales Order Item" , "Delivery Note Item" , \ - "Material Request Item" , "Purchase Receipt Item" , "Stock Entry Detail"} - + dt_list= ["Purchase Order Item","Supplier Quotation Item", "BOM", "BOM Explosion Item" , \ + "BOM Item", "Opportunity Item" , "Quotation Item" , "Sales Order Item" , "Delivery Note Item" , \ + "Material Request Item" , "Purchase Receipt Item" , "Stock Entry Detail"] for dt in dt_list: names = frappe.db.sql("""select name, description from `tab{0}` doc where doc.description is not null""".format(dt),as_dict=1) for d in names: try: data = d.description - image_url = data.split('')[1].split('')[0] + image_url = find_first_image(data) + desc = re.sub("\]+\>", "", data) + frappe.db.sql("""update `tab{0}` doc set doc.description = %s, doc.image = %s where doc.name = %s """.format(dt),(desc, image_url, d.name)) except: diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index cea4d03835..c8b028b12c 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -68,7 +68,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ item_code: function(doc, cdt, cdn) { var me = this; - var d = locals[cdt][cdn]; var item = frappe.get_doc(cdt, cdn); if(item.item_code || item.barcode || item.serial_no) { if(!this.validate_company_and_party()) {