I am trying to move a module from odoo 8 to odoo 12 and I get this error when trying to install an odoo 8 module in an odoo 12 environment.
psycopg2.ProgrammingError: column reference "account_analytic_id" is ambiguous
LINE 18: ..., sub.product_id, sub.partner_id, sub.country_id, sub.accoun...
This is the code block from which I suspect the error is coming from
class AccountInvoiceReport(models.Model):
_inherit = 'account.invoice.report'
cost_center_id = fields.Many2one(
'account.cost.center',
string='Cost Center',
readonly=True
)
account_analytic_id = fields.Many2one(
'account.analytic.account',
string='Analytic Account',
readonly=True
)
def _select(self):
return super(AccountInvoiceReport, self)._select() + \
", sub.cost_center_id as cost_center_id, " + \
"sub.account_analytic_id as account_analytic_id"
def _sub_select(self):
return super(AccountInvoiceReport, self)._sub_select() + \
", ail.cost_center_id as cost_center_id, " + \
"ail.account_analytic_id as account_analytic_id"
def _group_by(self):
return super(AccountInvoiceReport, self)._group_by() + \
", ail.cost_center_id, " + \
"ail.account_analytic_id"
Just remove the query parts with account_analytic_id
, because it's already in the account.invoice.report
of Odoo 12.
Can be seen here