Odoo Help


Store char in field ?

Nanda Kanoko
on 7/10/13, 7:57 AM 1,444 views

Please tell me how to store char in a field so i can relate it to other field in other model but same module

My py :

from osv import fields, osv
import time

class notebook_project(osv.osv):
    _name = "notebook.project"
    _description = "Notebook Project ID"
    _columns = {
        'project_name' : fields.many2one('project.project', 'Project Name'),
        'project_name_id' : fields.char('Project ID', size=32, required=True, store=True),


class notebook_member(osv.osv):
    _name = "notebook.member"
    _description = "Notebook Member of Project"
    _columns = {
        'project_member' : fields.many2one('hr.employee', 'Member Name',required=True, store=True),
        'project_id' : fields.related('project_name_id', 'project_id', type='many2one', relation='notebook.project', string='Project ID', store=True, readonly=True',),


I need the value of project ID ( char ) to be stored so I can call it on other model ( in notebook.member , from notebook.project ) . Thanks in advance :)

Alessandro Pillan
On 7/12/13, 6:27 AM

You need to set the attribute "store" only on functional fields and only if you need to search on them. Fields like char, many2x are already stored. At the moment I can't see any relation between notebook_project and notebook_member so you can't get the project_name_id using a related field.

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

Question tools

0 follower(s)


Asked: 7/10/13, 7:57 AM
Seen: 1444 times
Last updated: 3/16/15, 8:10 AM