继承了“ res.partner ”并在笔记本部分添加了一个页面(可编辑树),但是当单击“添加一行”时,它显示以下错误:
ValueError: Invalid field 'same_vat_partner_id' on model 'tests.users'
我的模型“tests.users”没有包含名为“same_vat_partner_id”的无效字段的字段,或者我错过了试图交流的 odoo?请帮助解决问题。
class Users(models.Model):
_name = 'tests.users'
_rec_name = 'name'
_description = "Tests Users"
name = fields.Char(string="User Name", required=True)
email = fields.Char(string="Email")
email_verified_at = fields.Datetime(string="Email Verified At")
address = fields.Text(string="User Address")
password = fields.Char(string="Password", required=True)
profile_picture = fields.Binary()
phone = fields.Char(string="Phone No.", required=True)
type = fields.Selection([
('staff', 'Staff'),
('customer', 'Customer'),
('rider', 'Rider')
], required=True, string="User Type", default='staff')
remember_token = fields.Char(string="Remember Token")
zone_id = fields.Many2one("tests.zones", string="Zone")
description = fields.Text(string="Other Information")
deleted_at = fields.Datetime()
user_ids = fields.One2many('tests.userzones', 'user_id', string="User Zone")
并且在继承 res.partner 时没有以任何方式使用此模型...请帮助解决问题。
我用于继承的模型和视图文件:
class PartnerZone(models.Model):
_inherit = 'res.partner'
zone_id = fields.Many2one('tests.zones', string="Zone")
user_mids = fields.One2many('tests.usermetas', 'user_id', string="User Metas")
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>
<!-- added below code for editable tree in contacts form -->
<xpath expr="//page[@name='sales_purchases']" position="after" >
<page string="Wallets">
<field name="user_wids">
<tree editable="bottom" string="User Wallets">
<field name="amount"/>
<field name="credits"/>
<field name="description"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
</odoo>