Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Property Management
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Error while creating module

Subscriure's

Get notified when there's activity on this post

This question has been flagged
2 Respostes
7643 Vistes
Avatar
cn

I get an error while trying to create my own module.
The error appears when I try to install the module (from a tutorial). I think it is to do with the xml file test.xml. But I just cannot see the error in it. Please help. I am using OpenERP version 6.1.1 (I cannot upgrade for now). Thank you. Here is the error output:

Client Traceback (most recent call last):
File "/opt/OpenObject/openerp-6.1-1/openerp/addons/web/common/http.py", line 180, in dispatch
response["result"] = method(controller, self, *self.params)
File "/opt/OpenObject/openerp-6.1-1/openerp/addons/web/controllers/main.py", line 498, in authenticate
req.session.authenticate(db, login, password, env)
File "/opt/OpenObject/openerp-6.1-1/openerp/addons/web/common/session.py", line 73, in authenticate
uid = self.proxy('common').authenticate(db, login, password, env)
File "/opt/OpenObject/openerp-6.1-1/openerp/addons/web/common/openerplib/main.py", line 117, in proxy
result = self.connector.send(self.service_name, method, *args)
File "/opt/OpenObject/openerp-6.1-1/openerp/addons/web/common/http.py", line 608, in send
raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)


Server Traceback (most recent call last):
File "/opt/OpenObject/openerp-6.1-1/openerp/addons/web/common/http.py", line 593, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/opt/OpenObject/openerp-6.1-1/openerp/netsvc.py", line 360, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/OpenObject/openerp-6.1-1/openerp/service/web_services.py", line 397, in dispatch
return fn(
params)
File "/opt/OpenObject/openerp-6.1-1/openerp/service/web_services.py", line 408, in exp_authenticate
res_users = pooler.get_pool(db).get('res.users')
File "/opt/OpenObject/openerp-6.1-1/openerp/pooler.py", line 50, in get_pool
return get_db_and_pool(db_name, force_demo, status, update_module)[1]
File "/opt/OpenObject/openerp-6.1-1/openerp/pooler.py", line 33, in get_db_and_pool
registry = RegistryManager.get(db_name, force_demo, status, update_module, pooljobs)
File "/opt/OpenObject/openerp-6.1-1/openerp/modules/registry.py", line 180, in get
update_module, pooljobs)
File "/opt/OpenObject/openerp-6.1-1/openerp/modules/registry.py", line 202, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module)
File "/opt/OpenObject/openerp-6.1-1/openerp/modules/loading.py", line 334, in load_modules
processed = load_marked_modules(cr, graph, states_to_load, force, status, report, loaded_modules)
File "/opt/OpenObject/openerp-6.1-1/openerp/modules/loading.py", line 253, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules)
File "/opt/OpenObject/openerp-6.1-1/openerp/modules/loading.py", line 193, in load_module_graph
load_data(module_name, idref, mode)
File "/opt/OpenObject/openerp-6.1-1/openerp/modules/loading.py", line 92, in <lambda>
load_data = lambda *args: _load_data(cr, *args, kind='data')
File "/opt/OpenObject/openerp-6.1-1/openerp/modules/loading.py", line 138, in _load_data
tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report)
File "/opt/OpenObject/openerp-6.1-1/openerp/tools/convert.py", line 988, in convert_xml_import
relaxng.assert_(doc)
File "lxml.etree.pyx", line 3016, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:125483)
AssertionError: Did not expect element templates there, line 2

---------------------------------------------------------------------------

Below are the contents of my files



addons/web_example/__init__.py:

#!/usr/bin/python

++++++++++++++++++++++++++++++++++++++++++++++
addons/web_example/__openerp__.py:

{
'name': "Web Example",
'category': "Hidden",
'description':"A basic web example module",
'depends': ['web'],
'data':["static/xml/test.xml",'web_example.xml'],
'js': ["static/openerp/first_module.js"],
}

++++++++++++++++++++++++++++++++++++++++++++++
addons/web_example/web_example.xml:

<?xml version="1.0" encoding="utf-8" ?>
<openerp>
<data>
<record model="ir.actions.act_window" id="action_client_example">
<field name="name">web_example_class</field>
<field name="res_model">web_example_class</field>
<!--<field name="tag">example.action</field>-->
</record>

<record model="ir.ui.view" id="test_form_view">
<field name="name">test.form</field>
<field name="model">web_example_class</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="test">
<field name="numero" widget="test" />
</form>
</field>
</record>
<menuitem name="WEB EXAMPLE" action="action_client_example" id="menu_client_example"/>
</data>
</openerp>

++++++++++++++++++++++++++++++++++++++++++++++

addons/web_example/static/openerp/first_module.js:

alert("Before function");
openerp.web_example = function(openerp){
openerp.web.form.widgets.add('test','openerp.web.form.test');
openerp.web.form.test = openerp.web.form.FieldChar.extend(
{
template:'test_button',
init: function(){
this._super.apply(this,arguments);
this._start = null;
console.log('INIT');
},
start: function(){
console.log('START');
$('button#bstart').click(this.myfunction);
},
myfunction:function(){
alert("moja funkcja");
console.log("From function");
}
}
)
};


alert("After fnction");

++++++++++++++++++++++++++++++++++++++++++++++
addons/web_example/static/xml/test.xml:

<?xml version="1.0" encoding="utf-8" ?>
<templates>
<div t-name="test_button" t-attf-class="base #{cls}" class="oe_web_example">
<p>
<button name="dosomething" type="button" id="bstart">start</button>
</p>
</div>
</templates>


0
Avatar
Descartar
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Best Answer

Files that contains qweb templates are placed under qweb in __openerp__.py file.

Remove test.xml file from data and put it in qweb in __openerp__.py like this:

'qweb': ['static/xml/test.xml'],

Hope this will solve your problem.

5
Avatar
Descartar
cn
Autor

Hi Sudhir. I did as you said and the error message disappeared. Normally this module should have displayed a button, but it doesn't.When I install/update the module, I get the alert messages "Before function" and "After function", but no button is displayed. Would you know what is missing? Thanks once more.

Ankit H Gandhi(AHG)

Thanks @sudhir arya This code is very help for me

Avatar
Hadooc, Borni DHIFI
Best Answer

Hi,

https://accounts.openerp.com/forum/Help-1/question/16336#16338

can help you

1
Avatar
Descartar
cn
Autor

Hi Borni. Thanks for the link. I am on it right now reading one of the tutorials.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now