Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Error while creating module

Subscribe

Get notified when there's activity on this post

This question has been flagged
2 Replies
7631 Views
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
Discard
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
Discard
cn
Author

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
Discard
cn
Author

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!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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