diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.js b/erpnext/accounts/doctype/accounts_settings/accounts_settings.js index 74c623c8acb..eaae180bdcd 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.js +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.js @@ -3,35 +3,6 @@ frappe.ui.form.on("Accounts Settings", { refresh: function (frm) {}, -<<<<<<< HEAD -======= - enable_immutable_ledger: function (frm) { - if (!frm.doc.enable_immutable_ledger) { - return; - } - - let msg = __("Enabling this will change the way how cancelled transactions are handled."); - msg += " "; - msg += __("Please enable only if the understand the effects of enabling this."); - msg += "
"; - msg += __("Do you still want to enable immutable ledger?"); - - frappe.confirm( - msg, - () => {}, - () => { - frm.set_value("enable_immutable_ledger", 0); - } - ); - }, - - add_taxes_from_taxes_and_charges_template(frm) { - toggle_tax_settings(frm, "add_taxes_from_taxes_and_charges_template"); - }, - - add_taxes_from_item_tax_template(frm) { - toggle_tax_settings(frm, "add_taxes_from_item_tax_template"); - }, drop_ar_procedures: function (frm) { frm.call({ @@ -42,5 +13,4 @@ frappe.ui.form.on("Accounts Settings", { }, }); }, ->>>>>>> da32bb5f51 (refactor: utility to drop existing procedures and include cost center) }); diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index a2b75df6b5e..6d9c56406d9 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -501,72 +501,6 @@ "fieldname": "legacy_section", "fieldtype": "Section Break", "label": "Legacy Fields" -<<<<<<< HEAD -======= - }, - { - "default": "0", - "fieldname": "maintain_same_internal_transaction_rate", - "fieldtype": "Check", - "label": "Maintain Same Rate Throughout Internal Transaction" - }, - { - "default": "Stop", - "depends_on": "maintain_same_internal_transaction_rate", - "fieldname": "maintain_same_rate_action", - "fieldtype": "Select", - "label": "Action if Same Rate is Not Maintained Throughout Internal Transaction", - "mandatory_depends_on": "maintain_same_internal_transaction_rate", - "options": "Stop\nWarn" - }, - { - "depends_on": "eval: doc.maintain_same_internal_transaction_rate && doc.maintain_same_rate_action == 'Stop'", - "fieldname": "role_to_override_stop_action", - "fieldtype": "Link", - "label": "Role Allowed to Override Stop Action", - "options": "Role" - }, - { - "fieldname": "budget_settings", - "fieldtype": "Tab Break", - "label": "Budget" - }, - { - "default": "1", - "fieldname": "use_new_budget_controller", - "fieldtype": "Check", - "label": "Use New Budget Controller" - }, - { - "default": "1", - "description": "If enabled, user will be alerted before resetting posting date to current date in relevant transactions", - "fieldname": "confirm_before_resetting_posting_date", - "fieldtype": "Check", - "label": "Confirm before resetting posting date" - }, - { - "fieldname": "item_price_settings_section", - "fieldtype": "Section Break", - "label": "Item Price Settings" - }, - { - "fieldname": "column_break_feyo", - "fieldtype": "Column Break" - }, - { - "default": "0", - "description": "System will do an implicit conversion using the pegged currency.
\nEx: Instead of AED -> INR, system will do AED -> USD -> INR using the pegged exchange rate of AED against USD.", - "documentation_url": "/app/pegged-currencies/Pegged Currencies", - "fieldname": "allow_pegged_currencies_exchange_rates", - "fieldtype": "Check", - "label": "Allow Implicit Pegged Currency Conversion" - }, - { - "default": "0", - "description": "If no taxes are set, and Taxes and Charges Template is selected, the system will automatically apply the taxes from the chosen template.", - "fieldname": "add_taxes_from_taxes_and_charges_template", - "fieldtype": "Check", - "label": "Automatically Add Taxes from Taxes and Charges Template" }, { "fieldname": "column_break_ntmi", @@ -578,7 +512,6 @@ "fieldname": "drop_ar_procedures", "fieldtype": "Button", "label": "Drop Procedures" ->>>>>>> da32bb5f51 (refactor: utility to drop existing procedures and include cost center) } ], "icon": "icon-cog", diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py index abfa0abc92f..326b0a32df5 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py @@ -14,70 +14,6 @@ from erpnext.stock.utils import check_pending_reposting class AccountsSettings(Document): -<<<<<<< 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 - - acc_frozen_upto: DF.Date | None - add_taxes_from_item_tax_template: DF.Check - add_taxes_from_taxes_and_charges_template: DF.Check - allow_multi_currency_invoices_against_single_party_account: DF.Check - allow_pegged_currencies_exchange_rates: DF.Check - allow_stale: DF.Check - auto_reconcile_payments: DF.Check - auto_reconciliation_job_trigger: DF.Int - automatically_fetch_payment_terms: DF.Check - automatically_process_deferred_accounting_entry: DF.Check - book_asset_depreciation_entry_automatically: DF.Check - book_deferred_entries_based_on: DF.Literal["Days", "Months"] - book_deferred_entries_via_journal_entry: DF.Check - book_tax_discount_loss: DF.Check - calculate_depr_using_total_days: DF.Check - check_supplier_invoice_uniqueness: DF.Check - confirm_before_resetting_posting_date: DF.Check - create_pr_in_draft_status: DF.Check - credit_controller: DF.Link | None - delete_linked_ledger_entries: DF.Check - determine_address_tax_category_from: DF.Literal["Billing Address", "Shipping Address"] - enable_common_party_accounting: DF.Check - enable_fuzzy_matching: DF.Check - enable_immutable_ledger: DF.Check - enable_party_matching: DF.Check - exchange_gain_loss_posting_date: DF.Literal["Invoice", "Payment", "Reconciliation Date"] - frozen_accounts_modifier: DF.Link | None - general_ledger_remarks_length: DF.Int - ignore_account_closing_balance: DF.Check - ignore_is_opening_check_for_reporting: DF.Check - maintain_same_internal_transaction_rate: DF.Check - maintain_same_rate_action: DF.Literal["Stop", "Warn"] - make_payment_via_journal_entry: DF.Check - merge_similar_account_heads: DF.Check - over_billing_allowance: DF.Currency - post_change_gl_entries: DF.Check - receivable_payable_fetch_method: DF.Literal["Buffered Cursor", "UnBuffered Cursor", "Raw SQL"] - receivable_payable_remarks_length: DF.Int - reconciliation_queue_size: DF.Int - role_allowed_to_over_bill: DF.Link | None - role_to_override_stop_action: DF.Link | None - round_row_wise_tax: DF.Check - show_balance_in_coa: DF.Check - show_inclusive_tax_in_print: DF.Check - show_payment_schedule_in_print: DF.Check - show_taxes_as_table_in_print: DF.Check - stale_days: DF.Int - submit_journal_entries: DF.Check - unlink_advance_payment_on_cancelation_of_order: DF.Check - unlink_payment_on_cancellation_of_invoice: DF.Check - use_new_budget_controller: DF.Check - # end: auto-generated types - ->>>>>>> 8cf8f6abad (refactor: introduce sql option for data fetch) def validate(self): old_doc = self.get_doc_before_save() clear_cache = False @@ -129,32 +65,6 @@ class AccountsSettings(Document): def validate_pending_reposts(self): if self.acc_frozen_upto: check_pending_reposting(self.acc_frozen_upto) -<<<<<<< HEAD -======= - - def validate_and_sync_auto_reconcile_config(self): - if self.has_value_changed("auto_reconciliation_job_trigger"): - if ( - cint(self.auto_reconciliation_job_trigger) > 0 - and cint(self.auto_reconciliation_job_trigger) < 60 - ): - sync_auto_reconcile_config(self.auto_reconciliation_job_trigger) - else: - frappe.throw(_("Cron Interval should be between 1 and 59 Min")) - - if self.has_value_changed("reconciliation_queue_size"): - if cint(self.reconciliation_queue_size) < 5 or cint(self.reconciliation_queue_size) > 100: - frappe.throw(_("Queue Size should be between 5 and 100")) - - def validate_auto_tax_settings(self): - if self.add_taxes_from_item_tax_template and self.add_taxes_from_taxes_and_charges_template: - frappe.throw( - _("You cannot enable both the settings '{0}' and '{1}'.").format( - frappe.bold(_(self.meta.get_label("add_taxes_from_item_tax_template"))), - frappe.bold(_(self.meta.get_label("add_taxes_from_taxes_and_charges_template"))), - ), - title=_("Auto Tax Settings Error"), - ) @frappe.whitelist() def drop_ar_sql_procedures(self): @@ -163,4 +73,3 @@ class AccountsSettings(Document): frappe.db.sql(f"drop function if exists {InitSQLProceduresForAR.genkey_function_name}") frappe.db.sql(f"drop procedure if exists {InitSQLProceduresForAR.init_procedure_name}") frappe.db.sql(f"drop procedure if exists {InitSQLProceduresForAR.allocate_procedure_name}") ->>>>>>> da32bb5f51 (refactor: utility to drop existing procedures and include cost center) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 7bc44a2dd2a..b98923345c7 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -6,14 +6,7 @@ from collections import OrderedDict import frappe from frappe import _, qb, query_builder, scrub -<<<<<<< HEAD -======= from frappe.database.schema import get_definition -<<<<<<< HEAD -from frappe.desk.reportview import build_match_conditions ->>>>>>> 9d0ebe3427 (refactor: dynamic DB field types) -======= ->>>>>>> 7efeed54de (refactor: build and pass match conditions as qb criterion) from frappe.query_builder import Criterion from frappe.query_builder.functions import Date, Substring, Sum from frappe.utils import cint, cstr, flt, getdate, nowdate @@ -22,16 +15,10 @@ from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( get_accounting_dimensions, get_dimension_with_children, ) -<<<<<<< HEAD -from erpnext.accounts.utils import get_currency_precision -======= from erpnext.accounts.utils import ( build_qb_match_conditions, - get_advance_payment_doctypes, get_currency_precision, - get_party_types_from_account_type, ) ->>>>>>> 7efeed54de (refactor: build and pass match conditions as qb criterion) # This report gives a summary of all Outstanding Invoices considering the following @@ -108,9 +95,6 @@ class ReceivablePayableReport: def get_data(self): self.get_sales_invoices_or_customers_based_on_sales_person() - # Build delivery note map against all sales invoices - self.build_delivery_note_map() - # Get invoice details like bill_no, due_date etc for all invoices self.get_invoice_details() @@ -131,33 +115,16 @@ class ReceivablePayableReport: self.fetch_ple_in_buffered_cursor() elif self.ple_fetch_method == "UnBuffered Cursor": self.fetch_ple_in_unbuffered_cursor() -<<<<<<< HEAD - -<<<<<<< HEAD -======= - self.init_and_run_sql_procedures() -======= elif self.ple_fetch_method == "Raw SQL": -<<<<<<< HEAD - self.init_and_run_sql_procedures() ->>>>>>> e90c6a33bd (refactor: call procedures based on config) -======= self.fetch_ple_in_sql_procedures() ->>>>>>> fc8ca7d82c (chore: rename method) # Build delivery note map against all sales invoices self.build_delivery_note_map() ->>>>>>> e5920c57aa (refactor: using sql procedures for AR report) self.build_data() def fetch_ple_in_buffered_cursor(self): -<<<<<<< HEAD - query, param = self.ple_query.walk() - self.ple_entries = frappe.db.sql(query, param, as_dict=True) -======= self.ple_entries = self.ple_query.run(as_dict=True) ->>>>>>> 7efeed54de (refactor: build and pass match conditions as qb criterion) for ple in self.ple_entries: self.init_voucher_balance(ple) # invoiced, paid, credit_note, outstanding @@ -170,10 +137,6 @@ class ReceivablePayableReport: def fetch_ple_in_unbuffered_cursor(self): self.ple_entries = [] -<<<<<<< HEAD - query, param = self.ple_query.walk() -======= ->>>>>>> 7efeed54de (refactor: build and pass match conditions as qb criterion) with frappe.db.unbuffered_cursor(): for ple in self.ple_query.run(as_dict=True, as_iterator=True): self.init_voucher_balance(ple) # invoiced, paid, credit_note, outstanding @@ -953,12 +916,9 @@ class ReceivablePayableReport: else: query = query.select(ple.remarks) -<<<<<<< HEAD -======= if match_conditions := build_qb_match_conditions("Payment Ledger Entry"): query = query.where(Criterion.all(match_conditions)) ->>>>>>> 7efeed54de (refactor: build and pass match conditions as qb criterion) if self.filters.get("group_by_party"): query = query.orderby(self.ple.party, self.ple.posting_date) else: diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 9c0d0636525..04c95e7e376 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -2192,43 +2192,6 @@ def run_ledger_health_checks(): doc.general_and_payment_ledger_mismatch = True doc.checked_on = run_date doc.save() -<<<<<<< HEAD -======= - - -def sync_auto_reconcile_config(auto_reconciliation_job_trigger: int = 15): - auto_reconciliation_job_trigger = auto_reconciliation_job_trigger or frappe.get_single_value( - "Accounts Settings", "auto_reconciliation_job_trigger" - ) - method = "erpnext.accounts.doctype.process_payment_reconciliation.process_payment_reconciliation.trigger_reconciliation_for_queued_docs" - - sch_event = frappe.get_doc( - "Scheduler Event", {"scheduled_against": "Process Payment Reconciliation", "method": method} - ) - if frappe.db.get_value("Scheduled Job Type", {"method": method}): - frappe.get_doc( - "Scheduled Job Type", - { - "method": method, - }, - ).update( - { - "cron_format": f"0/{auto_reconciliation_job_trigger} * * * *", - "scheduler_event": sch_event.name, - } - ).save() - else: - frappe.get_doc( - { - "doctype": "Scheduled Job Type", - "method": method, - "scheduler_event": sch_event.name, - "cron_format": f"0/{auto_reconciliation_job_trigger} * * * *", - "create_log": True, - "stopped": False, - "frequency": "Cron", - } - ).save() def build_qb_match_conditions(doctype, user=None) -> list: @@ -2245,4 +2208,3 @@ def build_qb_match_conditions(doctype, user=None) -> list: criterion.append(_dt[fieldname].isin(names)) return criterion ->>>>>>> 7efeed54de (refactor: build and pass match conditions as qb criterion)