Merge pull request #2734 from neilLasrado/kill-html-desc

Kill html desc -WIP
This commit is contained in:
Nabin Hait 2015-02-18 13:13:52 +05:30
commit 06fd10620e
23 changed files with 484 additions and 119 deletions

View File

@ -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",

View File

@ -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",

View File

@ -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');
}
}
})
}
}

View File

@ -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):

View File

@ -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);
});
});
cur_frm.cscript.image = function() {
refresh_field("image_view");
}

View File

@ -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",

View File

@ -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,

View File

@ -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",

View File

@ -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",

View File

@ -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

View File

@ -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

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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('<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.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]));
}
}

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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');
}
}
});
}
}

View File

@ -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
}

View File

@ -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",

View File

@ -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),