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

Problem with field.many2one: when i try to create new formation in the field theme there is not the titre of theme slection b

By
Imen
on 4/16/14, 9:27 AM 1,084 views

this my file formation.py import openerp from openerp import netsvc, tools, pooler from openerp.osv import fields, osv from openerp.tools.translate import _ import time class formation(osv.osv): _name = 'formation'

_columns = {


       'sujet': fields.char('sujet', size=128, required=True, translate=True),
       'theme_id': fields.many2one('formation.theme', "theme" , required=True, translate=True),
       'langage': fields.char( 'langage',size=8, required=True, translate=True),
      'os': fields.many2one( 'formation.os' ,'systeme exploitation', required=True, translate=True),
      'date': fields.date('date', size=128, required=True, translate=True),
      'nbpersonnes': fields.integer('nombre personnes', required=True, translate=True),
     'duree': fields.integer('duree par jours', required=True, translate=True),
     'formateur': fields.many2one('hr.employee', "Formateur", required=True),


}

formation()

and this is my file theme.py

import openerp
from openerp import netsvc, tools, pooler
from openerp.osv import fields, osv
from openerp.tools.translate import _
import time
class theme(osv.osv):   
    _name = 'formation.theme'
    _description = 'theme'
    _columns = {                        
       'titre': fields.char('titre', size=128, required=True, select=True),
       'description':fields.char( 'description',size=8, required=True, translate=True),      
}

theme()

0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 4/16/14, 9:48 AM

Hi

import openerp from openerp import netsvc, tools, 
from openerp import netsvc, tools, pooler
from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.translate import _
import time

class formation(osv.osv): 
_name = 'formation'

_columns = {


    'sujet': fields.char('sujet', size=128, required=True, translate=True),
    'theme_id': fields.many2one('formation.theme', "theme" , required=True, translate=True),
    'langage': fields.char( 'langage',size=8, required=True, translate=True),
    'os': fields.many2one( 'formation.os' ,'systeme exploitation', required=True, translate=True),
    'date': fields.date('date', size=128, required=True, translate=True),
    'nbpersonnes': fields.integer('nombre personnes', required=True, translate=True),
    'duree': fields.integer('duree par jours', required=True, translate=True),
    'formateur': fields.many2one('hr.employee', "Formateur", required=True),


}

formation()



from openerp import netsvc, tools, pooler
from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.translate import _
import time

class theme(osv.osv):   
    _name = 'formation.theme'
    _description = 'theme'
    _columns = {

       'titre': fields.char('titre', size=128, required=True, select=True),
       'description':fields.char( 'description',size=8, required=True, translate=True),      
}

theme()

when i Add _ rec_name = "titre" in your code, my problem is solved

Imen
on 4/18/14, 12:09 PM

ok good then accept my answer as correct

Jagdish Panchal
on 4/19/14, 2:17 AM
0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 4/16/14, 9:45 AM

Add _ rec_name = "titre" in your code.

Example

import openerp
class theme(osv.osv):   
   _name = 'formation.theme'
   _rec_name = "titre"
    _description = 'theme'
    _columns = {
       'titre': fields.char('titre', size=128, required=True, select=True),
       'description':fields.char( 'description',size=8, required=True, translate=True),      
}

yes , problem it solve thank you

Imen
on 4/16/14, 10:00 AM

please mark the answer as correct if it worked for you. Thanks

Prakash
on 4/18/14, 5:58 AM

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

0 follower(s)

Stats

Asked: 4/16/14, 9:27 AM
Seen: 1084 times
Last updated: 3/16/15, 8:10 AM