Odoo Help


3 Answers
7‏/5‏/2015 6:05 م


tried right now. didn't go well. 

I've substituted on point_of_sale.py (one of the first lines) the string

from openerp import tools 

with the new

from openerp import models, fields, api, exceptions, tools 

Then I've added the new inherit at the very end

class pos_order_line(models.Model):
_inherit = 'pos.order.line'
pos_categ = fields.Many2one(related='product_id.pos_categ_id', string="POS Category")

Sadly, I've got the following errors:

2015-05-07 22:02:21,150 2150 ERROR Divina_DB1 werkzeug: Error on request:
Traceback (most recent call last):
File "/home/effe/.local/lib/python2.7/site-packages/werkzeug/serving.py", line 177, in run_wsgi
File "/home/effe/.local/lib/python2.7/site-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/home/effe/odoo/openerp/service/server.py", line 281, in app
return self.app(e, s)
File "/home/effe/odoo/openerp/service/wsgi_server.py", line 216, in application
return application_unproxied(environ, start_response)
File "/home/effe/odoo/openerp/service/wsgi_server.py", line 202, in application_unproxied
result = handler(environ, start_response)
File "/home/effe/odoo/openerp/http.py", line 1280, in __call__
return self.dispatch(environ, start_response)
File "/home/effe/odoo/openerp/http.py", line 1412, in dispatch
ir_http = request.registry['ir.http']
File "/home/effe/odoo/openerp/http.py", line 339, in registry
return openerp.modules.registry.RegistryManager.get(self.db) if self.db else None
File "/home/effe/odoo/openerp/modules/registry.py", line 353, in get
File "/home/effe/odoo/openerp/modules/registry.py", line 384, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/effe/odoo/openerp/modules/loading.py", line 351, in load_modules
force, status, report, loaded_modules, update_module)
File "/home/effe/odoo/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 "/home/effe/odoo/openerp/modules/loading.py", line 143, in load_module_graph
File "/home/effe/odoo/openerp/modules/module.py", line 315, in load_openerp_module
__import__('openerp.addons.' + module_name)
File "/home/effe/odoo/openerp/modules/module.py", line 80, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/home/effe/odoo/addons/point_of_sale/__init__.py", line 24, in <module>
import point_of_sale
File "/home/effe/odoo/addons/point_of_sale/point_of_sale.py", line 1467
pos_categ = fields.Many2one(related='product_id.pos_categ_id', string="POS Category")
IndentationError: unexpected indent

Back to square one... 


class pos_order_line (osv.Model):
_inherit = 'pos.order.line'
    _columns = {
        'product_categ_name': fields.related('product_id', 'categ_id', 'name', type='char', string='Product Category', store=True, readonly=True),

Akhil P Sivan
7‏/5‏/2015 10:32 م

Hi Federico, from the error you can see that, the problem is with indentation on that line of defining the field "pos_categ". Just correct the indentation and try. Python is strict about indentation.

8‏/5‏/2015 8:24 ص

Done, but even with this correction the server is not starting: 2015-05-08 12:22:22,414 2652 INFO Divina_DB1 openerp.modules.loading: loading 72 modules... 2015-05-08 12:22:22,570 2652 CRITICAL Divina_DB1 openerp.modules.module: Couldn't load module point_of_sale 2015-05-08 12:22:22,570 2652 CRITICAL Divina_DB1 openerp.modules.module: 'module' object has no attribute 'Many2one'

8‏/5‏/2015 1:23 م

More details: File "/home/effe/odoo/addons/point_of_sale/point_of_sale.py", line 1484, in class pos_order_line(models.Model): File "/home/effe/odoo/addons/point_of_sale/point_of_sale.py", line 1487, in pos_order_line pos_categ = fields.Many2one(related='product_id.pos_categ_id', string="POS Category") AttributeError: 'module' object has no attribute 'Many2one'


Akhil P Sivan

--Akhil P Sivan--

| 6 4 9
Kochi, الهند
--Akhil P Sivan--

Odoo Developer

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
7‏/5‏/2015 12:09 ص

Hi Federico,

Try like this using the new api, since you are working in v8:

from openerp import models, fields, api, exceptions, tools 
class pos_order_line(models.Model):
    _inherit = 'pos.order.line'
    pos_categ = fields.Many2one(related='product_id.pos_categ_id', string="POS Category")

1 Comment
7‏/5‏/2015 1:02 م

Interesting, I don't know well how the new API works. I'm building a new server right now then I'll install a brand new odoo for testing and I'll test your solution. Thanks!

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform 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.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now