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

How to add character in one2many field?

By
Rokon Uddin
on 8/6/14, 8:00 AM 277 views

class archive_storage_type(osv.Model):

    _name='archive.storage.type'

    _columns={

        'name': fields.integer('Storage Type'),
        
    }

 

class news_footage(osv.Model):

    _name='news.footage'

    _columns={
       
        'server_id': fields.one2many('footage.server.id','server_id', 'Server ID'),
       }

 

When I put integer value it works fine but I want server_id to be char field. How to do that?

0

Ludo - Neobis

--Ludo - Neobis--
2387
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 8/6/14, 9:33 AM

The server_id is always going to be the link to another record (in this case many records), so you should keep the field like that. 

However, I think what you need is a related field. This can be the name of the archieve storage type, based on the field as it is filled in. So for example:

'related_server_name('server_id', 'name', type='char')

"server_id" in this case is the field that you already made. "name" is the field on the object you are referring to and "type" indicates that it should be shown as a character field in this case. 

You should never have to worry about the input for relational fields yourself. The ORM does that for you.

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: 8/6/14, 8:00 AM
Seen: 277 times
Last updated: 3/16/15, 8:10 AM