Hello!

I am here again, looking for help.
I have advanced a lot in the project I am working, but I have a problem: 

Sometimes I can access "child" records and modify them, and sometimes I can 
only read them. I log in as a user that has the permissions to read and 
write the Model type (I can do it from within the view of that model) but I 
can't modify the records if I open them as children of a O2M, M2O, etc... 
field.

The most intriguing thing is that sometimes, with some users, and some 
particular fields I can do it.
I think that the ones that I can't modify may be the ones that are not 
"pure" X2X, but Function fields that use a X2X field.

Is there any extra permissions or property that I should set in a X2X field 
to be allowed to do that? (I mean modifying the children by clicking on 
them in the list)
May the problem be related to the use of Function fields? In that case, is 
there any way to solve it?

I send below some of my code. I tries to show the profile of a 
psychologist, only if his user name is the same as the one of the user 
currently logged in. I seems to work but I would like the psychologist to 
be able to modify his profile, and even some child-child records 
(psychologists profiles have a list of their patients for example).


    perfiles = 
fields.Function(fields.One2Many('cefiro.psicologo',None,'Perfiles'),'get_perfiles')


    def get_perfiles(self,ids,name):
        res = {}

        user_obj = Pool().get('res.user')
        usrid = Transaction().user
        usuario = user_obj.browse(usrid)

        psi_obj = Pool().get('cefiro.psicologo')
        psiIDsTot = psi_obj.search([])

        for elem in self.browse(ids):
            sol=[]
            for psi in psi_obj.browse(psiIDsTot):
                if (psi.login==usuario.login):
                    sol.append(psi.id)
            res[elem.id]=sol
        return res


Thank you very much.

Regards,
Miguel Tasende

-- 
-- 
[email protected] mailing list



Reply via email to