Community mailing list archives
Re: Many2one field filter using child_of user loginby
<field name="responsible_id" domain="[('parent_id','=',uid)]"
I have a model with a field for responsible user (
responsible_id). The creator can only choose any user below him. I have modified the
res.usersmodel to have
This is my code:
class ResUser(models.Model): _inherit = "res.users" parent_id = fields.Many2one("res.users") class WorkOrder(models.Model): _name = "mymodule.work.order" name = fields.Char("Work Order Numbers", required=True) duration = fields.Float("Duration (Hours)", required=True) responsible_id = field.Many2one( "res.users", required=True, domain="[('id', 'child_of', user.id)]" # this caused an error when I open the combo box. )
On 09/07/2015 07:24 PM, Togar Hutabarat wrote:<blockquote cite="mid:CAD=nRr7LPfijVjs9_X8j7rBdHK=MrweiGaf2ScRwpsO584rTeg@mail.gmail.com" type="cite">Hi,
Hmm.. Could you please share and explain your code?
On Mon, Sep 7, 2015 at 9:44 AM, vak0160 <firstname.lastname@example.org> wrote:
Sorry for the late reply. I followed your suggestion of having relation to
parent_id, but I still get the same error with this domain:
[('id', '=', user.id)]on my own model.
Is there any other solution? I just want to limit the
res.usersrelation field in my model to
child_ofthe current user login.
On 09/04/2015 04:15 PM, Togar Hutabarat wrote:<blockquote cite="mid:CAD=nRr5ba_3pk_OPbOOGZF4Em1vF20FFFhmoRJ8Amyt-gv4jFg@mail.gmail.com" type="cite">
You need to add one additional many2one field on res.users, referenced to res.users itself, and the field name must be 'parent_id'. I guess that is the requirement of using child_of things.
On Fri, Sep 4, 2015 at 2:08 PM, vak0160 <email@example.com> wrote:
I have a
referenced to model
and I want this field filtered using
I already tried with
[('id', 'child_of',but it gives me an error:
Error: NameError: name 'user' is not defined.
Is there any way to accomplish this?
-- Regards, Andre
-- Regards, Andre