Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Odoo 9.0 Website tutorial - Selling Courses

By
Pieter Paulussen
on 4/6/16, 11:03 AM 545 views

 I have a question about the 'Selling Courses' part of the Odoo tutorial.

This is the output of the server when I want to open the website. Apparantly there is a problem with the parsing of the xml file. But I think the cause has to be that the "website_sale.categ_others" is just not recognised. Or perhaps it has something to do with the depends import in the __openerp__.py file.

At this point I've gone from copy/pasting every change in the code to my files, but this has shown no effect. 

Apparantly I'm missing something here. I've included all code that I currently have at the bottom of this question.

Server output file:

2016-04-06 14:41:00,101 8468 INFO ? openerp: OpenERP version 9.0c
2016-04-06 14:41:00,101 8468 INFO ? openerp: addons paths: ['/home/pieterpaulussen/.local/share/Odoo/addons/9.0', u'/odoo/odoo-server/openerp/addons', u'/odoo/odoo-server/addons']
2016-04-06 14:41:00,101 8468 INFO ? openerp: database: default@default:default
2016-04-06 14:41:00,242 8468 INFO ? openerp.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
2016-04-06 14:41:03,120 8468 INFO ? openerp.addons.bus.models.bus: Bus.loop listen imbus on db postgres
2016-04-06 14:41:03,554 8468 INFO ? openerp.addons.report.models.report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
2016-04-06 14:41:03,746 8468 INFO ? openerp.http: HTTP Configuring static files
2016-04-06 14:41:03,787 8468 INFO testdatabase1 openerp.modules.loading: loading 1 modules...
2016-04-06 14:41:03,810 8468 INFO testdatabase1 openerp.modules.loading: 1 modules loaded in 0.02s, 0 queries
2016-04-06 14:41:03,858 8468 INFO testdatabase1 openerp.modules.loading: loading 53 modules...
2016-04-06 14:41:03,865 8468 INFO testdatabase1 passlib.registry: registered crypt handler 'pbkdf2_sha512': <class 'passlib.handlers.pbkdf2.pbkdf2_sha512'>
2016-04-06 14:41:03,866 8468 INFO testdatabase1 passlib.registry: registered crypt handler 'md5_crypt': <class 'passlib.handlers.md5_crypt.md5_crypt'>
2016-04-06 14:41:04,759 8468 INFO testdatabase1 openerp.modules.module: module academy: creating or updating database tables
2016-04-06 14:41:04,880 8468 INFO testdatabase1 openerp.modules.loading: loading academy/security/ir.model.access.csv
2016-04-06 14:41:04,910 8468 INFO testdatabase1 openerp.modules.loading: loading academy/views/views.xml
2016-04-06 14:41:05,022 8468 INFO testdatabase1 openerp.modules.loading: loading academy/views/templates.xml
2016-04-06 14:41:05,049 8468 INFO testdatabase1 openerp.modules.loading: loading academy/data.xml
2016-04-06 14:41:05,054 8468 ERROR testdatabase1 openerp.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/odoo/odoo-server/openerp/modules/registry.py", line 386, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/odoo-server/openerp/modules/loading.py", line 334, in load_modules
force, status, report, loaded_modules, update_module)
File "/odoo/odoo-server/openerp/modules/loading.py", line 237, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/odoo/odoo-server/openerp/modules/loading.py", line 156, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/odoo/odoo-server/openerp/modules/loading.py", line 98, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/odoo/odoo-server/openerp/tools/convert.py", line 851, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/odoo/odoo-server/openerp/tools/convert.py", line 938, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/odoo/odoo-server/openerp/tools/convert.py", line 801, in parse
self.parse(rec, mode)
File "/odoo/odoo-server/openerp/tools/convert.py", line 804, in parse
self._tags[rec.tag](self.cr, rec, de, mode=mode)
File "/odoo/odoo-server/openerp/tools/convert.py", line 700, in _tag_record
f_val = self.id_get(cr, f_ref)
File "/odoo/odoo-server/openerp/tools/convert.py", line 782, in id_get
res = self.model_id_get(cr, id_str, raise_if_not_found)
File "/odoo/odoo-server/openerp/tools/convert.py", line 793, in model_id_get
raise_if_not_found=raise_if_not_found)
File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/odoo/odoo-server/openerp/addons/base/ir/ir_model.py", line 982, in xmlid_to_res_model_res_id
return self.xmlid_lookup(cr, uid, xmlid)[1:3]
File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in xmlid_lookup
File "/odoo/odoo-server/openerp/tools/cache.py", line 85, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/odoo/odoo-server/openerp/addons/base/ir/ir_model.py", line 972, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % (xmlid))
ParseError: "External ID not found in the system: website_sale.categ_others" while parsing /odoo/odoo-server/addons/academy/data.xml:4, near
<record model="product.public.category" id="category_courses">
<field name="name">Courses</field>
<field name="parent_id" ref="website_sale.categ_others"/>
</record>
2016-04-06 14:41:05,198 8468 INFO testdatabase1 werkzeug: 127.0.0.1 - - [06/Apr/2016 14:41:05] "GET / HTTP/1.1" 500 -
2016-04-06 14:41:05,230 8468 ERROR testdatabase1 werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/odoo/odoo-server/openerp/service/server.py", line 245, in app
return self.app(e, s)
File "/odoo/odoo-server/openerp/service/wsgi_server.py", line 184, in application
return application_unproxied(environ, start_response)
File "/odoo/odoo-server/openerp/service/wsgi_server.py", line 170, in application_unproxied
result = handler(environ, start_response)
File "/odoo/odoo-server/openerp/http.py", line 1488, in __call__
return self.dispatch(environ, start_response)
File "/odoo/odoo-server/openerp/http.py", line 1462, in __call__
return self.app(environ, start_wrapped)
File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 579, in __call__
return self.app(environ, start_response)
File "/odoo/odoo-server/openerp/http.py", line 1637, in dispatch
ir_http = request.registry['ir.http']
File "/odoo/odoo-server/openerp/http.py", line 360, in registry
return openerp.modules.registry.RegistryManager.get(self.db) if self.db else None
File "/odoo/odoo-server/openerp/modules/registry.py", line 355, in get
update_module)
File "/odoo/odoo-server/openerp/modules/registry.py", line 386, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/odoo-server/openerp/modules/loading.py", line 334, in load_modules
force, status, report, loaded_modules, update_module)
File "/odoo/odoo-server/openerp/modules/loading.py", line 237, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/odoo/odoo-server/openerp/modules/loading.py", line 156, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/odoo/odoo-server/openerp/modules/loading.py", line 98, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/odoo/odoo-server/openerp/tools/convert.py", line 851, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/odoo/odoo-server/openerp/tools/convert.py", line 938, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/odoo/odoo-server/openerp/tools/convert.py", line 801, in parse
self.parse(rec, mode)
File "/odoo/odoo-server/openerp/tools/convert.py", line 804, in parse
self._tags[rec.tag](self.cr, rec, de, mode=mode)
File "/odoo/odoo-server/openerp/tools/convert.py", line 700, in _tag_record
f_val = self.id_get(cr, f_ref)
File "/odoo/odoo-server/openerp/tools/convert.py", line 782, in id_get
res = self.model_id_get(cr, id_str, raise_if_not_found)
File "/odoo/odoo-server/openerp/tools/convert.py", line 793, in model_id_get
raise_if_not_found=raise_if_not_found)
File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/odoo/odoo-server/openerp/addons/base/ir/ir_model.py", line 982, in xmlid_to_res_model_res_id
return self.xmlid_lookup(cr, uid, xmlid)[1:3]
File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in xmlid_lookup
File "/odoo/odoo-server/openerp/tools/cache.py", line 85, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/odoo/odoo-server/openerp/addons/base/ir/ir_model.py", line 972, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % (xmlid))
ParseError: "External ID not found in the system: website_sale.categ_others" while parsing /odoo/odoo-server/addons/academy/data.xml:4, near
<record model="product.public.category" id="category_courses">
<field name="name">Courses</field>
<field name="parent_id" ref="website_sale.categ_others"/>
</record>
__openerp__.py:
...
'category': 'Tutorials',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base', 'mail', 'website_sale'],
# always loaded
'data': [
'security/ir.model.access.csv',
'views/views.xml',
'views/templates.xml',
'data.xml',
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
}


views.xml

<openerp>
<data>
<record id="action_academy_teachers" model="ir.actions.act_window">
<field name="name">Academy teachers</field>
<field name="res_model">academy.teachers</field>
</record>
<record id="academy_teacher_form" model="ir.ui.view">
<field name="name">Academy teachers: form</field>
<field name="model">academy.teachers</field>
<field name="arch" type="xml">
<form>
<sheet>
<label for="name"/>
<field name="name"/>
<label for="biography"/>
<field name="biography"/>
<field name="course_ids">
<tree string="Courses" editable="bottom">
<field name="name"/>
</tree>
</field>
</sheet>
</form>
</field>
</record>
<record id="action_academy_courses" model="ir.actions.act_window">
<field name="name">Academy courses</field>
<field name="res_model">academy.courses</field>
</record>
<record id="academy_course_search" model="ir.ui.view">
<field name="name">Academy courses: search</field>
<field name="model">academy.courses</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="teacher_id"/>
</search>
</field>
</record>
<record id="academy_course_list" model="ir.ui.view">
<field name="name">Academy courses: list</field>
<field name="model">academy.courses</field>
<field name="arch" type="xml">
<tree string="Courses">
<field name="name"/>
<field name="teacher_id"/>
</tree>
</field>
</record>
<record id="academy_course_form" model="ir.ui.view">
<field name="name">Academy courses: form</field>
<field name="model">academy.courses</field>
<field name="arch" type="xml">
<form>
<sheet>
<label for="name"/>
<field name="name"/>
<label for="teacher_id"/>
<field name="teacher_id"/>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<menuitem sequence="0" id="menu_academy" name="Academy"/>
<menuitem id="menu_academy_content" parent="menu_academy" name="Academy Content"/>
<menuitem id="menu_academy_content_teachers" parent="menu_academy_content" action="action_academy_teachers"/>
</data>
</openerp>


models.py

# -*- coding: utf-8 -*-
from openerp import models, fields, api
class Teachers(models.Model):
_name = 'academy.teachers'
name = fields.Char()
biography = fields.Html()
course_ids = fields.One2many(
'product.template', 'teacher_id', string="Courses")
class Courses(models.Model):
_inherit = 'product.template'
teacher_id = fields.Many2one('academy.teachers', string="Teacher")


data.xml

<openerp>
<data>
<record model="product.public.category" id="category_courses">
<field name="name">Courses</field>
<field name="parent_id" ref="website_sale.categ_others"/>
</record>
</data>
</openerp>


demo.xml

<openerp>
<data>
<record id="padilla" model="academy.teachers">
<field name="name">Diane Padilla</field>
</record>
<record id="carrol" model="academy.teachers">
<field name="name">Jody Carrol</field>
</record>
<record id="vaughn" model="academy.teachers">
<field name="name">Lester Vaughn</field>
</record>
<record id="course0" model="product.template">
<field name="name">Course 0</field>
<field name="teacher_id" ref="padilla"/>
<field name="public_categ_ids" eval="[(4, ref('academy.category_courses'), False)]"/>
<field name="website_published">True</field>
<field name="list_price" type="float">0</field>
<field name="type">service</field>
</record>
<record id="course1" model="product.template">
<field name="name">Course 1</field>
<field name="teacher_id" ref="padilla"/>
<field name="public_categ_ids" eval="[(4, ref('academy.category_courses'), False)]"/>
<field name="website_published">True</field>
<field name="list_price" type="float">0</field>
<field name="type">service</field>
</record>
<record id="course2" model="product.template">
<field name="name">Course 2</field>
<field name="teacher_id" ref="vaughn"/>
<field name="public_categ_ids" eval="[(4, ref('academy.category_courses'), False)]"/>
<field name="website_published">True</field>
<field name="list_price" type="float">0</field>
<field name="type">service</field>
</record>
</data>
</openerp>


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/6/16, 11:03 AM
Seen: 545 times
Last updated: 4/6/16, 11:32 AM