I am getting this error while upgrading my custom module in odoo13 while upgrading it , the error is within this xml file.i have added somoe fields in xml file then it showing me this erro
ошибка:
Отслеживание ошибок сервера Odoo (последний вызов был последним): файл "/odoo/odoo-server/odoo/addons/base/models/ir_ui_view.py", строка 392, в файле _check_xml self.postprocess_and_fields (view.model, view_do c, view.id) в файле "/odoo/odoo-server/odoo/addons/base/models/ir_ui_view.py", строка 964, в postprocess_and_fields self.raise_view_error ( message, view_id) Файл "/odoo/odoo-server/odoo/addons/base/models/ir_ui_view.py", строка 592, в lift_view_error поднять ValueError (message) ValueError: Поле state
не существует
Контекст ошибки: View view.demo.form
[view_id: 1710, xml_id: gunalan_demo.request_form, модель: car.request, parent_id: н / д]
models.py:
# -*- coding: utf-8 -*-
from odoo import models, fields, api , _
class gunalan_demo(models.Model):
_name = 'car.request' #Tables in DB =>car_request
_description = 'demo module'
name = fields.Char(string="Request_demo",required = True ,)
date_from = fields.Datetime(string='starting date',default=fields.Datetime.now(),)
date_to = fields.Datetime(string='Ending date',required=False,)
emplyoee_id= fields.Many2one(comodel_name="hr.employee", string="Emplyoee ", required=True,)
car_id = fields.Many2one(comodel_name="fleet.vehicle", string="Car ", required=True,)
state = fields.Selection(string="Status", selection=[('draft', 'Draft'), ('confirm', 'Confirm'),('validate','Validate'),('refuse','Refuse')('approved','Approved'),], default="draft", )
views.xml:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id ="request_form" model ="ir.ui.view">
<field name="name">view.demo.form</field>
<field name="model">car.request</field>
<field name="arch" type="xml">
<form string ="Car Request Form">
<header>
<!--<button name="" string="" class="oe_highlight" states="" type=""/>-->
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate,refuse,approved"/>
</header>
<sheet>
<div class="oe_title">
<label for="name" class="oe_title_only"/>
<h1>
<field name="name" placeholder="Request Demo"/>
</h1>
</div>
<group>
<group>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="emplyoee_id"/>
<field name="car_id"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id='request_tree' model='ir.ui.view' >
<field name='name'>view.demo.tree</field>
<field name='model'>car.request</field>
<field name='arch' type='xml'>
<tree string='Car Request Tree'>
<field name="name"/>
<field name="emplyoee_id"/>
<field name="car_id"/>
<field name="date_from"/>
<field name="date_to"/>
</tree>
</field>
</record>
<record id="action_request_views" model="ir.actions.act_window">
<field name="name">Car Request</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">car.request</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Car Request
</p><p>
Click here to add
</p>
</field>
</record>
<!-- This Menu Item will appear in the Upper bar, That's why It needs NO parent or action -->
<menuitem id="menu_car_request_root" name="Car Request" sequence="10"/>
<menuitem id="menu_car_request_categ" name="Car Request" parent="menu_car_request_root" sequence="1"/>
<menuitem id="menu_car_request" name="Car Request" parent="menu_car_request_categ" action="action_request_views" sequence="1"/>