我有两个模型:Plan
和Employee
class Plan(models.Model):
_name="plan"
subject_id=fields.Many2one("subject")
name=fields.Char('name')
teacher_id=fields.Many2one('hr.employee')
class Employee(models.Model):
_inherit="hr.employee"
subject_ids=fields.Many2many("subject")
class Subject(models.Model):
_name="subject"
name=fields.Char("Subject Name")
因为每个Employee
都有自己的用户,所以我需要创建一个域,该域允许我显示与当前用户对应的Employee
的主题计划。你知道吗
这是我的xml。你知道吗
<record id="action_open_didactic_unit_plan" model="ir.actions.act_window">
<field name="name">Plan</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">plan</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('teacher_id.user_id.id','=',uid)]</field>
目前我只过滤计划分配给教师和当前用户id的id。但我需要显示在所有科目创建的计划分配给教师。你知道吗
我在想这样的事情。你知道吗
('subject_id', 'in', [teacher_list_of_subjects])
目前没有回答
相关问题 更多 >
编程相关推荐