Merge pull request #16041 from surajshetty3416/pos-profile-fix
fix: Add additional condition to get_pos_profile
This commit is contained in:
commit
bcd0ba0d69
@ -594,22 +594,21 @@ def get_pos_profile(company, pos_profile=None, user=None):
|
|||||||
if not user:
|
if not user:
|
||||||
user = frappe.session['user']
|
user = frappe.session['user']
|
||||||
|
|
||||||
pos_profile = frappe.db.sql("""select pf.*
|
pos_profile = frappe.db.sql("""SELECT pf.*
|
||||||
from
|
FROM
|
||||||
`tabPOS Profile` pf, `tabPOS Profile User` pfu
|
`tabPOS Profile` pf LEFT JOIN `tabPOS Profile User` pfu
|
||||||
where
|
ON
|
||||||
pfu.parent = pf.name and pfu.user = %s and pf.company = %s
|
|
||||||
and pf.disabled = 0 and pfu.default=1""", (user, company), as_dict=1)
|
|
||||||
|
|
||||||
if not pos_profile:
|
|
||||||
pos_profile = frappe.db.sql("""select pf.*
|
|
||||||
from
|
|
||||||
`tabPOS Profile` pf left join `tabPOS Profile User` pfu
|
|
||||||
on
|
|
||||||
pf.name = pfu.parent
|
pf.name = pfu.parent
|
||||||
where
|
WHERE
|
||||||
ifnull(pfu.user, '') = '' and pf.company = %s
|
(
|
||||||
and pf.disabled = 0""", (company), as_dict=1)
|
(pfu.user = %(user)s AND pf.company = %(company)s AND pfu.default=1)
|
||||||
|
OR (pfu.user = %(user)s AND pfu.default=1)
|
||||||
|
OR (ifnull(pfu.user, '') = '' AND pf.company = %(company)s)
|
||||||
|
) AND pf.disabled = 0
|
||||||
|
""", {
|
||||||
|
'user': user,
|
||||||
|
'company': company
|
||||||
|
}, as_dict=1)
|
||||||
|
|
||||||
return pos_profile and pos_profile[0] or None
|
return pos_profile and pos_profile[0] or None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user