mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 14:39:19 +00:00
[conflict] merged for get_query
This commit is contained in:
@@ -169,30 +169,37 @@ var calculate_total = function(doc) {
|
||||
|
||||
|
||||
cur_frm.fields_dict['item'].get_query = function(doc) {
|
||||
return erpnext.queries.item({
|
||||
'ifnull(tabItem.is_manufactured_item, "No")': 'Yes',
|
||||
})
|
||||
return{
|
||||
query:"controllers.queries.item_query",
|
||||
filters:{
|
||||
'has_serial_no': 'Yes'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
return{
|
||||
filters:[
|
||||
['Project', 'status', 'not in', 'Completed, Cancelled']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` \
|
||||
WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" \
|
||||
OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" \
|
||||
ORDER BY `tabItem`.`name` LIMIT 50';
|
||||
return{
|
||||
query:"controllers.queries.item_query"
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
return 'SELECT DISTINCT `tabBOM`.`name`, `tabBOM`.`remarks` FROM `tabBOM` \
|
||||
WHERE `tabBOM`.`item` = "' + d.item_code + '" AND `tabBOM`.`is_active` = 1 AND \
|
||||
`tabBOM`.docstatus = 1 AND `tabBOM`.`name` like "%s" \
|
||||
ORDER BY `tabBOM`.`name` LIMIT 50';
|
||||
return{
|
||||
filters:{
|
||||
'item': d.item_code,
|
||||
'is_active': 1,
|
||||
'docstatus': 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.validate = function(doc, dt, dn) {
|
||||
|
||||
@@ -85,10 +85,10 @@ class DocType:
|
||||
msgprint("Item %s does not exist in system" % item[0]['item_code'], raise_exception = 1)
|
||||
|
||||
def set_bom_material_details(self):
|
||||
for item in self.doclist.get({"parentfield": "bom_materials"}):
|
||||
ret = self.get_bom_material_detail({ "item_code": item.item_code, "bom_no": item.bom_no,
|
||||
"qty": item.qty })
|
||||
|
||||
for item in self.doclist.get({"parentfield": "bom_materials"}):
|
||||
ret = self.get_bom_material_detail({"item_code": item.item_code, "bom_no": item.bom_no,
|
||||
"qty": item.qty})
|
||||
|
||||
for r in ret:
|
||||
if not item.fields.get(r):
|
||||
item.fields[r] = ret[r]
|
||||
@@ -100,7 +100,7 @@ class DocType:
|
||||
args = webnotes.form_dict.get('args')
|
||||
import json
|
||||
args = json.loads(args)
|
||||
|
||||
|
||||
item = self.get_item_det(args['item_code'])
|
||||
self.validate_rm_item(item)
|
||||
|
||||
|
||||
@@ -20,10 +20,16 @@ cur_frm.cscript.refresh = function(doc) {
|
||||
}
|
||||
|
||||
cur_frm.set_query("current_bom", function(doc) {
|
||||
return erpnext.queries.bom({name: "!" + doc.new_bom});
|
||||
return{
|
||||
query:"controllers.queries.bom",
|
||||
filters: {name: "!" + doc.new_bom}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cur_frm.set_query("new_bom", function(doc) {
|
||||
return erpnext.queries.bom({name: "!" + doc.current_bom});
|
||||
return{
|
||||
query:"controllers.queries.bom",
|
||||
filters: {name: "!" + doc.current_bom}
|
||||
}
|
||||
});
|
||||
@@ -101,18 +101,27 @@ cur_frm.cscript.make_se = function(doc, purpose) {
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['production_item'].get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.`description` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.docstatus != 2 AND `tabItem`.is_pro_applicable = "Yes" AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` LIMIT 50';
|
||||
return {
|
||||
filters:[
|
||||
['Item', 'is_pro_applicable', '=', 'Yes']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
return{
|
||||
filters:[
|
||||
['Project', 'status', 'not in', 'Completed, Cancelled']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur_frm.set_query("bom_no", function(doc) {
|
||||
if (doc.production_item) {
|
||||
return erpnext.queries.bom({item: cstr(doc.production_item)});
|
||||
return{
|
||||
query:"controllers.queries.bom",
|
||||
filters: {item: cstr(doc.production_item)}
|
||||
}
|
||||
} else msgprint(" Please enter Production Item first");
|
||||
});
|
||||
@@ -53,11 +53,18 @@ cur_frm.fields_dict['pp_details'].grid.get_field('item_code').get_query = functi
|
||||
cur_frm.fields_dict['pp_details'].grid.get_field('bom_no').get_query = function(doc) {
|
||||
var d = locals[this.doctype][this.docname];
|
||||
if (d.item_code) {
|
||||
return erpnext.queries.bom({item: cstr(d.item_code)});
|
||||
return {
|
||||
query:"controllers.queries.bom",
|
||||
filters:{'item': cstr(d.item_code)}
|
||||
}
|
||||
} else msgprint(" Please enter Item first");
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query:"controllers.queries.customer_query"
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.pp_so_details.grid.get_field("customer").get_query =
|
||||
erpnext.utils.customer_query;
|
||||
cur_frm.fields_dict.customer.get_query;
|
||||
Reference in New Issue
Block a user