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= {
'ir.attachment',
}
_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'
_inherit='res.partner'
_columns = {
'mobiel_abbo': fields.one2many('a.petmobiel', 'petmobiel_klant_id', string="Telefoon abonnementen", select=True),
}
klanten()
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()