Image field and view added to all selling doctypes

This commit is contained in:
Neil Trini Lasrado 2015-02-10 16:49:16 +05:30
parent 66df3566a9
commit c48f06c095
7 changed files with 115 additions and 20 deletions

View File

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

View File

@ -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()) {

View File

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

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

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

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

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