Skip to content

Commit

Permalink
Merge pull request #42462 from ruthra-kumar/monthly_err_revaluation
Browse files Browse the repository at this point in the history
refactor: provision for re-evaluating Exchange Rates in monthly frequency
  • Loading branch information
ruthra-kumar authored Jul 24, 2024
2 parents 06e2d72 + fc4e5f1 commit e062ec3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions erpnext/accounts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,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:
Expand Down
1 change: 1 addition & 0 deletions erpnext/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@
],
"monthly_long": [
"erpnext.accounts.deferred_revenue.process_deferred_accounting",
"erpnext.accounts.utils.auto_create_exchange_rate_revaluation_monthly",
],
}

Expand Down
4 changes: 2 additions & 2 deletions erpnext/setup/doctype/company/company.json
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@
"fieldname": "auto_err_frequency",
"fieldtype": "Select",
"label": "Frequency",
"options": "Daily\nWeekly"
"options": "Daily\nWeekly\nMonthly"
},
{
"default": "0",
Expand Down Expand Up @@ -792,7 +792,7 @@
"image_field": "company_logo",
"is_tree": 1,
"links": [],
"modified": "2024-06-21 17:46:25.567565",
"modified": "2024-07-24 18:17:56.413971",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",
Expand Down
2 changes: 1 addition & 1 deletion erpnext/setup/doctype/company/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Company(NestedSet):
accumulated_depreciation_account: DF.Link | None
allow_account_creation_against_child_company: DF.Check
asset_received_but_not_billed: DF.Link | None
auto_err_frequency: DF.Literal["Daily", "Weekly"]
auto_err_frequency: DF.Literal["Daily", "Weekly", "Monthly"]
auto_exchange_rate_revaluation: DF.Check
book_advance_payments_in_separate_party_account: DF.Check
capital_work_in_progress_account: DF.Link | None
Expand Down

0 comments on commit e062ec3

Please sign in to comment.