fix(Asset): Add depreciation schedule details in create_asset()

This commit is contained in:
GangaManoj 2021-06-03 22:28:30 +05:30
parent 3f9f0ffdfe
commit 70de974496

View File

@ -699,7 +699,7 @@ def create_asset(**args):
"item_code": args.item_code or "Macbook Pro",
"company": args.company or"_Test Company",
"purchase_date": "2015-01-01",
"calculate_depreciation": 0,
"calculate_depreciation": args.calculate_depreciation or 0,
"gross_purchase_amount": 100000,
"purchase_receipt_amount": 100000,
"expected_value_after_useful_life": 10000,
@ -710,6 +710,13 @@ def create_asset(**args):
"is_existing_asset": args.is_existing_asset or 0
})
if asset.calculate_depreciation:
asset.append("finance_books", {
"depreciation_method": "Straight Line",
"frequency_of_depreciation": 12,
"total_number_of_depreciations": 5
})
try:
asset.save()
except frappe.DuplicateEntryError: