添加功能
This commit is contained in:
@@ -33,6 +33,17 @@ class YuthonHrEmployee(models.Model):
|
||||
compress_image = fields.Binary(string="压缩头像", attachment=True)
|
||||
wecom_userid = fields.Char(string="成员UserID", related="user_id.oauth_uid")
|
||||
company_ids = fields.Many2many('res.company', related="user_id.company_ids")
|
||||
role_allowed_company_ids = fields.Many2many('res.company', compute='_compute_role_allowed_company_ids')
|
||||
|
||||
@api.depends('company_ids')
|
||||
def _compute_role_allowed_company_ids(self):
|
||||
thtz = self.env['res.company'].search([('name', '=', '天河投资集团')], limit=1)
|
||||
for rec in self:
|
||||
companies = rec.company_ids
|
||||
if thtz and thtz not in companies:
|
||||
companies |= thtz
|
||||
rec.role_allowed_company_ids = companies
|
||||
|
||||
number = fields.Char(string="序号", store=True)
|
||||
is_soldiers = fields.Boolean(string="是否为退伍军人")
|
||||
user_number = fields.Char(string="员工编号", default=lambda self: self.env['ir.sequence'].next_by_code('employee_code'))
|
||||
|
||||
@@ -139,10 +139,11 @@
|
||||
<xpath expr="//field[@name='work_email']" position="after">
|
||||
<field name="user_state"/>
|
||||
<field name="company_ids" invisible="1"/>
|
||||
<field name="user_role_id" domain="[('company_id', 'in', company_ids), ('is_main', '=', True)]"
|
||||
<field name="role_allowed_company_ids" invisible="1"/>
|
||||
<field name="user_role_id" domain="[('company_id', 'in', role_allowed_company_ids), ('is_main', '=', True)]"
|
||||
options="{'no_open': True, 'no_create': True}"/>
|
||||
<field name="user_role_ids" widget="many2many_tags"
|
||||
domain="[('company_id', 'in', company_ids), ('is_main', '!=', True)]" options="{'no_open': True, 'no_create': True}"/>
|
||||
domain="[('company_id', 'in', role_allowed_company_ids), ('is_main', '!=', True)]" options="{'no_open': True, 'no_create': True}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='department_id']" position="attributes">
|
||||
<attribute name="widget">ztree_select</attribute>
|
||||
|
||||
Reference in New Issue
Block a user