Skip to Content
Menu
This question has been flagged
4 Replies
2394 Views

Hello guys,

I am new user odoo.I don't know how to fix "Field does not exit " error.here is my code.

In model.py

from odoo import models, fields, api

class CrmnNewTask(models.Model):

_inherit = 'res.partner'

legalname=fields.Char('Legal Company Name')

In view.xml

<?xml version="1.0"?>

<odoo>

<record id="view_partner_form2" model="ir.ui.view">

<field name="name">res.partner.form2</field>

<field name="model">res.partner</field>

<field name="inherit_id" ref="base.view_partner_form"></field>

<field name="arch" type="xml">

<xpath expr="//field[@name='category_id'][not(ancestor::field)]" position="after">

<field name="legalname"></field>

</xpath>

</field>

</record>

</odoo>

and I also import in __init.py__

Avatar
Discard

Normaly such an error occur when a field is not defined in the model. Here in your case every thing seems fine, anyway just cross check it once more

Author

Thank you.Yesterday nigh,I shut down the pc.Today morning,when i run pc, there is no error.

Obviously Odoo stops when you shut down your PC and it starts again, when you start your PC.

Best Answer

To be more specific, you need to restart the Server with -i option.  Like,

./odoo-bin --addons-path=addons,../enterprise/ -d database-ent -i <-Your-Module-Name->  --dev=all
Avatar
Discard
Best Answer

If  you change the data models, you should restart Odoo in order to populate the changes.

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 24
18019
1
Sep 23
1203
3
May 23
4089
7
Apr 23
47091
1
Dec 22
6434