添加功能
This commit is contained in:
@@ -91,6 +91,24 @@ class HrContract(models.Model):
|
||||
)
|
||||
change_ids = fields.One2many('hr.contract.change.line', 'contract_id', string="异动信息")
|
||||
|
||||
@api.constrains('party_id')
|
||||
def _constrains_party_company(self):
|
||||
for rec in self:
|
||||
company = False
|
||||
if rec.party_id and rec.party_id.work_address:
|
||||
company = self.env['res.company'].search(
|
||||
[('name', 'ilike', rec.party_id.work_address)],
|
||||
limit=1
|
||||
)
|
||||
rec.company_id = company
|
||||
rec.employee_id.company_id = company
|
||||
if rec.employee_id and rec.employee_id.user_id and company:
|
||||
user = rec.employee_id.user_id
|
||||
user.write({
|
||||
'company_id': company.id,
|
||||
'company_ids': [(4, company.id)]
|
||||
})
|
||||
|
||||
@api.constrains('change_ids')
|
||||
def _onchange_change_ids(self):
|
||||
if self.change_ids:
|
||||
|
||||
@@ -16,6 +16,7 @@ class YuthonPartySetting(models.Model):
|
||||
address = fields.Text(string='通讯地址')
|
||||
contact = fields.Char(string='联系人')
|
||||
phone = fields.Char(string='电话')
|
||||
work_address = fields.Char(string='办公所在地')
|
||||
level = fields.Selection([('one', '一级'), ('two', '二级'), ('three', '三级')], string='层级')
|
||||
effective_date = fields.Date(string="生效日期", default=fields.Date.today)
|
||||
expiration_date = fields.Date(string="失效日期")
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<field name="address"/>
|
||||
<field name="contact"/>
|
||||
<field name="phone"/>
|
||||
<field name="work_address"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="level"/>
|
||||
<field name="effective_date"/>
|
||||
|
||||
Reference in New Issue
Block a user