Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: convert Payment Reconciliation to virtual doctype #38148

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@
],
"hide_toolbar": 1,
"icon": "icon-resize-horizontal",
"is_virtual": 1,
"issingle": 1,
"links": [],
"modified": "2023-08-15 05:35:50.109290",
"modified": "2023-11-17 17:33:55.701726",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation",
Expand All @@ -239,6 +240,5 @@
],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
"states": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,58 @@ def __init__(self, *args, **kwargs):
self.accounting_dimension_filter_conditions = []
self.ple_posting_date_filter = []

def load_from_db(self):
# 'modified' attribute is required for `run_doc_method` to work properly.
doc_dict = frappe._dict(
{
"modified": None,
"company": None,
"party": None,
"party_type": None,
"receivable_payable_account": None,
"default_advance_account": None,
"from_invoice_date": None,
"to_invoice_date": None,
"invoice_limit": 50,
"from_payment_date": None,
"to_payment_date": None,
"payment_limit": 50,
"minimum_invoice_amount": None,
"minimum_payment_amount": None,
"maximum_invoice_amount": None,
"maximum_payment_amount": None,
"bank_cash_account": None,
"cost_center": None,
"payment_name": None,
"invoice_name": None,
}
)
super(Document, self).__init__(doc_dict)

def save(self):
return

@staticmethod
def get_list(args):
pass

@staticmethod
def get_count(args):
pass

@staticmethod
def get_stats(args):
pass

def db_insert(self, *args, **kwargs):
pass

def db_update(self, *args, **kwargs):
pass

def delete(self):
pass

@frappe.whitelist()
def get_unreconciled_entries(self):
self.get_nonreconciled_payment_entries()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@
"label": "Difference Posting Date"
}
],
"is_virtual": 1,
"istable": 1,
"links": [],
"modified": "2023-10-23 10:44:56.066303",
"modified": "2023-11-17 17:33:38.612615",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Allocation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@
"label": "Exchange Rate"
}
],
"is_virtual": 1,
"istable": 1,
"links": [],
"modified": "2022-11-08 18:18:02.502149",
"modified": "2023-11-17 17:33:45.455166",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Invoice",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@
"options": "Cost Center"
}
],
"is_virtual": 1,
"istable": 1,
"links": [],
"modified": "2023-09-03 07:43:29.965353",
"modified": "2023-11-17 17:33:34.818530",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Payment",
Expand Down
3 changes: 1 addition & 2 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,8 @@ erpnext.patches.v14_0.create_accounting_dimensions_in_sales_order_item
erpnext.patches.v15_0.update_sre_from_voucher_details
erpnext.patches.v14_0.rename_over_order_allowance_field
erpnext.patches.v14_0.migrate_delivery_stop_lock_field
execute:frappe.db.set_single_value("Payment Reconciliation", "invoice_limit", 50)
execute:frappe.db.set_single_value("Payment Reconciliation", "payment_limit", 50)
erpnext.patches.v14_0.add_default_for_repost_settings
erpnext.patches.v14_0.clear_reconciliation_values_from_singles
erpnext.patches.v15_0.rename_daily_depreciation_to_depreciation_amount_based_on_num_days_in_month
erpnext.patches.v15_0.rename_depreciation_amount_based_on_num_days_in_month_to_daily_prorata_based
erpnext.patches.v15_0.set_reserved_stock_in_bin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from frappe import qb


def execute():
"""
Clear `tabSingles` and Payment Reconciliation tables of values
"""
singles = qb.DocType("Singles")
qb.from_(singles).delete().where(singles.doctype == "Payment Reconciliation").run()
doctypes = [
"Payment Reconciliation Invoice",
"Payment Reconciliation Payment",
"Payment Reconciliation Allocation",
]
for x in doctypes:
dt = qb.DocType(x)
qb.from_(dt).delete().run()
Loading