Odoo Help


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.


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

Temmy Steveo
on 3/11/15, 4:33 PM 540 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

Temmy Steveo
on 3/11/15, 7:07 PM

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

Temmy Steveo
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


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

2 follower(s)


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