Merge branch 'dev' of https://gitee.com/jinan-pengyusen-data/gzth into dev
This commit is contained in:
@@ -148,6 +148,12 @@ class HrLeave(models.Model):
|
||||
('22', '22:00'), ('22.5', '22:30'),
|
||||
('23', '23:00'), ('23.5', '23:30')], string='结束时间')
|
||||
|
||||
def update_state(self):
|
||||
leave_ids = self.env["hr.leave"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for leave in leave_ids:
|
||||
leave.state = 'draft'
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
allocation = super(HrLeave, self).create(vals)
|
||||
@@ -201,7 +207,7 @@ class HrLeave(models.Model):
|
||||
self.env['vacation.over.line'].create({
|
||||
'vacation_id': reports_id.id,
|
||||
'employee_id': employee.id,
|
||||
'update_type': 'add',
|
||||
'update_type': 'reduce',
|
||||
'workday': allocation.number_of_days * 8,
|
||||
'legal_day': 0,
|
||||
'public_holidays': 0,
|
||||
|
||||
@@ -106,11 +106,11 @@ class HrLeaveAllocation(models.Model):
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
allocation = super(HrLeaveAllocation, self).create(vals)
|
||||
employee = allocation.employee_id
|
||||
hours = allocation.number_of_hours_display
|
||||
if allocation.holiday_status_id.name == '年假' and allocation.state == 'validate':
|
||||
employee = allocation.employee_id
|
||||
days = allocation.number_of_hours_display
|
||||
employee.write({
|
||||
'quota_issued': employee.quota_issued + days
|
||||
'quota_issued': employee.quota_issued + hours
|
||||
})
|
||||
reports_id = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', employee.id)
|
||||
@@ -120,10 +120,24 @@ class HrLeaveAllocation(models.Model):
|
||||
'vacation_id': reports_id.id,
|
||||
'update_type': 'add',
|
||||
'update_date': fields.Datetime.now(),
|
||||
'update_lines': days,
|
||||
'update_lines': hours,
|
||||
'allocation_type': 'allocation',
|
||||
'text': allocation.name
|
||||
})
|
||||
elif allocation.holiday_status_id.name == '补休':
|
||||
reports_id = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', employee.id)
|
||||
], limit=1)
|
||||
self.env['vacation.over.line'].create({
|
||||
'vacation_id': reports_id.id,
|
||||
'update_type': 'add',
|
||||
'update_date': fields.Datetime.now(),
|
||||
'workday': hours,
|
||||
'legal_day': 0,
|
||||
'public_holidays': 0,
|
||||
'meal_number': 0,
|
||||
'text': allocation.name
|
||||
})
|
||||
return allocation
|
||||
|
||||
def unlink(self):
|
||||
@@ -132,20 +146,33 @@ class HrLeaveAllocation(models.Model):
|
||||
# 检查是否有需要同步的员工记录
|
||||
if record.employee_id and record.holiday_status_id.name == '年假':
|
||||
employee = record.employee_id
|
||||
days = record.number_of_hours_display
|
||||
hours = record.number_of_hours_display
|
||||
lines_to_delete = self.env['vacation.leave.line'].search([
|
||||
('vacation_id.employee_id', '=', employee.id),
|
||||
('update_type', '=', 'add'),
|
||||
('update_lines', '=', days),
|
||||
('update_lines', '=', hours),
|
||||
('allocation_type', '=', 'allocation'),
|
||||
('text', '=', record.name)
|
||||
])
|
||||
if lines_to_delete:
|
||||
lines_to_delete.is_void = True
|
||||
employee.write({
|
||||
'quota_issued': employee.quota_issued - days
|
||||
'quota_issued': employee.quota_issued - hours
|
||||
})
|
||||
return super(HrLeaveAllocation, self).unlink()
|
||||
elif record.employee_id and record.holiday_status_id.name == '补休':
|
||||
employee = record.employee_id
|
||||
hours = record.number_of_hours_display
|
||||
lines_to_delete = self.env['vacation.over.line'].search([
|
||||
('vacation_id.employee_id', '=', employee.id),
|
||||
('update_type', '=', 'add'),
|
||||
('workday', '=', hours),
|
||||
('text', '=', record.name)
|
||||
])
|
||||
if lines_to_delete:
|
||||
lines_to_delete.is_void = True
|
||||
|
||||
return super(HrLeaveAllocation, self).unlink()
|
||||
|
||||
|
||||
def update_vacation(self):
|
||||
leave_ids = self.env["hr.leave.allocation"].browse(
|
||||
|
||||
@@ -18,6 +18,22 @@ class YuthonVacationReports(models.Model):
|
||||
working_overtime = fields.Float(string='加班时', compute='_compute_working_overtime', store=True)
|
||||
meal_fee = fields.Integer(string="误餐次数", compute='_compute_meal_fee', store=True)
|
||||
|
||||
def overtime_allocation(self):
|
||||
form_id = self.env.ref('hr_holidays.hr_leave_allocation_view_form_manager').id
|
||||
holiday_status_id = self.env['hr.leave.type'].search([('name', '=', '补休')])
|
||||
return {
|
||||
'name': '补休时分配',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'hr.leave.allocation',
|
||||
'type': 'ir.actions.act_window',
|
||||
'views': [(form_id, 'form')],
|
||||
'context': {
|
||||
'default_holiday_status_id': holiday_status_id.id,
|
||||
'default_employee_ids': [(6, 0, [self.employee_id.id])],
|
||||
'default_allocation_type': 'regular',
|
||||
'default_name': '补休增加',
|
||||
}}
|
||||
|
||||
def update_vac(self):
|
||||
vacation_ids = self.env["yuthon.vacation.reports"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
|
||||
@@ -215,7 +215,13 @@
|
||||
<field name="search_view_id" ref="hr_leave_batch_search_view"/>
|
||||
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
|
||||
</record>
|
||||
|
||||
<record id="all_update_state" model="ir.actions.server">
|
||||
<field name="name">初始化状态</field>
|
||||
<field name="model_id" ref="hr_holidays.model_hr_leave"/>
|
||||
<field name="binding_model_id" ref="hr_holidays.model_hr_leave"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.update_state()</field>
|
||||
</record>
|
||||
<menuitem
|
||||
id="hr_holidays.hr_leave_menu_my"
|
||||
parent="hr_holidays.menu_hr_holidays_my_leaves"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<field name="name">yuthon.vacation.reports.tree</field>
|
||||
<field name="model">yuthon.vacation.reports</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="假期额度记录" editable="bottom">
|
||||
<tree string="假期额度日志" editable="bottom">
|
||||
<field name="employee_id" options="{'no_create': True}"/>
|
||||
<field name="leave"/>
|
||||
<field name="working_overtime"/>
|
||||
@@ -19,9 +19,20 @@
|
||||
<field name="name">yuthon.vacation.reports.form</field>
|
||||
<field name="model">yuthon.vacation.reports</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="假期额度记录">
|
||||
<form string="假期额度日志">
|
||||
<sheet>
|
||||
<field name="employee_id"/>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
<group col="3">
|
||||
<group>
|
||||
<field name="leave" string="剩余年假"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="working_overtime" string="剩余补休"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="meal_fee" string="剩余误餐费"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="年假">
|
||||
<field name="leave_ids" context="{'default_employee_id': employee_id}">
|
||||
@@ -40,6 +51,7 @@
|
||||
</field>
|
||||
</page>
|
||||
<page string="加班">
|
||||
<button name="overtime_allocation" string="分配" type="object" class="btn btn-primary"/>
|
||||
<field name="overtime_ids" context="{'default_employee_id': employee_id}">
|
||||
<tree editable="bottom" delete="false" decoration-muted="is_void">
|
||||
<field name="vacation_id" column_invisible="1"/>
|
||||
@@ -77,16 +89,94 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_vacation_reports_form1" model="ir.ui.view">
|
||||
<field name="name">yuthon.vacation.reports.form</field>
|
||||
<field name="model">yuthon.vacation.reports</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="我的假期额度记录" create="1" edit="1" delete="1">
|
||||
<sheet>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
<group col="3">
|
||||
<group>
|
||||
<field name="leave" string="剩余年假" readonly="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="working_overtime" string="剩余补休" readonly="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="meal_fee" string="剩余误餐费" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="年假">
|
||||
<field name="leave_ids" context="{'default_employee_id': employee_id}">
|
||||
<tree editable="bottom" delete="false" decoration-muted="is_void" edit="false" create="false">
|
||||
<field name="employee_id" column_invisible="1"/>
|
||||
<field name="vacation_id" column_invisible="1"/>
|
||||
<field name="workflow_record_id" domain="[('workflow_id.name', '=', '请假'), ('create_uid.employee_id', '=', employee_id)]"/>
|
||||
<field name="update_type" readonly="1"/>
|
||||
<field name="update_date" readonly="1"/>
|
||||
<field name="update_lines"/>
|
||||
<field name="allocation_type" optional="hide"/>
|
||||
<field name="is_void" optional="hide"/>
|
||||
<field name="text"/>
|
||||
<button name="unlink" string="删除" invisible="workflow_record_id" type="object" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="加班">
|
||||
<field name="overtime_ids" context="{'default_employee_id': employee_id}">
|
||||
<tree editable="bottom" delete="false" decoration-muted="is_void" edit="false" create="false">
|
||||
<field name="vacation_id" column_invisible="1"/>
|
||||
<field name="employee_id" column_invisible="1"/>
|
||||
<field name="workflow_record_id" domain="[('workflow_id.name', '=', '加班'), ('create_uid.employee_id', '=', employee_id)]"/>
|
||||
<field name="update_type" readonly="1"/>
|
||||
<field name="update_date" readonly="1"/>
|
||||
<field name="workday"/>
|
||||
<field name="legal_day"/>
|
||||
<field name="public_holidays"/>
|
||||
<field name="meal_number" column_invisible="1"/>
|
||||
<field name="is_void" optional="hide"/>
|
||||
<field name="text"/>
|
||||
<button name="unlink" string="删除" invisible="workflow_record_id" type="object" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="误餐">
|
||||
<field name="meal_fee_ids" context="{'default_employee_id': employee_id}">
|
||||
<tree editable="bottom" delete="false" decoration-muted="is_void" edit="false" create="false">
|
||||
<field name="employee_id" column_invisible="1"/>
|
||||
<field name="vacation_id" column_invisible="1"/>
|
||||
<field name="workflow_record_id" domain="[('workflow_id.name', '=', '外出'), ('create_uid.employee_id', '=', employee_id)]"/>
|
||||
<field name="update_type" readonly="1"/>
|
||||
<field name="update_date" readonly="1"/>
|
||||
<field name="update_lines"/>
|
||||
<field name="is_void" optional="hide"/>
|
||||
<field name="text"/>
|
||||
<button name="unlink" string="删除" invisible="workflow_record_id" type="object" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_vacation_reports_action" model="ir.actions.act_window">
|
||||
<field name="name">假期额度记录</field>
|
||||
<field name="name">假期额度日志</field>
|
||||
<field name="res_model">yuthon.vacation.reports</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_ids" eval="[(5, 0, 0),
|
||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_reports_tree')}),
|
||||
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_reports_form')})]"/>
|
||||
</record>
|
||||
<record id="view_yuthon_vacation_reports_my_action" model="ir.actions.act_window">
|
||||
<field name="name">我的假期额度</field>
|
||||
<field name="res_model">yuthon.vacation.reports</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
|
||||
<field name="view_ids" eval="[(5, 0, 0),
|
||||
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_reports_form1')})]"/>
|
||||
</record>
|
||||
<record id="all_update_employee" model="ir.actions.server">
|
||||
<field name="name">更新报表</field>
|
||||
|
||||
@@ -52,21 +52,107 @@ class PropertySplitApproval(models.Model):
|
||||
def put_split_message(self):
|
||||
property_list = []
|
||||
for property_split in self.property_split_approval_line_ids:
|
||||
main_property = self.property_id
|
||||
property_id = self.env['yuthon.property'].create({
|
||||
'name': property_split.split_property,
|
||||
'building_area': property_split.split_building_area,
|
||||
'rent_area': property_split.split_rent_area,
|
||||
'asset_type_id': property_split.split_asset_type_id.id,
|
||||
'property_merge_approval_id':self.property_id.id,
|
||||
'effective_date':self.effective_date,
|
||||
'asset_type_id': main_property.asset_type_id.id,
|
||||
'property_merge_approval_id': main_property.id,
|
||||
'is_electricity_meter': main_property.is_electricity_meter,
|
||||
'is_meter': main_property.is_meter,
|
||||
'is_message_fee': main_property.is_message_fee,
|
||||
'units': main_property.units,
|
||||
'district': main_property.district,
|
||||
'property_building_id': main_property.property_building_id.id,
|
||||
'property_orientation': main_property.property_orientation,
|
||||
'street': main_property.street,
|
||||
'property_source': main_property.property_source,
|
||||
'live_room': main_property.live_room.id,
|
||||
'house_type_id': main_property.house_type_id.id,
|
||||
'feature_ids': main_property.feature_ids.ids,
|
||||
'rental_conditions': main_property.rental_conditions,
|
||||
'property_floor_id': main_property.property_floor_id.id,
|
||||
'effective_date': self.effective_date,
|
||||
'is_done_merge': True
|
||||
})
|
||||
property_list.append([0, 0, {'property_id':property_id.id,
|
||||
'start_time': self.effective_date,
|
||||
}])
|
||||
self.property_id.write({'is_done_split': True})
|
||||
self.property_id.disassembly_information_ids = property_list
|
||||
|
||||
if main_property.water_meter_ids:
|
||||
water_vals = [
|
||||
(0, 0, {
|
||||
'property_meter_water_id': water.property_meter_water_id.id,
|
||||
'yuthon_property_id': property_id.id
|
||||
}) for water in main_property.water_meter_ids
|
||||
]
|
||||
property_id.water_meter_ids = water_vals
|
||||
|
||||
if main_property.energy_meter_ids:
|
||||
energy_vals = [
|
||||
(0, 0, {
|
||||
'property_meter_archives_id': energy.property_meter_archives_id.id,
|
||||
'yuthon_property_id': property_id.id
|
||||
}) for energy in main_property.energy_meter_ids
|
||||
]
|
||||
property_id.energy_meter_ids = energy_vals
|
||||
|
||||
if main_property.title_information_ids:
|
||||
title_vals = [
|
||||
(0, 0, {
|
||||
'property_message_id': line.property_message_id.id,
|
||||
'start_time': line.start_time,
|
||||
'end_date': line.end_date,
|
||||
'yuthon_property_id': property_id.id
|
||||
}) for line in main_property.title_information_ids
|
||||
]
|
||||
property_id.title_information_ids = title_vals
|
||||
|
||||
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,
|
||||
'precinct_id': line.precinct_id.id,
|
||||
'tenure_type': line.tenure_type,
|
||||
'admin_id': line.admin_id.id,
|
||||
'company_id': line.company_id.id,
|
||||
'start_time': line.start_time,
|
||||
'end_date': line.end_date,
|
||||
'yuthon_property_id': property_id.id
|
||||
}) for line in main_property.manage_information_ids
|
||||
]
|
||||
property_id.manage_information_ids = manage_vals
|
||||
|
||||
if main_property.assessment_ids:
|
||||
assessment_vals = [
|
||||
(0, 0, {
|
||||
'name': line.name, # 复制评估名称
|
||||
'yuthon_property_id': property_id.id
|
||||
}) for line in main_property.assessment_ids
|
||||
]
|
||||
property_id.assessment_ids = assessment_vals
|
||||
|
||||
if main_property.repair_ids:
|
||||
repair_vals = [
|
||||
(0, 0, {
|
||||
'name': line.name,
|
||||
'yuthon_property_id': property_id.id
|
||||
}) for line in main_property.repair_ids
|
||||
]
|
||||
property_id.repair_ids = repair_vals
|
||||
|
||||
if main_property.produce_ids:
|
||||
produce_vals = [
|
||||
(0, 0, {
|
||||
'produce_id': line.produce_id.id,
|
||||
'yuthon_property_id': property_id.id
|
||||
}) for line in main_property.produce_ids
|
||||
]
|
||||
property_id.produce_ids = produce_vals
|
||||
|
||||
self.property_id.write({
|
||||
'is_done_split': True,
|
||||
'disassembly_information_ids': property_list
|
||||
})
|
||||
|
||||
class PropertySplitApprovalLine(models.Model):
|
||||
_name = 'property.split.approval.line'
|
||||
@@ -74,10 +160,7 @@ class PropertySplitApprovalLine(models.Model):
|
||||
|
||||
property_split_approval_id = fields.Many2one('property.split.approval', string='关联物业拆分审批')
|
||||
split_property = fields.Char(string='物业名称')
|
||||
split_units = fields.Char(string='单元')
|
||||
split_property_floor_id = fields.Many2one('property.floor.setting', string='楼层')
|
||||
split_asset_type_id = fields.Many2one('yuthon.resource.type', string='资产类型')
|
||||
split_building_area = fields.Float(string='建筑面积', digits=(16, 4))
|
||||
split_building_area = fields.Float(string='管理面积', digits=(16, 4))
|
||||
split_rent_area = fields.Float(string='可租面积', digits=(16, 4))
|
||||
split_remarks = fields.Char(string='备注')
|
||||
|
||||
|
||||
@@ -74,13 +74,16 @@
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="拆分信息">
|
||||
<field name="property_split_approval_line_ids">
|
||||
<field name="property_split_approval_line_ids"
|
||||
context="{
|
||||
'default_split_units': 'units',
|
||||
'default_split_property_floor_id': 'property_floor_id',
|
||||
'default_split_asset_type_id': 'asset_type_id ',
|
||||
}"
|
||||
>
|
||||
<tree editable="bottom">
|
||||
<field name="property_split_approval_id" column_invisible="1"/>
|
||||
<field name="split_property"/>
|
||||
<field name="split_units"/>
|
||||
<field name="split_property_floor_id"/>
|
||||
<field name="split_asset_type_id"/>
|
||||
<field name="split_building_area"/>
|
||||
<field name="split_rent_area"/>
|
||||
<field name="split_remarks"/>
|
||||
|
||||
@@ -448,7 +448,7 @@ class InheritHrPayslip(models.Model):
|
||||
}
|
||||
|
||||
@api.depends('year_compute', 'year_jie', 'year_gong', 'jing_te', 'study_on', 'seniority_allowance',
|
||||
'position_salary', 'liquidation_year',
|
||||
'position_salary', 'liquidation_year', 'rank_salary',
|
||||
'quality_allowance', 'high_subsidy', 'environmental_allowance', 'last_duty', 'seniority_salary',
|
||||
'commuting_allowance', 'base_salary', 'performance_bonuses', 'comprehensive_subsidy',
|
||||
'full_attendance_award', 'overtime_pay', 'based_pay',
|
||||
@@ -461,6 +461,7 @@ class InheritHrPayslip(models.Model):
|
||||
def _compute_total_before_tax(self):
|
||||
for record in self:
|
||||
record.total_before_tax = (
|
||||
record.rank_salary +
|
||||
record.condolence_fund +
|
||||
record.spring_festival +
|
||||
record.liquidation_year +
|
||||
@@ -518,7 +519,7 @@ class InheritHrPayslip(models.Model):
|
||||
record.b_year -
|
||||
record.union_dues -
|
||||
record.tax_payable -
|
||||
record.maternity_allowance +
|
||||
record.maternity_allowance -
|
||||
record.individual_income_tax +
|
||||
record.children_welfare_fee +
|
||||
record.add_income_tax +
|
||||
|
||||
Reference in New Issue
Block a user