I am in the process of writing an app for
Asset Management, in which I created two doctypes
- Asset Table(Child Table of Module Asset Management).
-Doctype Assign includes fields
Employee Code(Fetches/links data from Employee table) and Asset Table(ie Assign Asset Table which is like PurchaseOrderItem).The Assign doctype is used for tracking IT/Fixed assets.
-Doctype Asset Table includes fields
Item Group(Fetches/links data from Serial No table)
-My aim is to not allow assign items(resources) to multiple people. So I need to write
Validate Function for
If Item Lenove Laptop with Serial_no 1001 is assigned to Employee Rahul then Item Lenove Laptop with Serial_no 1001 is not allowed to assign any other employee ie the Assign form should not save and it should display message saying that
"Item Lenovo Laptop with serial no 1001 is already assigned to employee Rahul"
-And I also Need to track item returns(when employee leave the company or when employee replaces the items)
-For now I wrote
asset_table.py(ie …/doctype/asset_table/asset_table.py). Whenever I create
New Assign the validate code in the
asset_table.py is not executing. I don’t know whether I am doing correctly or not or I should write
validate() in Assign(ie …/doctype/assign/assign.py) or how to link child table and parent table.
-Please help me how to do this and also correct me if I am wrong.
-Suggestions/Ideas are always welcome