Dear Odoo Community,
I am currently working on customizing the sale.report model by adding a new custom field. Despite following the appropriate steps, I am encountering an error stating that the custom field cannot be found.
Could anyone provide guidance on how to resolve this issue? Specifically:
- What could be causing the 'field not found' error in this context?
- Are there any additional steps I need to take to ensure the custom field is correctly recognized and included in the sale.report?
- How can I confirm that my SQL query correctly reflects the new field and its source?
Any help or suggestions would be greatly appreciated!
Thank you in advance for your assistance.
here's my python code -
from odoo import _, api, fields, models
class SWMSaleReport(models.Model):
_inherit = 'sale.report'
partner_township_id = fields.Many2one('res.country.township', string="Township", related='partner_id.township_id')
def _select_additional_fields(self):
res = super()._select_additional_fields()
# Correct SQL syntax without 'AS'
res['partner_township_id'] = f"""s.partner_township_id
"""
return res
Please help