fix: POS Opening Entry with empty balance detail rows (#24876)
This commit is contained in:
parent
46d5431bad
commit
4ceea333a7
@ -20,15 +20,16 @@ class POSOpeningEntry(StatusUpdater):
|
|||||||
|
|
||||||
if not cint(frappe.db.get_value("User", self.user, "enabled")):
|
if not cint(frappe.db.get_value("User", self.user, "enabled")):
|
||||||
frappe.throw(_("User {} is disabled. Please select valid user/cashier").format(self.user))
|
frappe.throw(_("User {} is disabled. Please select valid user/cashier").format(self.user))
|
||||||
|
|
||||||
def validate_payment_method_account(self):
|
def validate_payment_method_account(self):
|
||||||
invalid_modes = []
|
invalid_modes = []
|
||||||
for d in self.balance_details:
|
for d in self.balance_details:
|
||||||
account = frappe.db.get_value("Mode of Payment Account",
|
if d.mode_of_payment:
|
||||||
{"parent": d.mode_of_payment, "company": self.company}, "default_account")
|
account = frappe.db.get_value("Mode of Payment Account",
|
||||||
if not account:
|
{"parent": d.mode_of_payment, "company": self.company}, "default_account")
|
||||||
invalid_modes.append(get_link_to_form("Mode of Payment", d.mode_of_payment))
|
if not account:
|
||||||
|
invalid_modes.append(get_link_to_form("Mode of Payment", d.mode_of_payment))
|
||||||
|
|
||||||
if invalid_modes:
|
if invalid_modes:
|
||||||
if invalid_modes == 1:
|
if invalid_modes == 1:
|
||||||
msg = _("Please set default Cash or Bank account in Mode of Payment {}")
|
msg = _("Please set default Cash or Bank account in Mode of Payment {}")
|
||||||
|
@ -93,6 +93,10 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
})
|
})
|
||||||
return frappe.utils.play_sound("error");
|
return frappe.utils.play_sound("error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// filter balance details for empty rows
|
||||||
|
balance_details = balance_details.filter(d => d.mode_of_payment);
|
||||||
|
|
||||||
const method = "erpnext.selling.page.point_of_sale.point_of_sale.create_opening_voucher";
|
const method = "erpnext.selling.page.point_of_sale.point_of_sale.create_opening_voucher";
|
||||||
const res = await frappe.call({ method, args: { pos_profile, company, balance_details }, freeze:true });
|
const res = await frappe.call({ method, args: { pos_profile, company, balance_details }, freeze:true });
|
||||||
!res.exc && me.prepare_app_defaults(res.message);
|
!res.exc && me.prepare_app_defaults(res.message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user