hi all, facing problem to add a page in notebook for a One2many field, its appearing in tree style view but I it to appear like a form view but failed. when using <tree> or <form> its working in tree style otherwise showing error on Upgrade module. also notice that it is showing User in tree which is not included in view/xml file. please help and guide how I can have a form like single record entry view here for a One2many field under notebook section. my both file entries are here what I did. definitely i am missing something or doing wrong because of my very little knowledge.
from odoo import models, fields
class Wallets(models.Model):
_name = 'tests.userwallets'
_description = "Tests Wallets"
user_id = fields.Many2one("res.partner", ondelete='cascade', string="User", required=True)
amount = fields.Float(string="Amount", required=True)
credits = fields.Integer(string="Credits", required=True)
description = fields.Text(string="Description")
from odoo import models, fields
class PartnerZone(models.Model):
_inherit = 'res.partner'
zone_id = fields.Many2one('tests.zones', string="Zone")
user_wids = fields.One2many('tests.userwallets', 'user_id', string="User Wallets")
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_res_partner_form_inherit" model="ir.ui.view">
<field name="name">Contacts Custom Fields</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='category_id']" position="after">
<field name="zone_id" string="Zone"/>
</xpath>
<!-- User Wallet entry under notebook section -->
<!-- ======================================== -->
<xpath expr="//notebook" position="inside">
<page string="Wallets">
<field name="user_wids">
<form>
<group>
<field name="amount"/>
<field name="credits"/>
<field name="description"/>
</group>
</form>
</field>
</page>
</xpath>
</field>
</record>
</odoo>