콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3763 화면

Dear All,

      I' a newbie for ODOO. I'm trying to develop my knowledge. Then I make a personal project name "My Recruitment". 

I'v inherited model "hr.applicant" and add new field name "x_place". 

I'd like limit the user to see only the record that user is member of Many2Many name "my.recruitment.place".


I'm create Record Rules with the following 



It's working fine with my test ir.rule

['|',('x_place','in',[1,2,3,4]),('x_place','=',False)]



but I expect the result 


xxx = self.env['my.recruitment.place'].search([('res_users_id','=',user.id)])


['|',('x_place','in',[xxx]),('x_place','=',False)]




class MYRecruitment(models.Model):

_inherit = ['hr.applicant']

    x_place = fields.Many2one('my.recruitment.place', "Place")

class MyRecruitmentPlace(models.Model):

    _name = "my.recruitment.place"

    _description = "Place of Recruitment"

    _sql_constraints = [

        ('name_uniq', 'unique (name)', 'The name of the place of Recruitment must be unique!')

    ]


    name = fields.Char("Place", required=True, translate=True)

    user_ids = fields.Many2many('res.users', string="Owners")

    sequence = fields.Integer("Sequence", default=1, help="Gives the sequence order when displaying a list of place.")

아바타
취소
베스트 답변

Try it bro:
xxx = self.env['my.recruitment.place'].search([('user_ids','=',user.id)])

아바타
취소
작성자

Thank you. But I does not work.