Odoo Help


[Sovled]-How to update table model from another table model ?

Mostafa Mohamed Abdel Monaem
on 3/11/15, 4:33 PM 1,104 views

I have 2 tables

1- fci_assignment_stuff

2- fci_assignment pool 

i need when i change state in first table it should change in the other table too

Here is my code to change the other table  but it does not run  :(

def act_finish(self, cr, uid, ids, context=None):

if context is None:

context = {}

assignment_obj = self.pool.get("fci.assignment.pool")

for ass_data in assignment_obj.browse(cr, uid, ids, context=context):

ass_data.search(cr,uid,('code', '=', self.code)).write(cr, uid, {'state':'f'})

return True

sry @Cyril Gaspard (GEM) but it doesn't work :( it deosn't change the status in th other table i only change this assignment_obj.write(cr, uid, assignment_ids, {'state':'f'}, context=context) because it's the new status

Mostafa Mohamed Abdel Monaem
on 3/11/15, 7:07 PM

i edit it more ... it worked ... thanks :D

Mostafa Mohamed Abdel Monaem
on 3/11/15, 7:09 PM

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--

| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 3/11/15, 6:01 PM

Hi, something like this :

def act_finish(self, cr, uid, ids, context=None):

    context = context or {}

    assignment_obj = self.pool.get('fci.assignment.pool')

    for record in self.browse(cr, uid, ids, context=context):

        if record.code:

            assignment_ids = assignment_obj.search(cr, uid, [('code', '=', record.code)], context=context)

            if assignment_ids:

                assignment_obj.write(cr, uid, assignment_ids, {'state': 'f'}, context=context)

return True


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

2 follower(s)


Asked: 3/11/15, 4:33 PM
Seen: 1104 times
Last updated: 3/16/15, 8:10 AM