Merge pull request #2734 from neilLasrado/kill-html-desc
Kill html desc -WIP
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 4b23c9f..0df7c8b 100755
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
@@ -45,6 +45,12 @@
"search_index": 1
},
{
+ "fieldname": "column_break_4",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "schedule_date",
"fieldtype": "Date",
"hidden": 0,
@@ -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",
@@ -79,6 +86,28 @@
"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",
"label": "Quantity and Rate",
@@ -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 349e38e..08d5871 100644
--- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
+++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
@@ -30,6 +30,12 @@
"read_only": 1
},
{
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@@ -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",
@@ -63,6 +70,28 @@
"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",
"label": "Quantity and Rate",
@@ -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 a0ebcce..10cfc3a 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -94,8 +94,18 @@
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 31af3cd..39dd614 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -59,18 +59,6 @@
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 @@
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 a230cf4..22bddaa 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -23,6 +23,7 @@
}
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 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 05350d5..8866100 100644
--- a/erpnext/manufacturing/doctype/bom/bom.json
+++ b/erpnext/manufacturing/doctype/bom/bom.json
@@ -214,6 +214,12 @@
"read_only": 1
},
{
+ "fieldname": "section_break_25",
+ "fieldtype": "Section Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "description",
"fieldtype": "Small Text",
"in_list_view": 0,
@@ -222,6 +228,27 @@
"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",
"fieldtype": "Section Break",
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 702fdef..6c50c86 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -55,7 +55,7 @@
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 @@
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 @@
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 @@
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 71b6da5..59ef647 100644
--- a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json
+++ b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json
@@ -17,6 +17,12 @@
"read_only": 1
},
{
+ "fieldname": "cb",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
@@ -26,8 +32,8 @@
"read_only": 1
},
{
- "fieldname": "column_break_2",
- "fieldtype": "Column Break",
+ "fieldname": "section_break_3",
+ "fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
@@ -44,6 +50,29 @@
"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",
"permlevel": 0,
@@ -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 6786ead..4870241 100644
--- a/erpnext/manufacturing/doctype/bom_item/bom_item.json
+++ b/erpnext/manufacturing/doctype/bom_item/bom_item.json
@@ -25,6 +25,12 @@
"precision": ""
},
{
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "bom_no",
"fieldtype": "Link",
"in_filter": 1,
@@ -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",
@@ -56,6 +63,28 @@
"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",
"label": "Quantity and Rate",
@@ -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 6ea16db..8156c02 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -117,3 +117,4 @@
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 0000000..371dd2f
--- /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("\<img[^>]+\>", "", 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 b6527e0..e9342dc 100644
--- a/erpnext/selling/doctype/opportunity_item/opportunity_item.json
+++ b/erpnext/selling/doctype/opportunity_item/opportunity_item.json
@@ -15,6 +15,11 @@
"reqd": 0
},
{
+ "fieldname": "col_break1",
+ "fieldtype": "Column Break",
+ "permlevel": 0
+ },
+ {
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
@@ -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",
@@ -69,6 +75,30 @@
"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",
"in_list_view": 0,
@@ -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 04f0f10..401842e 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -67,6 +67,23 @@
"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",
"label": "Quantity and Rate",
@@ -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 640e992..0a71c18 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -30,6 +30,11 @@
"read_only": 1
},
{
+ "fieldname": "col_break1",
+ "fieldtype": "Column Break",
+ "permlevel": 0
+ },
+ {
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
@@ -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",
@@ -64,6 +70,29 @@
"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",
"label": "Quantity and Rate",
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 b94a267..c67c577 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -57,6 +57,12 @@
"read_only": 1
},
{
+ "fieldname": "section_break_6",
+ "fieldtype": "Section Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "description",
"fieldtype": "Small Text",
"in_list_view": 1,
@@ -70,6 +76,29 @@
"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",
"label": "Quantity and Rate",
@@ -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 4e82c55..af7e7f0 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -150,22 +150,6 @@
}
}
-cur_frm.cscript.add_image = function(doc, dt, dn) {
- if(!doc.image) {
- msgprint(__('Please select an "Image" first'));
- return;
- }
-
- doc.description_html = repl('<table style="width: 100%; table-layout: fixed;">' +
- '<tr><td style="width:110px"><img src="%(imgurl)s" width="100px"></td>' +
- '<td>%(desc)s</td></tr>' +
- '</table>', {
- imgurl: frappe.utils.get_file_link(doc.image),
- desc: doc.description.replace(/\n/g, "<br>")});
-
- 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.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 36d2109..c2f2a9b 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -80,6 +80,12 @@
"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",
"fieldtype": "Link",
@@ -113,8 +119,14 @@
"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 c6574ea..f6f8831 100644
--- a/erpnext/stock/doctype/material_request_item/material_request_item.json
+++ b/erpnext/stock/doctype/material_request_item/material_request_item.json
@@ -20,6 +20,11 @@
"width": "100px"
},
{
+ "fieldname": "col_break1",
+ "fieldtype": "Column Break",
+ "permlevel": 0
+ },
+ {
"fieldname": "item_name",
"fieldtype": "Data",
"in_filter": 1,
@@ -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",
@@ -52,6 +58,29 @@
"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",
"in_list_view": 0,
@@ -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 5e9594e..816b0b7 100755
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -21,6 +21,12 @@
"width": "100px"
},
{
+ "fieldname": "column_break_2",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "item_name",
"fieldtype": "Data",
"in_filter": 0,
@@ -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",
@@ -53,6 +60,28 @@
"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",
"label": "Received and Accepted",
@@ -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 6e4530f..f738c4a 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -389,9 +389,9 @@
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 @@
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 ab90170..62c83ed 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -431,8 +431,8 @@
"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 @@
'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 @@
'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 7e737ef..dda2580 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
@@ -55,6 +55,11 @@
"search_index": 1
},
{
+ "fieldname": "col_break2",
+ "fieldtype": "Column Break",
+ "permlevel": 0
+ },
+ {
"fieldname": "item_name",
"fieldtype": "Data",
"label": "Item Name",
@@ -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",
@@ -80,6 +86,29 @@
"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",
"label": "Quantity and Rate",
@@ -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 9d0f3b8..29897ef 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -147,7 +147,8 @@
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),