refactor: advance payments, allow configurable reconciliation date

This commit is contained in:
ruthra kumar
2024-05-16 11:40:50 +05:30
parent 0363afcfd0
commit 070e2d4d26
4 changed files with 30 additions and 8 deletions

View File

@@ -20,6 +20,7 @@
"party",
"party_name",
"book_advance_payments_in_separate_party_account",
"reconcile_on_advance_payment_date",
"column_break_11",
"bank_account",
"party_bank_account",
@@ -766,6 +767,15 @@
"label": "In Words",
"print_hide": 1,
"read_only": 1
},
{
"default": "0",
"fetch_from": "company.reconcile_on_advance_payment_date",
"fieldname": "reconcile_on_advance_payment_date",
"fieldtype": "Check",
"hidden": 1,
"label": "Reconcile on Advance Payment Date",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
@@ -779,7 +789,7 @@
"table_fieldname": "payment_entries"
}
],
"modified": "2024-04-11 11:25:07.366347",
"modified": "2024-05-16 11:50:19.394918",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry",

View File

@@ -1344,13 +1344,16 @@ class PaymentEntry(AccountsController):
"voucher_detail_no": invoice.name,
}
date_field = "posting_date"
if invoice.reference_doctype in ["Sales Order", "Purchase Order"]:
date_field = "transaction_date"
posting_date = frappe.db.get_value(invoice.reference_doctype, invoice.reference_name, date_field)
if getdate(posting_date) < getdate(self.posting_date):
if self.reconcile_on_advance_payment_date:
posting_date = self.posting_date
else:
date_field = "posting_date"
if invoice.reference_doctype in ["Sales Order", "Purchase Order"]:
date_field = "transaction_date"
posting_date = frappe.db.get_value(invoice.reference_doctype, invoice.reference_name, date_field)
if getdate(posting_date) < getdate(self.posting_date):
posting_date = self.posting_date
dr_or_cr, account = self.get_dr_and_account_for_advances(invoice)
args_dict["account"] = account

View File

@@ -67,6 +67,7 @@
"default_finance_book",
"advance_payments_section",
"book_advance_payments_in_separate_party_account",
"reconcile_on_advance_payment_date",
"column_break_fwcf",
"default_advance_received_account",
"default_advance_paid_account",
@@ -763,6 +764,13 @@
"fieldtype": "Tab Break",
"label": "Dashboard",
"show_dashboard": 1
},
{
"default": "0",
"depends_on": "eval: doc.book_advance_payments_in_separate_party_account",
"fieldname": "reconcile_on_advance_payment_date",
"fieldtype": "Check",
"label": "Reconcile on Advance Payment Date"
}
],
"icon": "fa fa-building",
@@ -770,7 +778,7 @@
"image_field": "company_logo",
"is_tree": 1,
"links": [],
"modified": "2024-04-23 12:38:33.173938",
"modified": "2024-05-16 11:52:13.067003",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",

View File

@@ -85,6 +85,7 @@ class Company(NestedSet):
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