image view fixed for stock entry and bom
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..aa5294c 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,27 @@
"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",
"permlevel": 0,
@@ -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 6786ead..2459b8e 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,26 @@
"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",
"label": "Quantity and Rate",
@@ -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 a77aa74..527cbf3 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -384,9 +384,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 {
@@ -398,17 +398,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 8b47df7..62c83ed 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -431,7 +431,7 @@
"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 @@
'qty' : 0,
'transfer_qty' : 0,
'conversion_factor' : 1,
- 'batch_no' : '',
+ 'batch_no' : '',
'actual_qty' : 0,
'incoming_rate' : 0
}