Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I had a module which I was creating in the v7 API. However, now that the v8 API has been released I would like to migrate it to this.
I'm having trouble accessing a fields.One2many(related=...) column I've got however.
I've looked in the accounting_invoice module for an example, and it seems that I'm doing the same as shown there.
step_ids = fields.One2many(related='template_id.step_ids', store=True, auto_join=True)
And this shows up in the Database Stucture->Models view, however if I try to reference this in a view then it complains. Throwing up a error when upgrading the module (or installing) saying:
'NoneType' object has no attribute '_fields'" while passing .... (name of my view.xml)
Is this possibly a bug with the new v8 API? or am I doing something else wrong? The template_id is a Many2one (in this class), and the step_ids One2many field does exist in the template class. (it's been working before in v7 API before I changed the fields.one2many/relation etc items over to fields.One2many and such)
Hi Bevan, I don't think the definition is completely wrong. Please keep it like this:
step_ids = fields.One2many(related='template_id.step_ids', string = "Steps")
Also make sure you have included the import fields correctly for new api. I mean it should be like this:
from openerp import models, fields, api, exceptions, tools
The fields import should not be there from osv, I mean:
from openerp.osv import osv, fields
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 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 7/29/14, 5:13 PM|
|Seen: 3578 times|
|Last updated: 5/7/15, 10:49 PM|