fix: POS Opening Entry with empty balance detail rows (#24876)

This commit is contained in:
Marica 2021-03-15 12:49:14 +05:30 committed by GitHub
parent 46d5431bad
commit 4ceea333a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -24,6 +24,7 @@ class POSOpeningEntry(StatusUpdater):
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:
if d.mode_of_payment:
account = frappe.db.get_value("Mode of Payment Account", account = frappe.db.get_value("Mode of Payment Account",
{"parent": d.mode_of_payment, "company": self.company}, "default_account") {"parent": d.mode_of_payment, "company": self.company}, "default_account")
if not account: if not account:

View File

@ -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);