[Fix] Multiple fixes

This commit is contained in:
Rohit Waghchaure
2018-05-16 16:41:34 +05:30
parent 028e2ad246
commit b233e9d643
3 changed files with 42 additions and 45 deletions

View File

@@ -14,16 +14,13 @@ class AssetMovement(Document):
self.validate_warehouses()
def validate_asset(self):
status, company, serial_no = frappe.db.get_value("Asset", self.asset, ["status", "company", "serial_no"])
status, company = frappe.db.get_value("Asset", self.asset, ["status", "company"])
if self.purpose == 'Transfer' and status in ("Draft", "Scrapped", "Sold"):
frappe.throw(_("{0} asset cannot be transferred").format(status))
if company != self.company:
frappe.throw(_("Asset {0} does not belong to company {1}").format(self.asset, self.company))
if serial_no and not self.serial_no:
self.serial_no = serial_no
if self.serial_no and len(get_serial_nos(self.serial_no)) != self.quantity:
frappe.throw(_("Number of serial nos and quantity must be the same"))