bom cleanup: update cost and flat bom by traversing full tree

This commit is contained in:
Nabin Hait
2012-12-10 18:11:42 +05:30
parent af63b16be8
commit 5999944a5c
21 changed files with 514 additions and 587 deletions

View File

@@ -103,4 +103,24 @@ erpnext.queries.account = function(opts) {
AND tabAccount.%(key)s LIKE "%s" ' + (conditions
? (" AND " + conditions.join(" AND "))
: "")
}
erpnext.queries.bom = function(opts) {
conditions = [];
if (opts) {
$.each(opts, function(key, val) {
if (esc_quotes(val).charAt(0) != "!")
conditions.push("tabBOM.`" + key + "`='"+esc_quotes(val)+"'");
else
conditions.push("tabBOM.`" + key + "`!='"+esc_quotes(val).substr(1)+"'");
});
}
return 'SELECT tabBOM.name, tabBOM.item \
FROM tabBOM \
WHERE tabBOM.docstatus=1 \
AND tabBOM.is_active="Yes" \
AND tabBOM.%(key)s LIKE "%s" ' + (conditions.length
? (" AND " + conditions.join(" AND "))
: "")
}