cancel
Showing results for 
Search instead for 
Did you mean: 

Sales Invoice Grid some Columns Filters not working when added new Tax/Vat Number column

Sales Invoice Grid some Columns Filters not working when added new Tax/Vat Number column

I have added new column Tax/Vat Number in Sales Invoice Grid. For this column filter i have added the following code in Custom Module Plugin file as

public function aroundGetReport(CollectionFactory $subject, \Closure $proceed, $requestName)
{
    $result = $proceed($requestName);

    if (self::SALES_ORDER_INVOICE_GRID_DATA_SOURCE == $requestName) {
        if ($result instanceof $this->collection) {
            $select = $this->collection->getSelect();
            $select->joinLeft(
                ['sales_order' => $this->collection->getTable('sales_order')],
                'main_table.order_increment_id = sales_order.increment_id',
                ['customer_taxvat']
            );

            return $this->collection;
        }
    }

    return $result;
}

And this Tax/Vat Column and its filter is working fine. But after adding this new filter remaining filters are not working.

For Example: When we tried to filter with the invoice id it was getting the following error:

Integrity constraint violation: 1052 Column 'increment_id' in where clause is ambiguous.

And similar error when try to filter with some other columns only after adding this new column and filter.

Please help...