mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-02 08:03:21 +00:00
[Fix] Multiple fixes
This commit is contained in:
@@ -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"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user