Odoo Help


grab id from res_partner

on 12/13/13, 5:46 AM 951 views

hi guys, iam stuck for a while, i could use somebodys help. What i want to do is grab a id from a parent and use it to store in another field. ( the res_id ) see below :)

class document(osv.osv):
_name = 'ir.attachment'
_inherit= {
_columns = {
    'petmobiel_document_id': fields.many2one('a.petmobiel', 'document'),
_defaults = {
'description': lambda  *a: "0",
'res_id'   <================================ i want to use the partner_id from res_partner there

Alltough i have no clue how to get it there. below my other tables.

class klanten(osv.osv):
_name = 'res.partner'
_columns = {
    'mobiel_abbo': fields.one2many('a.petmobiel', 'petmobiel_klant_id', string="Telefoon abonnementen", select=True),


class petmobiel(osv.osv):
_name = 'a.petmobiel'
_columns = {
    'name': fields.char('telefoonnummer', size=10, required=True),
    'petmobiel_klant_id': fields.many2one('res.partner', 'Klant', select=True),
    'petmobiel_verlengduur': fields.selection((('1','1 jaar'),('2','2 jaar'),('3','3 jaar')),'Verleng duur'),   
    'petmobiel_contractduur': fields.selection((('1','1 jaar'),('2','2 jaar'),('3','3 jaar')),'Contract duur'), 
    'petmobiel_document': fields.one2many('ir.attachment', 'petmobiel_document_id', string="Mobiel", select=True),

} _defaults = { 'petmobiel_contractduur': lambda *a: "0", } petmobiel()

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

1 follower(s)


Asked: 12/13/13, 5:46 AM
Seen: 951 times
Last updated: 3/16/15, 8:10 AM