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

I have two models like

class BsService(models.Model):
    _name = 'bs.service'
    ....
    users = fields.Many2one('res.users', string="Users", readonly=True)
    ....
    ....
class BsSaleOrder(models.Model):
    _name = 'bs.sale.order'
    
    service_id = fields.Many2one('bs.service', string='Service', required=True)
    service_user = fields.Many2one('res.users', string='Service User')
    ...
    ...

Now, In BsSaleOrder View, I want to show only those users are related to a selected service. If user not found in the selected service,  all res.users would be shown.

아바타
취소

You said: "You want to show show only those users are related to a selected service."

In your code , you use:

users = fields.Many2one('res.users', string="Users", readonly=True)

That's mean only one user will be linked to each service.

In BsSaleOrder, you can use domain to filter the users depend on users field in BsService module.

베스트 답변

I cannot understand your question, but i think you need dependent drop down or Many2one. I mean on the change of one field you need the value of another fields that are dependent on first field.

Example:

how to create a dependent drop down (many2one) fields in Odoo. For example I have two many2one fields (campus_id and department_id), and we want to change the department on the basis of campus field.

1 @api.onchange('campus_id')
2 def _campus_onchange(self):
3     res = {}
4     res['domain']={'department_id':[('campus_id', '=', self.campus_id.id)]}
5     return res

Hope this will helpful in your case, to get more detail read: http://learnopenerp.blogspot.com/2016/10/onchange-many2one-filed-in-odoo.html

아바타
취소
관련 게시물 답글 화면 활동
1
11월 18
3160
2
9월 18
7490
2
2월 24
15920
1
12월 22
5222
2
12월 22
14807