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 4b23c9f411b..0df7c8b000c 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,28 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -455,7 +484,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:59.868306", + "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 349e38ea2a3..08d5871b72f 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,28 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -331,7 +360,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:59.198926", + "modified": "2015-02-12 15:16:13.616428", "modified_by": "Administrator", "module": "Buying", "name": "Supplier Quotation Item", diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index a0ebcce6ebf..10cfc3ab001 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -94,8 +94,18 @@ 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) { + $.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/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 31af3cdd265..39dd61439ce 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/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index a230cf4ab9c..22bddaa69a2 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 05350d5877f..8866100cc5f 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 702fdef4ec0..6c50c86d0ec 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 71b6da5f8de..59ef647bf54 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,29 @@ "read_only": 1, "width": "300px" }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "section_break_4", "fieldtype": "Section Break", @@ -111,7 +140,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-20 13:28:52.258152", + "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 6786ead00bd..4870241836a 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,28 @@ "reqd": 0, "width": "250px" }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -133,8 +162,8 @@ } ], "idx": 1, - "istable": 1, - "modified": "2015-01-20 13:28:35.152945", + "istable": 1, + "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 6ea16dbf59e..8156c021897 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 00000000000..371dd2fd414 --- /dev/null +++ b/erpnext/patches/v5_0/update_item_desc_and_image.py @@ -0,0 +1,24 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# 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"] + 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 = 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: + 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 b6527e0af92..e9342dc7df9 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,30 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "column_break_8", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -115,7 +145,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:58.657537", + "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 04f0f10faf3..401842e0392 100644 --- a/erpnext/selling/doctype/quotation_item/quotation_item.json +++ b/erpnext/selling/doctype/quotation_item/quotation_item.json @@ -66,6 +66,23 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -332,7 +349,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:59.329982", + "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 640e992ce66..0a71c1874ab 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,29 @@ "search_index": 1, "width": "300px" }, + { + "fieldname": "column_break_7", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "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/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json index b94a267f64f..c67c5775c2c 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,29 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "column_break_8", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -438,7 +467,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:59.711539", + "modified": "2015-02-12 15:19:29.701710", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 4e82c558980..af7e7f0f246 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 36d21097842..c2f2a9b0d31 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", 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 c6574eaa72b..f6f88311873 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,29 @@ "reqd": 1, "width": "250px" }, + { + "fieldname": "column_break_6", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_warehouse", "fieldtype": "Section Break", @@ -235,7 +264,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:29:59.597199", + "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 5e9594e5356..816b0b7a463 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,28 @@ "reqd": 1, "width": "300px" }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "received_and_accepted", "fieldtype": "Section Break", @@ -559,7 +588,7 @@ ], "idx": 1, "istable": 1, - "modified": "2015-01-01 14:30:00.032715", + "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/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 6e4530f16b2..f738c4a7905 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -389,9 +389,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 { @@ -403,17 +403,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 ab9017036ad..62c83edf90b 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -431,8 +431,8 @@ class StockEntry(StockController): "planned_qty": (self.docstatus==1 and -1 or 1 ) * flt(self.fg_completed_qty) }) - def get_item_details(self, args): - item = frappe.db.sql("""select stock_uom, description, item_name, + 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())""", (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"), @@ -451,7 +452,7 @@ class StockEntry(StockController): 'qty' : 0, 'transfer_qty' : 0, 'conversion_factor' : 1, - 'batch_no' : '', + 'batch_no' : '', 'actual_qty' : 0, 'incoming_rate' : 0 } 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 7e737ef5090..dda2580ba4a 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,29 @@ "read_only": 0, "width": "300px" }, + { + "fieldname": "column_break_10", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, + "precision": "" + }, { "fieldname": "quantity_and_rate", "fieldtype": "Section Break", @@ -302,7 +331,7 @@ ], "idx": 1, "istable": 1, - "modified": "2014-08-11 03:54:49.688635", + "modified": "2015-02-12 15:20:56.815434", "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 9d0f3b86a4d..29897ef072f 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),