fix(sales-invoice): Use orm instead of frappe.db.sql (#18434)
This commit is contained in:
parent
195465cdd9
commit
dc42cc3998
@ -1258,9 +1258,8 @@ def validate_inter_company_party(doctype, party, company, inter_company_referenc
|
||||
frappe.throw(_("Invalid Company for Inter Company Transaction."))
|
||||
|
||||
elif frappe.db.get_value(partytype, {"name": party, internal: 1}, "name") == party:
|
||||
companies = frappe.db.sql("""select company from `tabAllowed To Transact With`
|
||||
where parenttype = '{0}' and parent = '{1}'""".format(partytype, party), as_list = 1)
|
||||
companies = [d[0] for d in companies]
|
||||
companies = frappe.get_all("Allowed To Transact With", fields=["company"], filters={"parenttype": partytype, "parent": party})
|
||||
companies = [d.company for d in companies]
|
||||
if not company in companies:
|
||||
frappe.throw(_("{0} not allowed to transact with {1}. Please change the Company.").format(partytype, company))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user