Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

after inheritance odoo shows error ValueError: Invalid field 'same_vat_partner_id' on model 'tests.users'

inherited " res.partner " and added a page (editable tree) in notebook section, but when clicking on "Add a line" it is showing below error:

ValueError: Invalid field 'same_vat_partner_id' on model 'tests.users'

my model 'tests.users' have no field with this invalid field named 'same_vat_partner_id' or i am missing what odoo trying to communicate? please help to resolve the problem.

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")

and didn't used this model in any means when inherited res.partner... please help to resolve the problem.

my model and view files for inheritance:

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>
question from:https://stackoverflow.com/questions/65870438/after-inheritance-odoo-shows-error-valueerror-invalid-field-same-vat-partner-i

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You might have accidentally inherited res.partner when you created tests.users model, try upgrading your module or base module.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...