mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
Merge pull request #49522 from KerollesFathy/clear-custodian-when-asset-take-backed
fix: clear asset custodian when asset take back from employee without assign to another employee
This commit is contained in:
@@ -142,10 +142,18 @@ class AssetMovement(Document):
|
|||||||
def update_asset_location_and_custodian(self, asset_id, location, employee):
|
def update_asset_location_and_custodian(self, asset_id, location, employee):
|
||||||
asset = frappe.get_doc("Asset", asset_id)
|
asset = frappe.get_doc("Asset", asset_id)
|
||||||
|
|
||||||
|
updates = {}
|
||||||
if employee and employee != asset.custodian:
|
if employee and employee != asset.custodian:
|
||||||
frappe.db.set_value("Asset", asset_id, "custodian", employee)
|
updates["custodian"] = employee
|
||||||
|
|
||||||
|
elif not employee and asset.custodian:
|
||||||
|
updates["custodian"] = ""
|
||||||
|
|
||||||
if location and location != asset.location:
|
if location and location != asset.location:
|
||||||
frappe.db.set_value("Asset", asset_id, "location", location)
|
updates["location"] = location
|
||||||
|
|
||||||
|
if updates:
|
||||||
|
frappe.db.set_value("Asset", asset_id, updates)
|
||||||
|
|
||||||
def log_asset_activity(self, asset_id, location, employee):
|
def log_asset_activity(self, asset_id, location, employee):
|
||||||
if location and employee:
|
if location and employee:
|
||||||
|
|||||||
Reference in New Issue
Block a user