fix: payments duplicate on pos closing entry (#30976)
diff --git a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js
index 264d4a6..572410f 100644
--- a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js
+++ b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js
@@ -64,13 +64,15 @@
pos_opening_entry(frm) {
if (frm.doc.pos_opening_entry && frm.doc.period_start_date && frm.doc.period_end_date && frm.doc.user) {
reset_values(frm);
- frm.trigger("set_opening_amounts");
- frm.trigger("get_pos_invoices");
+ frappe.run_serially([
+ () => frm.trigger("set_opening_amounts"),
+ () => frm.trigger("get_pos_invoices")
+ ]);
}
},
set_opening_amounts(frm) {
- frappe.db.get_doc("POS Opening Entry", frm.doc.pos_opening_entry)
+ return frappe.db.get_doc("POS Opening Entry", frm.doc.pos_opening_entry)
.then(({ balance_details }) => {
balance_details.forEach(detail => {
frm.add_child("payment_reconciliation", {
@@ -83,7 +85,7 @@
},
get_pos_invoices(frm) {
- frappe.call({
+ return frappe.call({
method: 'erpnext.accounts.doctype.pos_closing_entry.pos_closing_entry.get_pos_invoices',
args: {
start: frappe.datetime.get_datetime_as_string(frm.doc.period_start_date),