image view fixed for stock entry and bom
This commit is contained in:
parent
3361df709c
commit
7f70367dde
@ -23,6 +23,7 @@ cur_frm.cscript.update_cost = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.add_fetch("item", "description", "description");
|
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", "item_name", "item_name");
|
||||||
cur_frm.add_fetch("item", "stock_uom", "uom");
|
cur_frm.add_fetch("item", "stock_uom", "uom");
|
||||||
|
|
||||||
@ -202,3 +203,7 @@ frappe.ui.form.on("BOM Item", "items_remove", function(frm) {
|
|||||||
erpnext.bom.calculate_rm_cost(frm.doc);
|
erpnext.bom.calculate_rm_cost(frm.doc);
|
||||||
erpnext.bom.calculate_total(frm.doc);
|
erpnext.bom.calculate_total(frm.doc);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cur_frm.cscript.image = function() {
|
||||||
|
refresh_field("image_view");
|
||||||
|
}
|
||||||
@ -213,6 +213,12 @@
|
|||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_25",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "description",
|
"fieldname": "description",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
@ -221,6 +227,27 @@
|
|||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"read_only": 1
|
"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",
|
"depends_on": "eval:!doc.__islocal",
|
||||||
"fieldname": "section_break0",
|
"fieldname": "section_break0",
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class BOM(Document):
|
|||||||
|
|
||||||
def get_item_det(self, item_code):
|
def get_item_det(self, item_code):
|
||||||
item = frappe.db.sql("""select name, item_name, is_asset_item, is_purchase_item,
|
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
|
last_purchase_rate
|
||||||
from `tabItem` where name=%s""", item_code, as_dict = 1)
|
from `tabItem` where name=%s""", item_code, as_dict = 1)
|
||||||
|
|
||||||
@ -96,6 +96,7 @@ class BOM(Document):
|
|||||||
ret_item = {
|
ret_item = {
|
||||||
'item_name' : item and args['item_name'] or '',
|
'item_name' : item and args['item_name'] or '',
|
||||||
'description' : item and args['description'] or '',
|
'description' : item and args['description'] or '',
|
||||||
|
'image' : item and args['image'] or '',
|
||||||
'stock_uom' : item and args['stock_uom'] or '',
|
'stock_uom' : item and args['stock_uom'] or '',
|
||||||
'bom_no' : args['bom_no'],
|
'bom_no' : args['bom_no'],
|
||||||
'rate' : rate
|
'rate' : rate
|
||||||
@ -301,6 +302,7 @@ class BOM(Document):
|
|||||||
'item_code' : d.item_code,
|
'item_code' : d.item_code,
|
||||||
'item_name' : d.item_name,
|
'item_name' : d.item_name,
|
||||||
'description' : d.description,
|
'description' : d.description,
|
||||||
|
'image' : d.image,
|
||||||
'stock_uom' : d.stock_uom,
|
'stock_uom' : d.stock_uom,
|
||||||
'qty' : flt(d.qty),
|
'qty' : flt(d.qty),
|
||||||
'rate' : flt(d.rate),
|
'rate' : flt(d.rate),
|
||||||
@ -367,6 +369,7 @@ def get_bom_items_as_dict(bom, qty=1, fetch_exploded=1):
|
|||||||
item.item_name,
|
item.item_name,
|
||||||
sum(ifnull(bom_item.qty, 0)/ifnull(bom.quantity, 1)) * %(qty)s as qty,
|
sum(ifnull(bom_item.qty, 0)/ifnull(bom.quantity, 1)) * %(qty)s as qty,
|
||||||
item.description,
|
item.description,
|
||||||
|
item.image,
|
||||||
item.stock_uom,
|
item.stock_uom,
|
||||||
item.default_warehouse,
|
item.default_warehouse,
|
||||||
item.expense_account as expense_account,
|
item.expense_account as expense_account,
|
||||||
|
|||||||
@ -16,6 +16,12 @@
|
|||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "cb",
|
||||||
|
"fieldtype": "Column Break",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "item_name",
|
"fieldname": "item_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
@ -26,8 +32,8 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_2",
|
"fieldname": "section_break_3",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Section Break",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": ""
|
"precision": ""
|
||||||
},
|
},
|
||||||
@ -43,6 +49,27 @@
|
|||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"width": "300px"
|
"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",
|
"fieldname": "section_break_4",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
@ -111,7 +138,7 @@
|
|||||||
],
|
],
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2015-01-20 13:28:52.258152",
|
"modified": "2015-02-12 12:23:57.127210",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "BOM Explosion Item",
|
"name": "BOM Explosion Item",
|
||||||
|
|||||||
@ -24,6 +24,12 @@
|
|||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": ""
|
"precision": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_3",
|
||||||
|
"fieldtype": "Column Break",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "bom_no",
|
"fieldname": "bom_no",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
@ -40,9 +46,10 @@
|
|||||||
"width": "150px"
|
"width": "150px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "col_break1",
|
"fieldname": "section_break_5",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Section Break",
|
||||||
"permlevel": 0
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "description",
|
"fieldname": "description",
|
||||||
@ -55,6 +62,26 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"width": "250px"
|
"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",
|
"fieldname": "quantity_and_rate",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
@ -134,7 +161,7 @@
|
|||||||
],
|
],
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2015-01-20 13:28:35.152945",
|
"modified": "2015-02-12 10:41:31.336921",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "BOM Item",
|
"name": "BOM Item",
|
||||||
|
|||||||
@ -407,8 +407,19 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
|||||||
'cost_center' : d.cost_center,
|
'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),
|
return frappe.call({
|
||||||
'items', doc, cdt, cdn, 1);
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -431,7 +431,7 @@ class StockEntry(StockController):
|
|||||||
"planned_qty": (self.docstatus==1 and -1 or 1 ) * flt(self.fg_completed_qty)
|
"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,
|
item = frappe.db.sql("""select stock_uom, description, image, item_name,
|
||||||
expense_account, buying_cost_center, item_group from `tabItem`
|
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())""",
|
where name = %s and (ifnull(end_of_life,'0000-00-00')='0000-00-00' or end_of_life > now())""",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user