diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 7e67085f5dd..0ae4db3673c 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -1571,6 +1571,18 @@ def auto_create_exchange_rate_revaluation_weekly() -> None: create_err_and_its_journals(companies) +def auto_create_exchange_rate_revaluation_monthly() -> None: + """ + Executed by background job + """ + companies = frappe.db.get_all( + "Company", + filters={"auto_exchange_rate_revaluation": 1, "auto_err_frequency": "Montly"}, + fields=["name", "submit_err_jv"], + ) + create_err_and_its_journals(companies) + + def get_payment_ledger_entries(gl_entries, cancel=0): ple_map = [] if gl_entries: diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 021cf4deb63..ae6a15bfd8d 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -463,6 +463,7 @@ scheduler_events = { "monthly_long": [ "erpnext.accounts.deferred_revenue.process_deferred_accounting", "erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual.process_loan_interest_accrual_for_demand_loans", + "erpnext.accounts.utils.auto_create_exchange_rate_revaluation_monthly", ], } diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index 70a0872a2c4..fd121336827 100644 --- a/erpnext/setup/doctype/company/company.json +++ b/erpnext/setup/doctype/company/company.json @@ -698,7 +698,7 @@ "fieldname": "auto_err_frequency", "fieldtype": "Select", "label": "Frequency", - "options": "Daily\nWeekly" + "options": "Daily\nWeekly\nMonthly" }, { "default": "0", @@ -712,7 +712,7 @@ "image_field": "company_logo", "is_tree": 1, "links": [], - "modified": "2024-05-27 17:32:49.057386", + "modified": "2024-07-24 18:17:56.413971", "modified_by": "Administrator", "module": "Setup", "name": "Company",