Saumax
Saumax

Reputation: 23

Error while parsing xml view in odoo 10

SOLVED // Apparently there were nothing wrong with code but with odoo, server didn't refreshed app correctly and updated only xml files while retaining old .py files, updating app list and reinstalling module solved matter, thanks everyone for help.

Futher Reference: it seems that odoo have problems with python at all, a elementary issue with reading tabulations/spaces, pro-hint: never use tabs but spaces and shove 4 of them before any declaration within .py - it is second part of issue posted here.

Summary: Problem were not on code side but on odoo side, it had trouble with refreshing .py files and problem with reading tabulations or any white spaces, workaround is simple but is heavy tiresome: stop your odoo service, delete .pyc files within your module, remove any tabulation within .py code and change it to spaces(4 preferably in exchange for single tabulation), restart your odoo server, update your app list and install your module - as i said its only workaround and its shame that such problems even exist in version 10


Hello everyone i have problem with installing custom module within odoo, its just plain simple model.py with main_view.xml (Additional info: its fresh odoo installation)

As some may wonder, there is no diffrent files except init.py, manifest.py, models.py, main_view.xml

Error:

ParseError: "project_manager.start" while parsing file:///C:
/Program%20Files%20(x86)/Odoo%2010.0/server/odoo/addons/project_manager
/views/main_view.xml:3, near record id="first" 
model="project_manager.start">
field name="name">Test_Name</field>
</record>

model.py:

from odoo import models, fields

class project_manager(models.Model):
    _name = 'project_manager.start'

    name = fields.Char(required=true)
    value = fields.Integer()
    description = fields.Text(string="Description_Test")

main_view.xml:

<odoo>
    <data>
         <record id='first' model='project_manager.start'>
            <field name='name'>Test_Name</field>
         </record>
   </data>
</odoo>

im quite out of ideas even if this is quite simple case imho, thanks in advance

Edit // After @Heroic suggestion i receive:

ParseError: "Error while validating constraint

Nie znaleziono modelu: project_manager.start

Error context:
View `project_manager.start.form`
[view_id: 208, xml_id: n/a, model: project_manager.start, parent_id: n/a]
None" while parsing file:///C:/Program%20Files%20(x86)/Odoo%2010.0/server   
/odoo/addons/project_manager/views/main_view.xml:4, near
<record id="your_form_unique_id" model="ir.ui.view">
<field name="name">project_manager.start.form</field>
<field name="model">project_manager.start</field>
<field name="arch" type="xml">
<form string="">
<sheet>
<group>
<field name="name" string="Test Name"/>
</group>
</sheet>
</form>
</field>
</record>

Edit2 // After looking for easiest to understand module installed default in odoo i went with procurement module and compared my models relation to relations in that module which is identical therefore i cannot provide any more decent information regarding this issue

Eddit // Due to @Dayana request im posting current main_view.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
    <record id="first" model="ir.ui.view">
        <field name="name">projectm.start.form</field>
        <field name="model">projectm.start</field>
        <field name="arch" type="xml">
            <form string="Test">
                    <group>
                        <field name="name"/>
                    </group>
            </form>
        </field>
    </record>
</data>
</odoo>

As in code i've changed 'project_manager' label to 'projectm' in main_view.xml and models.py

Upvotes: 2

Views: 3390

Answers (1)

Heroic
Heroic

Reputation: 980

You have add view is missing tags: change your code as below:

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <data>
        <record id="your_form_unique_id" model="ir.ui.view">
            <field name="name">project_manager.start.form</field>
            <field name="model">project_manager.start</field>
            <field name="arch" type="xml">
                <form string="">
                    <sheet>
                        <group>
                            <field name="name" string="Test Name" />
                        </group>
                    </sheet>
                </form>
            </field>
        </record>
    </data>
</odoo>

Upvotes: 2

Related Questions