Odoo Help


updating object when adding other one

on 9/14/13, 9:44 AM 1,485 views

I have 2 classes :

class dossier_attribution(osv.osv):
_name = 'dossier_attribution'
_columns = {
'numedoss': fields.char('Dossier',size=32),
'dateattr': fields.date('Date d\'attribution'),
'datedesi': fields.date('Date de désistement'),
'etatdoss': fields.char('Etat du dossier'),
'prixcess': fields.char('Prix de cession'),
'numeprod': fields.many2one('produit','Unité'),

class produit(osv.osv):
_name = 'produit'
_columns = {
'numeprod': fields.char('ID Produit',size=32),
'supeprod': fields.char('Superficie',size=32),
'prixprod': fields.char('Prix de Vente',size=32),
'numeproj': fields.many2one('projet','Projet'),
'codetype': fields.many2one('typeproduit','Type'),
'etatprod': fields.selection((('L','LIBRE'),('A','AFFECTE'),('V','LIVRE')),'Etat'),


The 2 classe are related with one2many relation. I want to change automatically the value of "etatprod" field in produit class when new dossier_attribution is added or its "etatdoss" field value is changed

some code example will help me

On 9/16/13, 3:47 PM

i add this onchange function to dossier_attribution class

def onchange_etatdoss(self, cr, uid, ids, etatdoss,context=None):
        if etatdoss == 'EC':
        self.pool.get('produit').write(cr, uid, produit,{'etatprod': 'A'},context=context)

but i get this error

Server Traceback (most recent call last): File "C:\Program Files\OpenERP 7.0-20130826-231052\Server\server\openerp\addons\web\session.py", line 89, in send File "C:\Program Files\OpenERP 7.0-20130826-231052\Server\server.\openerp\netsvc.py", line 292, in dispatch_rpc File "C:\Program Files\OpenERP 7.0-20130826-231052\Server\server.\openerp\service\web_services.py", line 626, in dispatch File "C:\Program Files\OpenERP 7.0-20130826-231052\Server\server.\openerp\osv\osv.py", line 188, in execute_kw File "C:\Program Files\OpenERP 7.0-20130826-231052\Server\server.\openerp\osv\osv.py", line 131, in wrapper File "C:\Program Files\OpenERP 7.0-20130826-231052\Server\server.\openerp\osv\osv.py", line 197, in execute File "C:\Program Files\OpenERP 7.0-20130826-231052\Server\server.\openerp\osv\osv.py", line 185, in execute_cr File "C:\Program Files\OpenERP 7.0-20130826-231052\Server\server\openerp\addons\Commercial\Commercial.py", line 135, in onchange_etatdoss File "C:\Program Files\OpenERP 7.0-20130826-231052\Server\server.\openerp\osv\orm.py", line 4150, in write File "C:\Program Files\OpenERP 7.0-20130826-231052\Server\server.\openerp\sql_db.py", line 258, in split_for_in_conditions TypeError: 'MetaModel' object is not iterable

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: 9/14/13, 9:44 AM
Seen: 1485 times
Last updated: 3/16/15, 8:10 AM