perf: reduce number of queries to get party link
This commit is contained in:
parent
a2f8d6c31a
commit
7254368fc5
@ -1375,9 +1375,12 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
def get_common_party_link(self):
|
def get_common_party_link(self):
|
||||||
party_type, party = self.get_party()
|
party_type, party = self.get_party()
|
||||||
party_link = frappe.db.exists('Party Link', {'secondary_role': party_type, 'secondary_party': party})
|
return frappe.db.get_value(
|
||||||
if party_link:
|
doctype='Party Link',
|
||||||
return frappe.db.get_value('Party Link', party_link, ['primary_role', 'primary_party'], as_dict=True)
|
filters={'secondary_role': party_type, 'secondary_party': party},
|
||||||
|
fieldname=['primary_role', 'primary_party'],
|
||||||
|
as_dict=True
|
||||||
|
)
|
||||||
|
|
||||||
def create_advance_and_reconcile(self, party_link):
|
def create_advance_and_reconcile(self, party_link):
|
||||||
secondary_party_type, secondary_party = self.get_party()
|
secondary_party_type, secondary_party = self.get_party()
|
||||||
|
Loading…
Reference in New Issue
Block a user