fix: list index out of range error while setting POS payment mode (#23018)
This commit is contained in:
parent
404afb823f
commit
5fb0e7184e
@ -1619,22 +1619,23 @@ def update_multi_mode_option(doc, pos_profile):
|
|||||||
|
|
||||||
for pos_payment_method in pos_profile.get('payments'):
|
for pos_payment_method in pos_profile.get('payments'):
|
||||||
pos_payment_method = pos_payment_method.as_dict()
|
pos_payment_method = pos_payment_method.as_dict()
|
||||||
|
|
||||||
payment_mode = get_mode_of_payment_info(pos_payment_method.mode_of_payment, doc.company)
|
payment_mode = get_mode_of_payment_info(pos_payment_method.mode_of_payment, doc.company)
|
||||||
payment_mode[0].default = pos_payment_method.default
|
if payment_mode:
|
||||||
append_payment(payment_mode[0])
|
payment_mode[0].default = pos_payment_method.default
|
||||||
|
append_payment(payment_mode[0])
|
||||||
|
|
||||||
def get_all_mode_of_payments(doc):
|
def get_all_mode_of_payments(doc):
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select mpa.default_account, mpa.parent, mp.type as type
|
select mpa.default_account, mpa.parent, mp.type as type
|
||||||
from `tabMode of Payment Account` mpa,`tabMode of Payment` mp
|
from `tabMode of Payment Account` mpa,`tabMode of Payment` mp
|
||||||
where mpa.parent = mp.name and mpa.company = %(company)s and mp.enabled = 1""",
|
where mpa.parent = mp.name and mpa.company = %(company)s and mp.enabled = 1""",
|
||||||
{'company': doc.company}, as_dict=1)
|
{'company': doc.company}, as_dict=1)
|
||||||
|
|
||||||
def get_mode_of_payment_info(mode_of_payment, company):
|
def get_mode_of_payment_info(mode_of_payment, company):
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select mpa.default_account, mpa.parent, mp.type as type
|
select mpa.default_account, mpa.parent, mp.type as type
|
||||||
from `tabMode of Payment Account` mpa,`tabMode of Payment` mp
|
from `tabMode of Payment Account` mpa,`tabMode of Payment` mp
|
||||||
where mpa.parent = mp.name and mpa.company = %s and mp.enabled = 1 and mp.name = %s""",
|
where mpa.parent = mp.name and mpa.company = %s and mp.enabled = 1 and mp.name = %s""",
|
||||||
(company, mode_of_payment), as_dict=1)
|
(company, mode_of_payment), as_dict=1)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user