mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 04:59:18 +00:00
refactor: save reconcile effect on reference table
This commit is contained in:
@@ -790,7 +790,9 @@
|
|||||||
"fetch_from": "company.reconciliation_takes_effect_on",
|
"fetch_from": "company.reconciliation_takes_effect_on",
|
||||||
"fieldname": "advance_reconciliation_takes_effect_on",
|
"fieldname": "advance_reconciliation_takes_effect_on",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
|
"hidden": 1,
|
||||||
"label": "Advance Reconciliation Takes Effect On",
|
"label": "Advance Reconciliation Takes Effect On",
|
||||||
|
"no_copy": 1,
|
||||||
"options": "Advance Payment Date\nOldest Of Invoice Or Advance\nReconciliation Date"
|
"options": "Advance Payment Date\nOldest Of Invoice Or Advance\nReconciliation Date"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -805,7 +807,7 @@
|
|||||||
"table_fieldname": "payment_entries"
|
"table_fieldname": "payment_entries"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2025-01-09 20:02:33.402163",
|
"modified": "2025-01-13 16:03:47.169699",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Payment Entry",
|
"name": "Payment Entry",
|
||||||
|
|||||||
@@ -1507,19 +1507,7 @@ class PaymentEntry(AccountsController):
|
|||||||
"voucher_detail_no": invoice.name,
|
"voucher_detail_no": invoice.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.advance_reconciliation_takes_effect_on == "Advance Payment Date":
|
posting_date = invoice.reconcile_effect_on
|
||||||
posting_date = self.posting_date
|
|
||||||
elif self.advance_reconciliation_takes_effect_on == "Oldest Of Invoice Or Advance":
|
|
||||||
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
|
|
||||||
elif self.advance_reconciliation_takes_effect_on == "Reconciliation Date":
|
|
||||||
posting_date = nowdate()
|
|
||||||
|
|
||||||
dr_or_cr, account = self.get_dr_and_account_for_advances(invoice)
|
dr_or_cr, account = self.get_dr_and_account_for_advances(invoice)
|
||||||
args_dict["account"] = account
|
args_dict["account"] = account
|
||||||
args_dict[dr_or_cr] = self.calculate_base_allocated_amount_for_reference(invoice)
|
args_dict[dr_or_cr] = self.calculate_base_allocated_amount_for_reference(invoice)
|
||||||
|
|||||||
@@ -730,6 +730,22 @@ def update_reference_in_payment_entry(
|
|||||||
}
|
}
|
||||||
update_advance_paid = []
|
update_advance_paid = []
|
||||||
|
|
||||||
|
# Update Reconciliation effect date in reference
|
||||||
|
if payment_entry.advance_reconciliation_takes_effect_on == "Advance Payment Date":
|
||||||
|
reconcile_on = payment_entry.posting_date
|
||||||
|
elif payment_entry.advance_reconciliation_takes_effect_on == "Oldest Of Invoice Or Advance":
|
||||||
|
date_field = "posting_date"
|
||||||
|
if d.against_voucher_type in ["Sales Order", "Purchase Order"]:
|
||||||
|
date_field = "transaction_date"
|
||||||
|
reconcile_on = frappe.db.get_value(d.against_voucher_type, d.against_voucher, date_field)
|
||||||
|
|
||||||
|
if getdate(reconcile_on) < getdate(payment_entry.posting_date):
|
||||||
|
reconcile_on = payment_entry.posting_date
|
||||||
|
elif payment_entry.advance_reconciliation_takes_effect_on == "Reconciliation Date":
|
||||||
|
reconcile_on = nowdate()
|
||||||
|
|
||||||
|
reference_details.update({"reconcile_effect_on": reconcile_on})
|
||||||
|
|
||||||
if d.voucher_detail_no:
|
if d.voucher_detail_no:
|
||||||
existing_row = payment_entry.get("references", {"name": d["voucher_detail_no"]})[0]
|
existing_row = payment_entry.get("references", {"name": d["voucher_detail_no"]})[0]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user