From 8e340bb7fdf42179e4a92f47b3764bbfb19dbe7b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 24 Jul 2024 18:13:30 +0530 Subject: [PATCH 1/3] refactor: provision for monthly re-evaluation (cherry picked from commit ce2b9e0f1a69a652ed797453ba04d30e4857c0eb) # Conflicts: # erpnext/setup/doctype/company/company.json # erpnext/setup/doctype/company/company.py --- erpnext/setup/doctype/company/company.json | 6 +- erpnext/setup/doctype/company/company.py | 89 ++++++++++++++++++++++ 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index 70a0872a2c4..7fd4643f233 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,11 @@ "image_field": "company_logo", "is_tree": 1, "links": [], +<<<<<<< HEAD "modified": "2024-05-27 17:32:49.057386", +======= + "modified": "2024-07-24 18:17:56.413971", +>>>>>>> ce2b9e0f1a (refactor: provision for monthly re-evaluation) "modified_by": "Administrator", "module": "Setup", "name": "Company", diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 2477444dab6..7e63363849b 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -19,6 +19,95 @@ from erpnext.setup.setup_wizard.operations.taxes_setup import setup_taxes_and_ch class Company(NestedSet): +<<<<<<< HEAD +======= + # begin: auto-generated types + # This code is auto-generated. Do not modify anything in this block. + + from typing import TYPE_CHECKING + + if TYPE_CHECKING: + from frappe.types import DF + + abbr: DF.Data + 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", "Monthly"] + auto_exchange_rate_revaluation: DF.Check + book_advance_payments_in_separate_party_account: DF.Check + capital_work_in_progress_account: DF.Link | None + chart_of_accounts: DF.Literal[None] + company_description: DF.TextEditor | None + company_logo: DF.AttachImage | None + company_name: DF.Data + cost_center: DF.Link | None + country: DF.Link + create_chart_of_accounts_based_on: DF.Literal["", "Standard Template", "Existing Company"] + credit_limit: DF.Currency + date_of_commencement: DF.Date | None + date_of_establishment: DF.Date | None + date_of_incorporation: DF.Date | None + default_advance_paid_account: DF.Link | None + default_advance_received_account: DF.Link | None + default_bank_account: DF.Link | None + default_buying_terms: DF.Link | None + default_cash_account: DF.Link | None + default_currency: DF.Link + default_deferred_expense_account: DF.Link | None + default_deferred_revenue_account: DF.Link | None + default_discount_account: DF.Link | None + default_expense_account: DF.Link | None + default_finance_book: DF.Link | None + default_holiday_list: DF.Link | None + default_in_transit_warehouse: DF.Link | None + default_income_account: DF.Link | None + default_inventory_account: DF.Link | None + default_letter_head: DF.Link | None + default_operating_cost_account: DF.Link | None + default_payable_account: DF.Link | None + default_provisional_account: DF.Link | None + default_receivable_account: DF.Link | None + default_selling_terms: DF.Link | None + default_warehouse_for_sales_return: DF.Link | None + depreciation_cost_center: DF.Link | None + depreciation_expense_account: DF.Link | None + disposal_account: DF.Link | None + domain: DF.Data | None + email: DF.Data | None + enable_perpetual_inventory: DF.Check + enable_provisional_accounting_for_non_stock_items: DF.Check + exception_budget_approver_role: DF.Link | None + exchange_gain_loss_account: DF.Link | None + existing_company: DF.Link | None + fax: DF.Data | None + is_group: DF.Check + lft: DF.Int + monthly_sales_target: DF.Currency + old_parent: DF.Data | None + parent_company: DF.Link | None + payment_terms: DF.Link | None + phone_no: DF.Data | None + reconcile_on_advance_payment_date: DF.Check + registration_details: DF.Code | None + rgt: DF.Int + round_off_account: DF.Link | None + round_off_cost_center: DF.Link | None + sales_monthly_history: DF.SmallText | None + series_for_depreciation_entry: DF.Data | None + stock_adjustment_account: DF.Link | None + stock_received_but_not_billed: DF.Link | None + submit_err_jv: DF.Check + tax_id: DF.Data | None + total_monthly_sales: DF.Currency + transactions_annual_history: DF.Code | None + unrealized_exchange_gain_loss_account: DF.Link | None + unrealized_profit_loss_account: DF.Link | None + website: DF.Data | None + write_off_account: DF.Link | None + # end: auto-generated types + +>>>>>>> ce2b9e0f1a (refactor: provision for monthly re-evaluation) nsm_parent_field = "parent_company" def onload(self): From c1fd95ac6649cf9edf08f4f5701c9ab3834e9f18 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 24 Jul 2024 18:16:20 +0530 Subject: [PATCH 2/3] refactor: hooks for monthly re-evaluation jobs (cherry picked from commit fc4e5f165c9628171189a1c080793507e21e0500) # Conflicts: # erpnext/hooks.py --- erpnext/accounts/utils.py | 12 ++++++++++++ erpnext/hooks.py | 4 ++++ 2 files changed, 16 insertions(+) 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..6d334050d80 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -462,7 +462,11 @@ scheduler_events = { ], "monthly_long": [ "erpnext.accounts.deferred_revenue.process_deferred_accounting", +<<<<<<< HEAD "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", +>>>>>>> fc4e5f165c (refactor: hooks for monthly re-evaluation jobs) ], } From 240118ee8bf90f862134c21159d38e07bb867910 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 24 Jul 2024 18:47:30 +0530 Subject: [PATCH 3/3] chore: resolve conflict --- erpnext/hooks.py | 3 - erpnext/setup/doctype/company/company.json | 4 - erpnext/setup/doctype/company/company.py | 89 ---------------------- 3 files changed, 96 deletions(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 6d334050d80..ae6a15bfd8d 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -462,11 +462,8 @@ scheduler_events = { ], "monthly_long": [ "erpnext.accounts.deferred_revenue.process_deferred_accounting", -<<<<<<< HEAD "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", ->>>>>>> fc4e5f165c (refactor: hooks for monthly re-evaluation jobs) ], } diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index 7fd4643f233..fd121336827 100644 --- a/erpnext/setup/doctype/company/company.json +++ b/erpnext/setup/doctype/company/company.json @@ -712,11 +712,7 @@ "image_field": "company_logo", "is_tree": 1, "links": [], -<<<<<<< HEAD - "modified": "2024-05-27 17:32:49.057386", -======= "modified": "2024-07-24 18:17:56.413971", ->>>>>>> ce2b9e0f1a (refactor: provision for monthly re-evaluation) "modified_by": "Administrator", "module": "Setup", "name": "Company", diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 7e63363849b..2477444dab6 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -19,95 +19,6 @@ from erpnext.setup.setup_wizard.operations.taxes_setup import setup_taxes_and_ch class Company(NestedSet): -<<<<<<< HEAD -======= - # begin: auto-generated types - # This code is auto-generated. Do not modify anything in this block. - - from typing import TYPE_CHECKING - - if TYPE_CHECKING: - from frappe.types import DF - - abbr: DF.Data - 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", "Monthly"] - auto_exchange_rate_revaluation: DF.Check - book_advance_payments_in_separate_party_account: DF.Check - capital_work_in_progress_account: DF.Link | None - chart_of_accounts: DF.Literal[None] - company_description: DF.TextEditor | None - company_logo: DF.AttachImage | None - company_name: DF.Data - cost_center: DF.Link | None - country: DF.Link - create_chart_of_accounts_based_on: DF.Literal["", "Standard Template", "Existing Company"] - credit_limit: DF.Currency - date_of_commencement: DF.Date | None - date_of_establishment: DF.Date | None - date_of_incorporation: DF.Date | None - default_advance_paid_account: DF.Link | None - default_advance_received_account: DF.Link | None - default_bank_account: DF.Link | None - default_buying_terms: DF.Link | None - default_cash_account: DF.Link | None - default_currency: DF.Link - default_deferred_expense_account: DF.Link | None - default_deferred_revenue_account: DF.Link | None - default_discount_account: DF.Link | None - default_expense_account: DF.Link | None - default_finance_book: DF.Link | None - default_holiday_list: DF.Link | None - default_in_transit_warehouse: DF.Link | None - default_income_account: DF.Link | None - default_inventory_account: DF.Link | None - default_letter_head: DF.Link | None - default_operating_cost_account: DF.Link | None - default_payable_account: DF.Link | None - default_provisional_account: DF.Link | None - default_receivable_account: DF.Link | None - default_selling_terms: DF.Link | None - default_warehouse_for_sales_return: DF.Link | None - depreciation_cost_center: DF.Link | None - depreciation_expense_account: DF.Link | None - disposal_account: DF.Link | None - domain: DF.Data | None - email: DF.Data | None - enable_perpetual_inventory: DF.Check - enable_provisional_accounting_for_non_stock_items: DF.Check - exception_budget_approver_role: DF.Link | None - exchange_gain_loss_account: DF.Link | None - existing_company: DF.Link | None - fax: DF.Data | None - is_group: DF.Check - lft: DF.Int - monthly_sales_target: DF.Currency - old_parent: DF.Data | None - parent_company: DF.Link | None - payment_terms: DF.Link | None - phone_no: DF.Data | None - reconcile_on_advance_payment_date: DF.Check - registration_details: DF.Code | None - rgt: DF.Int - round_off_account: DF.Link | None - round_off_cost_center: DF.Link | None - sales_monthly_history: DF.SmallText | None - series_for_depreciation_entry: DF.Data | None - stock_adjustment_account: DF.Link | None - stock_received_but_not_billed: DF.Link | None - submit_err_jv: DF.Check - tax_id: DF.Data | None - total_monthly_sales: DF.Currency - transactions_annual_history: DF.Code | None - unrealized_exchange_gain_loss_account: DF.Link | None - unrealized_profit_loss_account: DF.Link | None - website: DF.Data | None - write_off_account: DF.Link | None - # end: auto-generated types - ->>>>>>> ce2b9e0f1a (refactor: provision for monthly re-evaluation) nsm_parent_field = "parent_company" def onload(self):