-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from 8848digital/customization
feat: patches
- Loading branch information
Showing
31 changed files
with
587 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
{ | ||
"creation": "2021-08-24 17:56:40.754909", | ||
"docstatus": 0, | ||
"doctype": "Form Tour", | ||
"first_document": 0, | ||
"idx": 0, | ||
"include_name_field": 0, | ||
"is_standard": 1, | ||
"modified": "2021-11-24 17:59:44.559001", | ||
"modified_by": "Administrator", | ||
"module": "Asset", | ||
"name": "Item", | ||
"owner": "Administrator", | ||
"reference_doctype": "Item", | ||
"save_on_complete": 1, | ||
"steps": [ | ||
{ | ||
"description": "Enter code for Asset Item", | ||
"field": "", | ||
"fieldname": "item_code", | ||
"fieldtype": "Data", | ||
"has_next_condition": 0, | ||
"is_table_field": 0, | ||
"label": "Item Code", | ||
"parent_field": "", | ||
"position": "Bottom", | ||
"title": "Asset Item Code" | ||
}, | ||
{ | ||
"description": "Enter name for Asset Item", | ||
"field": "", | ||
"fieldname": "item_name", | ||
"fieldtype": "Data", | ||
"has_next_condition": 0, | ||
"is_table_field": 0, | ||
"label": "Item Name", | ||
"parent_field": "", | ||
"position": "Bottom", | ||
"title": "Asset Item Name" | ||
}, | ||
{ | ||
"description": "Select an Item Group", | ||
"field": "", | ||
"fieldname": "item_group", | ||
"fieldtype": "Link", | ||
"has_next_condition": 0, | ||
"is_table_field": 0, | ||
"label": "Item Group", | ||
"parent_field": "", | ||
"position": "Right", | ||
"title": "Item Group" | ||
}, | ||
{ | ||
"description": "Check this field to make this an Asset Item", | ||
"field": "", | ||
"fieldname": "is_fixed_asset", | ||
"fieldtype": "Check", | ||
"has_next_condition": 1, | ||
"is_table_field": 0, | ||
"label": "Is Fixed Asset", | ||
"next_step_condition": "eval:doc.is_fixed_asset", | ||
"parent_field": "", | ||
"position": "Bottom", | ||
"title": "Is this a Fixed Asset?" | ||
}, | ||
{ | ||
"description": "On checking it, the system will create an Asset automatically on purchase", | ||
"field": "", | ||
"fieldname": "auto_create_assets", | ||
"fieldtype": "Check", | ||
"has_next_condition": 1, | ||
"is_table_field": 0, | ||
"label": "Auto Create Assets on Purchase", | ||
"next_step_condition": "eval:doc.auto_create_assets", | ||
"parent_field": "", | ||
"position": "Bottom", | ||
"title": "Auto Create Asset on Purchase" | ||
}, | ||
{ | ||
"description": "Select an Asset Category for this Asset Item", | ||
"field": "", | ||
"fieldname": "asset_category", | ||
"fieldtype": "Link", | ||
"has_next_condition": 0, | ||
"is_table_field": 0, | ||
"label": "Asset Category", | ||
"parent_field": "", | ||
"position": "Left", | ||
"title": "Asset Category" | ||
}, | ||
{ | ||
"description": "Select a naming series which will be used to create an Asset automatically", | ||
"field": "", | ||
"fieldname": "asset_naming_series", | ||
"fieldtype": "Select", | ||
"has_next_condition": 0, | ||
"is_table_field": 0, | ||
"label": "Asset Naming Series", | ||
"parent_field": "", | ||
"position": "Left", | ||
"title": "Asset Naming Series" | ||
} | ||
], | ||
"title": "Item" | ||
} |
41 changes: 41 additions & 0 deletions
41
asset/asset/form_tour/purchase_receipt/purchase_receipt.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"creation": "2021-08-24 13:03:21.333088", | ||
"docstatus": 0, | ||
"doctype": "Form Tour", | ||
"idx": 0, | ||
"is_standard": 1, | ||
"modified": "2021-08-24 13:03:21.333088", | ||
"modified_by": "Administrator", | ||
"module": "Asset", | ||
"name": "Purchase Receipt", | ||
"owner": "Administrator", | ||
"reference_doctype": "Purchase Receipt", | ||
"save_on_complete": 0, | ||
"steps": [ | ||
{ | ||
"description": "Select Asset Supplier", | ||
"field": "", | ||
"fieldname": "supplier", | ||
"fieldtype": "Link", | ||
"has_next_condition": 0, | ||
"is_table_field": 0, | ||
"label": "Supplier", | ||
"parent_field": "", | ||
"position": "Bottom", | ||
"title": "Supplier" | ||
}, | ||
{ | ||
"description": "Select an Asset Item, Enter rate and quantity", | ||
"field": "", | ||
"fieldname": "items", | ||
"fieldtype": "Table", | ||
"has_next_condition": 0, | ||
"is_table_field": 0, | ||
"label": "Items", | ||
"parent_field": "", | ||
"position": "Bottom", | ||
"title": "Items" | ||
} | ||
], | ||
"title": "Purchase Receipt" | ||
} |
10 changes: 0 additions & 10 deletions
10
asset/asset/patches/post_install/add_index_on_nestedset_doctypes.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
[pre_model_sync] | ||
# Patches added in this section will be executed before doctypes are migrated | ||
# Read docs to understand patches: https://frappeframework.com/docs/v14/user/en/database-migrations | ||
|
||
[post_model_sync] | ||
# Patches added in this section will be executed after doctypes are migrated | ||
asset.patches.v15_0.correct_asset_value_if_je_with_workflow | ||
asset.patches.v15_0.create_asset_depreciation_schedules_from_assets | ||
asset.patches.v15_0.delete_orphaned_asset_movement_item_records | ||
asset.patches.v15_0.remove_cancelled_asset_capitalization_from_asset | ||
asset.patches.v15_0.rename_daily_depreciation_to_depreciation_amount_based_on_num_days_in_month | ||
asset.patches.v15_0.rename_depreciation_amount_based_on_num_days_in_month_to_daily_prorata_based | ||
asset.patches.v15_0.rename_number_of_depreciations_booked_to_opening_booked_depreciations | ||
asset.patches.v15_0.rename_purchase_receipt_amount_to_purchase_amount | ||
asset.patches.v15_0.update_asset_repair_field_in_stock_entry | ||
asset.patches.v15_0.update_asset_value_for_manual_depr_entries | ||
asset.patches.v15_0.update_gpa_and_ndb_for_assdeprsch | ||
asset.patches.v15_0.update_total_number_of_booked_depreciations | ||
asset.patches.v15_0.update_warehouse_field_in_asset_repair_consumed_item_doctype |
31 changes: 31 additions & 0 deletions
31
asset/patches/post_install/create_accounting_dimensions_for_asset_capitalization.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import frappe | ||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field | ||
|
||
|
||
def execute(): | ||
accounting_dimensions = frappe.db.get_all( | ||
"Accounting Dimension", fields=["fieldname", "label", "document_type", "disabled"] | ||
) | ||
|
||
if not accounting_dimensions: | ||
return | ||
|
||
doctype = "Asset Capitalization" | ||
|
||
for d in accounting_dimensions: | ||
field = frappe.db.get_value("Custom Field", {"dt": doctype, "fieldname": d.fieldname}) | ||
|
||
if field: | ||
continue | ||
|
||
df = { | ||
"fieldname": d.fieldname, | ||
"label": d.label, | ||
"fieldtype": "Link", | ||
"options": d.document_type, | ||
"insert_after": "accounting_dimensions_section", | ||
} | ||
|
||
create_custom_field(doctype, df, ignore_validate=True) | ||
|
||
frappe.clear_cache(doctype=doctype) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
asset/patches/post_install/set_cwip_and_delete_asset_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import frappe | ||
from frappe.utils import cint | ||
|
||
|
||
def execute(): | ||
"""Get 'Disable CWIP Accounting value' from Asset Settings, set it in 'Enable Capital Work in Progress Accounting' field | ||
in Company, delete Asset Settings""" | ||
|
||
if frappe.db.exists("DocType", "Asset Settings"): | ||
frappe.reload_doctype("Asset Category") | ||
cwip_value = frappe.db.get_single_value("Asset Settings", "disable_cwip_accounting") | ||
|
||
frappe.db.sql("""UPDATE `tabAsset Category` SET enable_cwip_accounting = %s""", cint(cwip_value)) | ||
|
||
frappe.db.sql("""DELETE FROM `tabSingles` where doctype = 'Asset Settings'""") | ||
frappe.delete_doc_if_exists("DocType", "Asset Settings") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import frappe | ||
|
||
|
||
def execute(): | ||
if frappe.db.count("Asset"): | ||
frappe.reload_doc("assets", "doctype", "Asset") | ||
asset = frappe.qb.DocType("Asset") | ||
frappe.qb.update(asset).set(asset.asset_quantity, 1).run() |
17 changes: 17 additions & 0 deletions
17
asset/patches/post_install/update_total_asset_cost_field.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import frappe | ||
|
||
|
||
def execute(): | ||
asset = frappe.qb.DocType("Asset") | ||
frappe.qb.update(asset).set(asset.total_asset_cost, asset.gross_purchase_amount).run() | ||
|
||
asset_repair_list = frappe.db.get_all( | ||
"Asset Repair", | ||
filters={"docstatus": 1, "repair_status": "Completed", "capitalize_repair_cost": 1}, | ||
fields=["asset", "repair_cost"], | ||
) | ||
|
||
for asset_repair in asset_repair_list: | ||
frappe.qb.update(asset).set( | ||
asset.total_asset_cost, asset.total_asset_cost + asset_repair.repair_cost | ||
).where(asset.name == asset_repair.asset).run() |
6 changes: 6 additions & 0 deletions
6
asset/patches/post_install/update_zero_asset_quantity_field.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import frappe | ||
|
||
|
||
def execute(): | ||
asset = frappe.qb.DocType("Asset") | ||
frappe.qb.update(asset).set(asset.asset_quantity, 1).where(asset.asset_quantity == 0).run() |
Oops, something went wrong.