pymysql.err.OperationalError: (1052, "Column 'company' in where clause is ambiguous")

Dear All,

When i trying to rec supplier, Customers payment there is some pymysql error

do you have any idea how to resolve this error

Hi,

It may help to say the version of ERPNext , if reconciliations were successful in the past, and if this started happening after a recent update.

Thank you for your reply, it was updated V 12 to V 13

Ambiguity happens because same field name exists in both tables on each side of an SQL join

make a correction on code.

app/erpnext/erpnext/accounts/report/gross_profit/gross_profit.py
add tabSales Invoice before “company” to avoid ambiguity as shown below.

def load_invoice_items(self):
conditions = “”
if self.filters.company:
conditions += " and tabSales Invoice.company = %(company)s" #code corrected by erpgulf support team. Ambiguous column company
if self.filters.from_date:
conditions += " and posting_date >= %(from_date)s"
if self.filters.to_date:
conditions += " and posting_date <= %(to_date)s"

            if self.filters.item_group:
                    conditions += " and {0}".format(get_item_group_condition(self.filters.item_group))