添加功能
This commit is contained in:
@@ -49,8 +49,18 @@ class HrContract(models.Model):
|
||||
contact = fields.Char(related='party_id.contact', string='联系人')
|
||||
phone = fields.Char(related='party_id.phone', string='电话')
|
||||
documents_ids = fields.Many2many('ir.attachment', string="合同附件")
|
||||
current_contract = fields.Boolean(string="当前合同", default=True, compute='_compute_current_contract', store=True)
|
||||
is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company', search='_search_part_of_company')
|
||||
|
||||
@api.depends('date_start', 'date_end')
|
||||
def _compute_current_contract(self):
|
||||
today = date.today()
|
||||
for contract in self:
|
||||
start_valid = contract.date_start and contract.date_start <= today
|
||||
end_valid = not contract.date_end or contract.date_end >= today
|
||||
contract.current_contract = start_valid and end_valid
|
||||
|
||||
|
||||
@api.onchange('date_start')
|
||||
def _onchange_date_end(self):
|
||||
for record in self:
|
||||
|
||||
@@ -11,6 +11,15 @@
|
||||
<button name="pub_leaving_employee" string="离职" type="object" class="btn btn-primary"/>
|
||||
</header>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='employee_id']" position="attributes">
|
||||
<attribute name="widget">false</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='company_id']" position="attributes">
|
||||
<attribute name="column_invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='resource_calendar_id']" position="attributes">
|
||||
<attribute name="column_invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='date_end']" position="after">
|
||||
<field name="date_of_entry"/>
|
||||
</xpath>
|
||||
@@ -42,6 +51,9 @@
|
||||
<xpath expr="//page[@name='other']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='employee_id']" position="attributes">
|
||||
<attribute name="widget">false</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='contract_type_id']" position="after">
|
||||
<field name="termination_date"/>
|
||||
<field name="reason_suspension" required="termination_date" invisible="not termination_date"/>
|
||||
@@ -92,7 +104,19 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_contract_search_inherit" model="ir.ui.view">
|
||||
<field name="name">hr.contract.search.inherit</field>
|
||||
<field name="model">hr.contract</field>
|
||||
<field name="inherit_id" ref="hr_contract.hr_contract_view_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//filter[@name='running']" position="after">
|
||||
<filter name="current_contract" string="当前合同" domain="[('current_contract', '=', True)]"/>
|
||||
</xpath>
|
||||
<xpath expr="//filter[@name='group_by_employee']" position="after">
|
||||
<filter name="group_salary_group_id" string="工资单分组" context="{'group_by':'salary_group_id'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="all_data_write_user_contract" model="ir.actions.server">
|
||||
<field name="name">批量导入合同</field>
|
||||
<field name="model_id" ref="hr_contract.model_hr_contract"/>
|
||||
|
||||
@@ -13,9 +13,11 @@ class YuthonServiceApproval(models.Model):
|
||||
service_type = fields.Selection([('done', '在职证明'), ('leaving', '离职证明'), ('income', '收入证明')], string="服务类型")
|
||||
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
|
||||
documents_ids = fields.Many2many('ir.attachment', string="附件")
|
||||
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
|
||||
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门", store=True)
|
||||
employee_id = fields.Many2one('hr.employee', string="员工姓名")
|
||||
company_id = fields.Many2one(related="users_id.employee_id.company_id", string="公司", store=True)
|
||||
tenant_user_card = fields.Many2one('ir.attachment', string="身份证")
|
||||
|
||||
onboarding_time = fields.Date(related='employee_id.open_start_time', string="入职时间")
|
||||
job_id = fields.Many2one(related='employee_id.job_id', string="岗位")
|
||||
reason_issuance = fields.Char(string="开证原因")
|
||||
|
||||
@@ -55,10 +55,10 @@ class YuthonProperty(models.Model):
|
||||
rental_unit_price = fields.Float(string="评估单价")
|
||||
title_number = fields.Char(string="产权编号")
|
||||
suite_area = fields.Float(string="套内面积", digits=(16, 4))
|
||||
purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
|
||||
purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型", compute="_compute_information_fields", store=True)
|
||||
admin_id = fields.Many2one('res.users', string="片区管理员", compute="_compute_information_fields", store=True)
|
||||
lessee_id = fields.Many2one('property.tenant.information', string='承租方')
|
||||
title_address = fields.Many2one('yuthon.property.message', string="产权地址")
|
||||
title_address = fields.Many2one('yuthon.property.message', string="产权地址", compute="_compute_title_information_fields", store=True)
|
||||
company_id = fields.Many2one('yuthon.property.company', string="公司", compute="_compute_information_fields", store=True)
|
||||
rental_address = fields.Text(string="出租地址")
|
||||
tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型', compute="_compute_information_fields", store=True)
|
||||
@@ -129,12 +129,14 @@ class YuthonProperty(models.Model):
|
||||
|
||||
@api.depends('title_information_ids.start_time', 'title_information_ids.owner_id',
|
||||
'title_information_ids.title_certificate', 'title_information_ids.registered_id',
|
||||
'title_information_ids.property_message_id',
|
||||
'title_information_ids.equity_area')
|
||||
def _compute_title_information_fields(self):
|
||||
for rec in self:
|
||||
if rec.title_information_ids:
|
||||
latest_title = rec.title_information_ids.sorted('start_time', reverse=True)[0]
|
||||
rec.update({
|
||||
'title_address': latest_title.property_message_id,
|
||||
'owner_id': latest_title.owner_id,
|
||||
'title_deed': latest_title.title_certificate,
|
||||
'registered_id': latest_title.registered_id,
|
||||
@@ -144,12 +146,14 @@ class YuthonProperty(models.Model):
|
||||
@api.depends('manage_information_ids.start_time', 'manage_information_ids.precinct_id',
|
||||
'manage_information_ids.tenure_type', 'manage_information_ids.management_area',
|
||||
'manage_information_ids.rent_area', 'manage_information_ids.admin_id',
|
||||
'manage_information_ids.purpose_id',
|
||||
'manage_information_ids.company_id')
|
||||
def _compute_information_fields(self):
|
||||
for rec in self:
|
||||
if rec.manage_information_ids:
|
||||
latest_info = rec.manage_information_ids.sorted('start_time', reverse=True)[0]
|
||||
rec.update({
|
||||
'purpose_id': latest_info.purpose_id,
|
||||
'precinct_id': latest_info.precinct_id,
|
||||
'tenure_type': latest_info.tenure_type,
|
||||
'management_area': latest_info.management_area,
|
||||
@@ -358,16 +362,19 @@ class YuthonProperty(models.Model):
|
||||
|
||||
# 拆分
|
||||
def put_split_approval(self):
|
||||
form_id = self.env.ref('yuthon_property_approval.view_property_split_approval_form').id
|
||||
return {
|
||||
'name': '拆分物业审批',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'property.split.approval',
|
||||
'type': 'ir.actions.act_window',
|
||||
'views': [(form_id, 'form')],
|
||||
'context': {
|
||||
'default_property_id': self.id
|
||||
}}
|
||||
property_ids = self.env["yuthon.property"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for record in property_ids:
|
||||
form_id = self.env.ref('yuthon_property_approval.view_property_split_approval_form').id
|
||||
return {
|
||||
'name': '拆分物业审批',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'property.split.approval',
|
||||
'type': 'ir.actions.act_window',
|
||||
'views': [(form_id, 'form')],
|
||||
'context': {
|
||||
'default_property_id': record.id
|
||||
}}
|
||||
# 合并
|
||||
def put_merge_approval(self):
|
||||
property_ids = self.env["yuthon.property"].browse(
|
||||
|
||||
@@ -108,7 +108,6 @@ class PropertySplitApproval(models.Model):
|
||||
if main_property.manage_information_ids:
|
||||
manage_vals = [
|
||||
(0, 0, {
|
||||
# 核心:设置拆分后的管理面积和可租面积
|
||||
'management_area': property_split.split_building_area,
|
||||
'rent_area': property_split.split_rent_area,
|
||||
'purpose_id': line.purpose_id.id,
|
||||
|
||||
Reference in New Issue
Block a user