Hi, I have a model with a json field. I am trying to create a view for that model.
Approach 1: I want to parse the json field and then show that in UI. but I did not know how to achieve that.
Approach 2: Then I started with simply showing the json on UI. but it straight away gave an error.
my view is
<record id="view_farmpoint_tree" model="ir.ui.view">
<field name="name">fnf_geo.farmpoint.tree</field>
<field name="model">farmpoint</field>
<field name="arch" type="xml">
<tree string="Farm points">
<field name="coordinates"/>
<field name="is_success"/>
<field name="partner_id"/>
</tree>
</field>
</record>
my model is
class FarmPoint(models.Model):
_name = "farmpoint"
_description = "Stores coordinates of farms"
coordinates = fnf_fields.JSONB(string="Coordinates", required=True)
is_success = fields.Boolean(string="Successful data collection",
required=True, default=True)
partner_id = fields.Many2one('res.partner', string='Partner ID',
required=True, ondelete='restrict')
I was able to figure out that odoo does not support json as field, we have added custom field in odoo, and that's why it is not working.
I want to make it work as Approach 1, but any help is appreciated.