Added Customer contact column in accounts Receivable

This commit is contained in:
deepeshgarg007 2019-01-04 10:54:24 +05:30
parent cda289dc27
commit 9de81cda77

View File

@ -32,6 +32,15 @@ class ReceivablePayableReport(object):
columns += [_(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
if args.get("party_type") == 'Customer':
columns.append({
"label": _("Customer Contact"),
"fieldtype": "Link",
"fieldname": "contact",
"options":"Contact",
"width": 100
})
if party_naming_by == "Naming Series":
columns += [args.get("party_type") + " Name::110"]
@ -282,6 +291,9 @@ class ReceivablePayableReport(object):
if party_naming_by == "Naming Series":
row += [self.get_party_name(gle.party_type, gle.party)]
if args.get("party_type") == 'Customer':
row += [self.get_customer_contact(gle.party_type, gle.party)]
# get due date
if not due_date:
due_date = self.voucher_details.get(gle.voucher_no, {}).get("due_date", "")
@ -407,6 +419,9 @@ class ReceivablePayableReport(object):
def get_party_name(self, party_type, party_name):
return self.get_party_map(party_type).get(party_name, {}).get("customer_name" if party_type == "Customer" else "supplier_name") or ""
def get_customer_contact(self, party_type, party_name):
return self.get_party_map(party_type).get(party_name, {}).get("customer_primary_contact")
def get_territory(self, party_name):
return self.get_party_map("Customer").get(party_name, {}).get("territory") or ""
@ -419,7 +434,7 @@ class ReceivablePayableReport(object):
def get_party_map(self, party_type):
if not hasattr(self, "party_map"):
if party_type == "Customer":
select_fields = "name, customer_name, territory, customer_group"
select_fields = "name, customer_name, territory, customer_group, customer_primary_contact"
elif party_type == "Supplier":
select_fields = "name, supplier_name, supplier_group"