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,27 +262,30 @@ frappe.ui.form.on("Expense Claim", {
},
get_advances: function(frm) {
return frappe.call({
method: "erpnext.hr.doctype.expense_claim.expense_claim.get_advances",
args: {
employee: frm.doc.employee
},
callback: function(r, rt) {
frappe.model.clear_table(frm.doc, "advances");
if(r.message) {
$.each(r.message, function(i, d) {
var row = frappe.model.add_child(frm.doc, "Expense Claim Advance", "advances");
row.employee_advance = d.name;
row.posting_date = d.posting_date;
row.advance_account = d.advance_account;
row.advance_paid = d.paid_amount;
row.unclaimed_amount = flt(d.paid_amount) - flt(d.claimed_amount);
row.allocated_amount = flt(d.paid_amount) - flt(d.claimed_amount);
});
refresh_field("advances");
frappe.model.clear_table(frm.doc, "advances");
if (frm.doc.employee) {
return frappe.call({
method: "erpnext.hr.doctype.expense_claim.expense_claim.get_advances",
args: {
employee: frm.doc.employee
},
callback: function(r, rt) {
if(r.message) {
$.each(r.message, function(i, d) {
var row = frappe.model.add_child(frm.doc, "Expense Claim Advance", "advances");
row.employee_advance = d.name;
row.posting_date = d.posting_date;
row.advance_account = d.advance_account;
row.advance_paid = d.paid_amount;
row.unclaimed_amount = flt(d.paid_amount) - flt(d.claimed_amount);
row.allocated_amount = flt(d.paid_amount) - flt(d.claimed_amount);
});
refresh_field("advances");
}
}
}
});
});
}
}
});

View File

@ -137,10 +137,10 @@ class PackingSlip(Document):
for d in self.get("items"):
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:
d.net_weight = res["net_weight"]
d.net_weight = res["weight_per_unit"]
d.weight_uom = res["weight_uom"]
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
ON a.item_code = b.item_code
{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)
selling_price_map = get_selling_price_map(price_list_names)
@ -66,7 +67,8 @@ def get_buying_price_map(price_list_names):
`tabItem Price`
where
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 = {}
for d in buying_price:
name = d["name"]
@ -84,7 +86,8 @@ def get_selling_price_map(price_list_names):
`tabItem Price`
where
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 = {}
for d in selling_price:
name = d["name"]