Reputation: 193
I am creating a module on odoo local(offline). To create it, it requires Model(in python) and View(in Xml). The module will then be installed, but an error occurred after creating the view.
This is the view.xml
<openerp>
<data>
<record id="view_form_todo_task_inherited" model="ir.ui.view">
<field name="name">Todo Task form – User extension</field>
<field name="model">todo.task</field>
<field name="inherit_id" ref="todo_app.view_form_todo_task"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="user_id" />
</field>
<field name="is_done" position="before">
<field name="date_deadline" />
</field>
<field name="name" position="attributes">
<attribute name="string">I have to...<attribute/>
</field>
</field>
</record>
</data>
</openerp>`
in creating the view it is important to make it inside <data>
that is inside <openerp>
otherwise it wont work.
When trying to install the module(which also will compile the codes), an error occurred and it indicates that there is something wrong with the view.xml file. It says
XMLSyntaxError: Input is not proper UTF-8, indicate encoding !
Bytes: 0x96 0x20 0x55 0x73, line 4, column 28
here is the traceback
` Odoo Server Error
Traceback (most recent call last):
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\http.py", line 530, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\http.py", line 567, in dispatch
result = self._call_function(**self.params)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\http.py", line 303, in _call_function
return checked_call(self.db, *args, **kwargs)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\service\model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\http.py", line 300, in checked_call
return self.endpoint(*a, **kw)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\http.py", line 796, in __call__
return self.method(*args, **kw)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\http.py", line 396, in response_wrap
response = f(*args, **kw)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\addons\web\controllers\main.py", line 940, in call_button
action = self._call_kw(model, method, args, {})
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\addons\web\controllers\main.py", line 928, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\addons\base\module\module.py", line 450, in button_immediate_install
return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\addons\base\module\module.py", line 498, in _button_immediate_function
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\modules\registry.py", line 368, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\modules\loading.py", line 355, in load_modules
loaded_modules, update_module)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\modules\loading.py", line 255, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\modules\loading.py", line 176, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\modules\loading.py", line 118, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\tools\convert.py", line 901, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "D:\Bitnami\odoo-8.0-12\apps\odoo\Lib\site-packages\odoo-8.0_20150423-py2.7.egg\openerp\tools\convert.py", line 974, in convert_xml_import
doc = etree.parse(xmlfile)
File "lxml.etree.pyx", line 3299, in lxml.etree.parse (src\lxml\lxml.etree.c:72421)
File "parser.pxi", line 1812, in lxml.etree._parseDocument (src\lxml\lxml.etree.c:106108)
File "parser.pxi", line 1832, in lxml.etree._parseFilelikeDocument (src\lxml\lxml.etree.c:106368)
File "parser.pxi", line 1727, in lxml.etree._parseDocFromFilelike (src\lxml\lxml.etree.c:105258)
File "parser.pxi", line 1146, in lxml.etree._BaseParser._parseDocFromFilelike (src\lxml\lxml.etree.c:100385)
File "parser.pxi", line 580, in lxml.etree._ParserContext._handleParseResultDoc (src\lxml\lxml.etree.c:94254)
File "parser.pxi", line 690, in lxml.etree._handleParseResult (src\lxml\lxml.etree.c:95690)
File "parser.pxi", line 620, in lxml.etree._raiseParseError (src\lxml\lxml.etree.c:94757)
XMLSyntaxError: Input is not proper UTF-8, indicate encoding !
Bytes: 0x96 0x20 0x55 0x73, line 4, column 28`
Upvotes: 2
Views: 5377
Reputation: 1575
I reformatted your xml to better check it and I noticed two things: 1. the data tag was missing 2. there where two "'" characters at the beginning and at the end of your xml. Because your trace says "Input is not proper UTF-8" it occurs to me that the problem could be given by this very same character.
Check in yor source file if they are there as well and remove them, then add the data tag as below.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_form_todo_task_inherited" model="ir.ui.view">
<field name="name">Todo Task form – User extension</field>
<field name="model">todo.task</field>
<field name="inherit_id" ref="todo_app.view_form_todo_task"/>
<field name="arch" type="xml">
<data>
<field name="name" position="after">
<field name="user_id" />
</field>
<field name="is_done" position="before">
<field name="date_deadline" />
</field>
<field name="name" position="attributes">
<attribute name="string">I have to...</attribute>
</field>
</data>
</field>
</record>
</data>
</openerp>
Upvotes: 2