Multiple small fixes

This commit is contained in:
Nabin Hait 2018-01-05 13:14:14 +05:30
parent eac2e369cf
commit 28d0230e56
3 changed files with 32 additions and 26 deletions

View File

@ -262,13 +262,15 @@ frappe.ui.form.on("Expense Claim", {
}, },
get_advances: function(frm) { get_advances: function(frm) {
frappe.model.clear_table(frm.doc, "advances");
if (frm.doc.employee) {
return frappe.call({ return frappe.call({
method: "erpnext.hr.doctype.expense_claim.expense_claim.get_advances", method: "erpnext.hr.doctype.expense_claim.expense_claim.get_advances",
args: { args: {
employee: frm.doc.employee employee: frm.doc.employee
}, },
callback: function(r, rt) { callback: function(r, rt) {
frappe.model.clear_table(frm.doc, "advances");
if(r.message) { if(r.message) {
$.each(r.message, function(i, d) { $.each(r.message, function(i, d) {
var row = frappe.model.add_child(frm.doc, "Expense Claim Advance", "advances"); var row = frappe.model.add_child(frm.doc, "Expense Claim Advance", "advances");
@ -284,6 +286,7 @@ frappe.ui.form.on("Expense Claim", {
} }
}); });
} }
}
}); });
frappe.ui.form.on("Expense Claim Detail", { frappe.ui.form.on("Expense Claim Detail", {

View File

@ -137,10 +137,10 @@ class PackingSlip(Document):
for d in self.get("items"): for d in self.get("items"):
res = frappe.db.get_value("Item", d.item_code, res = frappe.db.get_value("Item", d.item_code,
["net_weight", "weight_uom"], as_dict=True) ["weight_per_unit", "weight_uom"], as_dict=True)
if res and len(res)>0: if res and len(res)>0:
d.net_weight = res["net_weight"] d.net_weight = res["weight_per_unit"]
d.weight_uom = res["weight_uom"] d.weight_uom = res["weight_uom"]
def get_recommended_case_no(self): def get_recommended_case_no(self):

View File

@ -37,9 +37,10 @@ def get_item_price_qty_data(filters):
from `tabItem Price` a left join `tabBin` b from `tabItem Price` a left join `tabBin` b
ON a.item_code = b.item_code ON a.item_code = b.item_code
{conditions}""" {conditions}"""
.format(conditions=conditions),filters,as_dict=1) .format(conditions=conditions), filters, as_dict=1)
price_list_names = ",".join(['"' + item['price_list_name'] + '"' for item in item_results]) price_list_names = ",".join(['"' + frappe.db.escape(item['price_list_name']) + '"'
for item in item_results])
buying_price_map = get_buying_price_map(price_list_names) buying_price_map = get_buying_price_map(price_list_names)
selling_price_map = get_selling_price_map(price_list_names) selling_price_map = get_selling_price_map(price_list_names)
@ -66,7 +67,8 @@ def get_buying_price_map(price_list_names):
`tabItem Price` `tabItem Price`
where where
name in ({price_list_names}) and buying=1 name in ({price_list_names}) and buying=1
""".format(price_list_names=price_list_names),as_dict=1) """.format(price_list_names=price_list_names), as_dict=1)
buying_price_map = {} buying_price_map = {}
for d in buying_price: for d in buying_price:
name = d["name"] name = d["name"]
@ -84,7 +86,8 @@ def get_selling_price_map(price_list_names):
`tabItem Price` `tabItem Price`
where where
name in ({price_list_names}) and selling=1 name in ({price_list_names}) and selling=1
""".format(price_list_names=price_list_names),as_dict=1) """.format(price_list_names=price_list_names), as_dict=1)
selling_price_map = {} selling_price_map = {}
for d in selling_price: for d in selling_price:
name = d["name"] name = d["name"]