[fixes] fix message and type conversion;

This commit is contained in:
Rushabh Mehta 2017-06-19 09:58:48 +05:30
parent 2305eda82e
commit b7b49f6da7
3 changed files with 6 additions and 4 deletions

View File

@ -10,7 +10,7 @@ class ExpenseClaimType(Document):
def validate(self):
self.validate_accounts()
self.validate_repeating_companies()
def validate_repeating_companies(self):
"""Error when Same Company is entered multiple times in accounts"""
accounts_list = []
@ -24,4 +24,5 @@ class ExpenseClaimType(Document):
for entry in self.accounts:
"""Error when Company of Ledger account doesn't match with Company Selected"""
if frappe.db.get_value("Account", entry.default_account, "company") != entry.company:
frappe.throw(_("Account does not match with Company"))
frappe.throw(_("Account {0} does not match with Company {1}"
).format(entry.default_account, entry.company))

View File

@ -83,7 +83,8 @@ class StockEntry(StockController):
frappe.throw(_("Row {0}: Qty is mandatory").format(item.idx))
if not flt(item.conversion_factor):
frappe.throw(_("Row {0}: UOM Conversion Factor is mandatory").format(item.idx))
item.transfer_qty = flt(item.qty * item.conversion_factor, self.precision("transfer_qty", item))
item.transfer_qty = flt(flt(item.qty) * flt(item.conversion_factor),
self.precision("transfer_qty", item))
def validate_item(self):
stock_items = self.get_stock_items()

View File

@ -149,5 +149,5 @@ def validate_uom_is_integer(doc, uom_field, qty_fields, child_dt=None):
for f in qty_fields:
qty = d.get(f)
if qty:
if abs(int(qty) - float(qty)) > 0.0000001:
if abs(cint(qty) - flt(qty)) > 0.0000001:
frappe.throw(_("Quantity ({0}) cannot be a fraction in row {1}").format(qty, d.idx), UOMMustBeIntegerError)