@@ -6,5 +6,5 @@ class SoongApprovalGroup(models.Model):
|
||||
_name = 'soong.approval.group'
|
||||
_order = 'sequence'
|
||||
|
||||
name = fields.Char(string="分组名称")
|
||||
name = fields.Char(string="分组")
|
||||
sequence = fields.Integer(default=1)
|
||||
|
||||
@@ -58,7 +58,7 @@ class HrLeave(models.Model):
|
||||
column2='attachment_id'
|
||||
)
|
||||
request_hour_from = fields.Selection([
|
||||
('0', '12:00 上午'), ('0.5', '12:30 上午'),
|
||||
('0', '00:00 上午'), ('0.5', '00:30 上午'),
|
||||
('1', '1:00 上午'), ('1.5', '1:30 上午'),
|
||||
('2', '2:00 上午'), ('2.5', '2:30 上午'),
|
||||
('3', '3:00 上午'), ('3.5', '3:30 上午'),
|
||||
@@ -83,7 +83,7 @@ class HrLeave(models.Model):
|
||||
('22', '10:00 下午'), ('22.5', '10:30 下午'),
|
||||
('23', '11:00 下午'), ('23.5', '11:30 下午')], string='开始时间')
|
||||
request_hour_to = fields.Selection([
|
||||
('0', '12:00 上午'), ('0.5', '12:30 上午'),
|
||||
('0', '00:00 上午'), ('0.5', '00:30 上午'),
|
||||
('1', '1:00 上午'), ('1.5', '1:30 上午'),
|
||||
('2', '2:00 上午'), ('2.5', '2:30 上午'),
|
||||
('3', '3:00 上午'), ('3.5', '3:30 上午'),
|
||||
@@ -156,10 +156,10 @@ class HolidaysRequestBatch(models.Model):
|
||||
self.leave_ids.action_validate()
|
||||
self.hour_leave_ids.action_validate()
|
||||
|
||||
@api.onchange('leave_ids', 'hour_leave_ids')
|
||||
@api.onchange('is_day', 'is_hour')
|
||||
def _onchange_name(self):
|
||||
employee_name = self.users_id.name
|
||||
if self.leave_ids or self.hour_leave_ids:
|
||||
if self.is_day or self.is_hour:
|
||||
leave_types = []
|
||||
for leave in self.leave_ids:
|
||||
if leave.number_of_days_display:
|
||||
|
||||
@@ -200,6 +200,45 @@
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall"/>
|
||||
</record>
|
||||
<record forcecreate="True" id="card_card_customer_shift_remind_time_on" model="ir.cron">
|
||||
<field name="name">定时任务:客服上班提醒</field>
|
||||
<field name="model_id" ref="model_hr_attendance"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.card_customer_service_shift_remind_on()</field>
|
||||
<field eval="True" name="active"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">days</field>
|
||||
<field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 08:50:00')"/>
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall"/>
|
||||
</record>
|
||||
<record forcecreate="True" id="card_customer_service_shift_remind_time_out" model="ir.cron">
|
||||
<field name="name">定时任务:客服下班提醒</field>
|
||||
<field name="model_id" ref="model_hr_attendance"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.card_customer_service_shift_remind_out()</field>
|
||||
<field eval="True" name="active"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">days</field>
|
||||
<field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 18:00:00')"/>
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall"/>
|
||||
</record>
|
||||
<record forcecreate="True" id="card_customer_service_stand_remind_time" model="ir.cron">
|
||||
<field name="name">定时任务:客服值班提醒</field>
|
||||
<field name="model_id" ref="model_hr_attendance"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.card_customer_service_stand_remind()</field>
|
||||
<field eval="True" name="active"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">days</field>
|
||||
<field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 12:00:00')"/>
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
|
||||
@@ -469,6 +469,42 @@ class HrAttendance(models.Model):
|
||||
'department': user.department_id.name, })
|
||||
self.card_out_comment(user.resource_id.employee_id, user.template_id.planning_name)
|
||||
|
||||
# 客服上班消息提醒
|
||||
def card_customer_service_shift_remind_on(self):
|
||||
ba_up_users = self.env['planning.slot'].search([('role_id.name', '=', '客服中心'), ('template_id.planning_name', '=', '白班')])
|
||||
for user in ba_up_users:
|
||||
if user.start_datetime.date() == fields.date.today():
|
||||
self.env['card.remind.form'].create({
|
||||
'name': user.resource_id.employee_id.name,
|
||||
'start_time': datetime.now(),
|
||||
'shift': user.template_id.planning_name,
|
||||
'department': user.department_id.name, })
|
||||
self.card_in_comment(user.resource_id.employee_id, user.template_id.planning_name)
|
||||
|
||||
# 客服下班消息提醒
|
||||
def card_customer_service_shift_remind_out(self):
|
||||
ba_up_users = self.env['planning.slot'].search([('role_id.name', '=', '客服中心'), ('template_id.planning_name', '=', '白班')])
|
||||
for user in ba_up_users:
|
||||
if user.start_datetime.date() == fields.date.today():
|
||||
self.env['card.remind.form'].create({
|
||||
'name': user.resource_id.employee_id.name,
|
||||
'start_time': datetime.now(),
|
||||
'shift': user.template_id.planning_name,
|
||||
'department': user.department_id.name, })
|
||||
self.card_out_comment(user.resource_id.employee_id, user.template_id.planning_name)
|
||||
|
||||
# 客服值班消息提醒
|
||||
def card_customer_service_stand_remind(self):
|
||||
ba_up_users = self.env['planning.slot'].search([('role_id.name', '=', '客服中心'), ('template_id.planning_name', '=', '值班')])
|
||||
for user in ba_up_users:
|
||||
if user.start_datetime.date() == fields.date.today():
|
||||
self.env['card.remind.form'].create({
|
||||
'name': user.resource_id.employee_id.name,
|
||||
'start_time': datetime.now(),
|
||||
'shift': user.template_id.planning_name,
|
||||
'department': user.department_id.name, })
|
||||
self.card_duty_remind(user.resource_id.employee_id)
|
||||
|
||||
def card_in_comment(self, employee_id, planning_name):
|
||||
data = f"您的班次是{planning_name},还有10分钟上班,记得打卡"
|
||||
self.sudo().env["wecom.apps"].sync_send_message(category='att', user_id=employee_id.wecom_userid, message=data)
|
||||
|
||||
@@ -19,7 +19,7 @@ class YuthonShiftApproval(models.Model):
|
||||
shift_id = fields.Many2one('planning.slot', string="申请人班次1")
|
||||
shift_two_id = fields.Many2one('planning.slot', string="申请人班次2")
|
||||
return_id = fields.Many2one('planning.slot', string="调班人班次1")
|
||||
return_two_id = fields.Many2one('planning.slot', string="申请人班次2")
|
||||
return_two_id = fields.Many2one('planning.slot', string="调班人班次2")
|
||||
department_id = fields.Many2one('hr.department', string="部门", related='resource_id.employee_id.department_id')
|
||||
resource_ids = fields.Many2many('resource.resource', string="资源用户列表")
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
|
||||
@@ -66,14 +66,14 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="yuthon_resource_calendar_leaves_tree" model="ir.ui.view">
|
||||
<field name="name">resource.calendar.leaves.tree</field>
|
||||
<field name="model">resource.calendar.leaves</field>
|
||||
<field name="inherit_id" ref="hr_holidays.resource_calendar_leaves_tree_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree/field[@name='date_to']" position="after">
|
||||
<field name="is_holidays" string="人员"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!-- <record id="yuthon_resource_calendar_leaves_tree" model="ir.ui.view">-->
|
||||
<!-- <field name="name">resource.calendar.leaves.tree</field>-->
|
||||
<!-- <field name="model">resource.calendar.leaves</field>-->
|
||||
<!-- <field name="inherit_id" ref="hr_holidays.resource_calendar_leaves_tree_inherit"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <xpath expr="//tree/field[@name='date_to']" position="after">-->
|
||||
<!-- <field name="is_holidays" string="人员"/>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
</odoo>
|
||||
@@ -10,20 +10,20 @@ class EmployeeBannerRoute(Controller):
|
||||
in_hired_count = employees.search_count([]) # 在职
|
||||
all_hired_count = employees.search_count([]) # 全职
|
||||
return {
|
||||
'html': f"""
|
||||
<div style="display: flex; justify-content: space-around; align-items: center; text-align: center; padding: 20px; width: 100%;margin-top:25px;margin-bottom:25px;">
|
||||
<div style="flex: 1; padding: 20px;">
|
||||
<h2>正式</h2>
|
||||
<p style="font-size: 24px; color: #4CAF50;">{hired_count}</p>
|
||||
</div>
|
||||
<div style="flex: 1; padding: 20px;">
|
||||
<h2>在职</h2>
|
||||
<p style="font-size: 24px; color: #2196F3;">{in_hired_count}</p>
|
||||
</div>
|
||||
<div style="flex: 1; padding: 20px;">
|
||||
<h2>全职</h2>
|
||||
<p style="font-size: 24px; color: #FF5722;">{all_hired_count}</p>
|
||||
</div>
|
||||
</div>
|
||||
"""
|
||||
# 'html': f"""
|
||||
# <div style="display: flex; justify-content: space-around; align-items: center; text-align: center; padding: 20px; width: 100%;margin-top:25px;margin-bottom:25px;">
|
||||
# <div style="flex: 1; padding: 20px;">
|
||||
# <h2>正式</h2>
|
||||
# <p style="font-size: 24px; color: #4CAF50;">{hired_count}</p>
|
||||
# </div>
|
||||
# <div style="flex: 1; padding: 20px;">
|
||||
# <h2>在职</h2>
|
||||
# <p style="font-size: 24px; color: #2196F3;">{in_hired_count}</p>
|
||||
# </div>
|
||||
# <div style="flex: 1; padding: 20px;">
|
||||
# <h2>全职</h2>
|
||||
# <p style="font-size: 24px; color: #FF5722;">{all_hired_count}</p>
|
||||
# </div>
|
||||
# </div>
|
||||
# """
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from datetime import datetime
|
||||
import re
|
||||
|
||||
|
||||
class YuthonMedicalManage(models.Model):
|
||||
@@ -19,3 +18,22 @@ class YuthonMedicalManage(models.Model):
|
||||
prev_last_year_balance = fields.Float(string="前年结余")
|
||||
prev_last_year_used = fields.Float(string="前年使用")
|
||||
prev_last_year_remaining = fields.Float(string="前年剩余")
|
||||
medical_line_ids = fields.One2many('yuthon.medical.line', 'medical_manage_id', string="体检费明细")
|
||||
|
||||
def button_details(self):
|
||||
form_id = self.env.ref('yuthon_hr_employee.view_yuthon_medical_manage_form').id
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"name": "修正申请",
|
||||
"res_model": "yuthon.medical.manage",
|
||||
"views": [[form_id, "form"]],
|
||||
"res_id": self.id,
|
||||
}
|
||||
|
||||
class YuthonMedicalLine(models.Model):
|
||||
_name = 'yuthon.medical.line'
|
||||
_description = '体检费明细'
|
||||
|
||||
medical_manage_id = fields.Many2one('yuthon.medical.manage', string="关联体检费管理")
|
||||
medical_date = fields.Date(string="体检日期")
|
||||
medical_fee = fields.Float(string="费用")
|
||||
|
||||
@@ -11,6 +11,8 @@ class YuthonMedicalRule(models.Model):
|
||||
|
||||
base_amount = fields.Float(string='基数金额')
|
||||
starting_age = fields.Integer(string='起始年龄')
|
||||
department_id = fields.Many2one("hr.department", string="部门")
|
||||
extension_years = fields.Selection(selection=[(str(i), str(i)) for i in range(1, 13)], string='延续年限')
|
||||
increase_interval_years = fields.Integer(string='递增间隔(年)')
|
||||
increment_amount = fields.Float(string='递增金额')
|
||||
cap = fields.Float(string='封顶金额')
|
||||
|
||||
@@ -17,4 +17,5 @@ access_yuthon_hr_employee_time_wizard,yuthon_hr_employee_time_wizard,model_yutho
|
||||
access_hr_job_add_wizard,hr_job_add_wizard,model_hr_job_add_wizard,base.group_user,1,1,1,1
|
||||
access_yuthon_party_setting,yuthon_party_setting,model_yuthon_party_setting,base.group_user,1,1,1,1
|
||||
access_yuthon_medical_rule,yuthon_medical_rule,model_yuthon_medical_rule,base.group_user,1,1,1,1
|
||||
access_yuthon_medical_manage,yuthon_medical_manage,model_yuthon_medical_manage,base.group_user,1,1,1,1
|
||||
access_yuthon_medical_manage,yuthon_medical_manage,model_yuthon_medical_manage,base.group_user,1,1,1,1
|
||||
access_yuthon_medical_line,yuthon_medical_line,model_yuthon_medical_line,base.group_user,1,1,1,1
|
||||
|
@@ -15,9 +15,55 @@
|
||||
<field name="prev_last_year_balance"/>
|
||||
<field name="prev_last_year_used"/>
|
||||
<field name="prev_last_year_remaining"/>
|
||||
<button name="button_details" string="查看详情" type="object" class="oe_highlight"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_medical_manage_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.medical.manage.form</field>
|
||||
<field name="model">yuthon.medical.manage</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="体检费管理">
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<label for="employee_id"/>
|
||||
<h1>
|
||||
<field name="employee_id"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<field name="current_year_remaining"/>
|
||||
</group>
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="last_year_quota"/>
|
||||
<field name="last_year_quota"/>
|
||||
<field name="last_year_balance"/>
|
||||
<field name="last_year_used"/>
|
||||
<field name="last_year_remaining"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="prev_last_year_quota"/>
|
||||
<field name="prev_last_year_balance"/>
|
||||
<field name="prev_last_year_used"/>
|
||||
<field name="prev_last_year_remaining"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="体检费">
|
||||
<field name="medical_line_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="medical_manage_id" column_invisible="1"/>
|
||||
<field name="medical_date"/>
|
||||
<field name="medical_fee"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_medical_manage_action" model="ir.actions.act_window">
|
||||
<field name="name">体检费管理</field>
|
||||
<field name="res_model">yuthon.medical.manage</field>
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
<field name="cap"/>
|
||||
<field name="allowance_unmarried_women"/>
|
||||
<field name="allowance_married_women"/>
|
||||
<field name="department_id"/>
|
||||
<field name="extension_years"/>
|
||||
<field name="start_date"/>
|
||||
<field name="end_date"/>
|
||||
<field name="is_enable"/>
|
||||
|
||||
@@ -138,6 +138,38 @@
|
||||
action="issue_library_action_cancel5"
|
||||
sequence="9"/>
|
||||
|
||||
<!--物管议题库-->
|
||||
<menuitem id="tianhe_issue_library_menu_root11"
|
||||
parent="tianhe_issue_library_menu_root"
|
||||
name="物管议题库"
|
||||
groups="yuthon_issue.group_property_admin"
|
||||
sequence="27"/>
|
||||
|
||||
<menuitem id="issue_library_menu11"
|
||||
parent="tianhe_issue_library_menu_root11"
|
||||
name="全部"
|
||||
action="issue_library_action11"
|
||||
sequence="1"/>
|
||||
|
||||
<menuitem id="tianhe_other_issue_library_will11"
|
||||
parent="tianhe_issue_library_menu_root11"
|
||||
name="已审批"
|
||||
action="issue_library_action_will11"
|
||||
sequence="5"/>
|
||||
|
||||
<menuitem id="tianhe_other_issue_library_done11"
|
||||
parent="tianhe_issue_library_menu_root11"
|
||||
name="已上会"
|
||||
action="issue_library_action_done11"
|
||||
sequence="7"/>
|
||||
|
||||
<menuitem id="tianhe_other_issue_library_cancel11"
|
||||
parent="tianhe_issue_library_menu_root11"
|
||||
name="已取消"
|
||||
action="issue_library_action_cancel11"
|
||||
sequence="9"/>
|
||||
|
||||
|
||||
<!-- 物管党支议题库-->
|
||||
<menuitem id="tianhe_issue_library_menu_root6"
|
||||
parent="tianhe_issue_library_menu_root"
|
||||
@@ -200,38 +232,38 @@
|
||||
action="issue_library_action_cancel7"
|
||||
sequence="9"/>
|
||||
|
||||
<!--物管议题库-->
|
||||
<menuitem id="tianhe_issue_library_menu_root11"
|
||||
parent="tianhe_issue_library_menu_root"
|
||||
name="物管议题库"
|
||||
groups="yuthon_issue.group_property_admin"
|
||||
sequence="40"/>
|
||||
|
||||
<menuitem id="issue_library_menu11"
|
||||
parent="tianhe_issue_library_menu_root11"
|
||||
<!--粮储议题库-->
|
||||
<menuitem id="tianhe_issue_library_menu_root12"
|
||||
parent="tianhe_issue_library_menu_root"
|
||||
name="粮储议题库"
|
||||
groups="yuthon_issue.group_grain_team_topic"
|
||||
sequence="42"/>
|
||||
|
||||
<menuitem id="issue_library_menu12"
|
||||
parent="tianhe_issue_library_menu_root12"
|
||||
name="全部"
|
||||
action="issue_library_action11"
|
||||
action="issue_library_action12"
|
||||
sequence="1"/>
|
||||
|
||||
<menuitem id="tianhe_other_issue_library_will11"
|
||||
parent="tianhe_issue_library_menu_root11"
|
||||
<menuitem id="tianhe_other_issue_library_will12"
|
||||
parent="tianhe_issue_library_menu_root12"
|
||||
name="已审批"
|
||||
action="issue_library_action_will11"
|
||||
action="issue_library_action_will12"
|
||||
sequence="5"/>
|
||||
|
||||
<menuitem id="tianhe_other_issue_library_done11"
|
||||
parent="tianhe_issue_library_menu_root11"
|
||||
<menuitem id="tianhe_other_issue_library_done12"
|
||||
parent="tianhe_issue_library_menu_root12"
|
||||
name="已上会"
|
||||
action="issue_library_action_done11"
|
||||
action="issue_library_action_done12"
|
||||
sequence="7"/>
|
||||
|
||||
<menuitem id="tianhe_other_issue_library_cancel11"
|
||||
parent="tianhe_issue_library_menu_root11"
|
||||
<menuitem id="tianhe_other_issue_library_cancel12"
|
||||
parent="tianhe_issue_library_menu_root12"
|
||||
name="已取消"
|
||||
action="issue_library_action_cancel11"
|
||||
action="issue_library_action_cancel12"
|
||||
sequence="9"/>
|
||||
|
||||
|
||||
<!--粮储党支议题库-->
|
||||
<menuitem id="tianhe_issue_library_menu_root9"
|
||||
parent="tianhe_issue_library_menu_root"
|
||||
@@ -294,36 +326,6 @@
|
||||
action="issue_library_action_cancel10"
|
||||
sequence="9"/>
|
||||
|
||||
<!--粮储议题库-->
|
||||
<menuitem id="tianhe_issue_library_menu_root12"
|
||||
parent="tianhe_issue_library_menu_root"
|
||||
name="粮储议题库"
|
||||
groups="yuthon_issue.group_grain_team_topic"
|
||||
sequence="50"/>
|
||||
|
||||
<menuitem id="issue_library_menu12"
|
||||
parent="tianhe_issue_library_menu_root12"
|
||||
name="全部"
|
||||
action="issue_library_action12"
|
||||
sequence="1"/>
|
||||
|
||||
<menuitem id="tianhe_other_issue_library_will12"
|
||||
parent="tianhe_issue_library_menu_root12"
|
||||
name="已审批"
|
||||
action="issue_library_action_will12"
|
||||
sequence="5"/>
|
||||
|
||||
<menuitem id="tianhe_other_issue_library_done12"
|
||||
parent="tianhe_issue_library_menu_root12"
|
||||
name="已上会"
|
||||
action="issue_library_action_done12"
|
||||
sequence="7"/>
|
||||
|
||||
<menuitem id="tianhe_other_issue_library_cancel12"
|
||||
parent="tianhe_issue_library_menu_root12"
|
||||
name="已取消"
|
||||
action="issue_library_action_cancel12"
|
||||
sequence="9"/>
|
||||
|
||||
<menuitem id="issue_meeting_menu"
|
||||
parent="tianhe_issue_library_menu_root"
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
'views/property_transaction_confirmed.xml',
|
||||
'wizard/property_add_wizard_views.xml',
|
||||
'wizard/property_contract_wizard.xml',
|
||||
'wizard/property_physical_wizard_views.xml',
|
||||
'wizard/choose_contract_wizard_views.xml',
|
||||
'wizard/property_rental_wizard_views.xml',
|
||||
'views/property_menu_all.xml',
|
||||
|
||||
@@ -21,7 +21,47 @@ class PropertyReimbursementForm(models.Model):
|
||||
company_page = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储')], string="公司")
|
||||
account_id = fields.Many2one('property.account.setting', string="账户")
|
||||
expense_line_ids = fields.One2many('property.expense.line', 'reimbursement_id', string="费用项目明细")
|
||||
physical_line_ids = fields.One2many('property.physical.line', 'reimbursement_id', string="体检费明细")
|
||||
|
||||
def put_physical_in(self): # 导入按钮
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"name": "导入体检费明细",
|
||||
"res_model": "property.physical.wizard",
|
||||
"view_mode": "form",
|
||||
"target": "new",
|
||||
"context": {
|
||||
"default_reimbursement_id": self.id
|
||||
}
|
||||
}
|
||||
|
||||
# 体检费计算方法
|
||||
def compute_reimbursement(self):
|
||||
for record in self:
|
||||
for rec in record.physical_line_ids:
|
||||
rule_id = self.env['yuthon.medical.rule'].search([('department_id', '=', rec.employee_id.department_id.id)])
|
||||
employee_id = self.env['yuthon.medical.manage'].search([('employee_id', '=', rec.employee_id.id)])
|
||||
if not employee_id:
|
||||
years_passed = rec.employee_id.old - rule_id.starting_age
|
||||
decades_passed = years_passed // rule_id.increase_interval_years
|
||||
increased_amount = decades_passed * rule_id.increment_amount
|
||||
total_amount = rule_id.base_amount + increased_amount - rec.fees
|
||||
final_amount = min(total_amount, rule_id.cap)
|
||||
if rec.employee_id.user_sex == 'girl':
|
||||
if rec.employee_id.marital == 'single':
|
||||
final_amount = final_amount + rule_id.allowance_unmarried_women - rec.fees
|
||||
else:
|
||||
final_amount = final_amount + rule_id.allowance_married_women - rec.fees
|
||||
employee_id = self.env['yuthon.medical.manage'].create({
|
||||
'employee_id': rec.employee_id.id,
|
||||
'current_year_remaining': final_amount})
|
||||
else:
|
||||
final_amount = employee_id.current_year_remaining - rec.fees
|
||||
employee_id.write({'current_year_remaining': final_amount})
|
||||
self.env['yuthon.medical.line'].create({
|
||||
'medical_manage_id': employee_id.id,
|
||||
'medical_date': rec.reimbursement_date,
|
||||
'medical_fee': rec.fees})
|
||||
|
||||
class PropertyExpenseLine(models.Model):
|
||||
_name = 'property.expense.line'
|
||||
@@ -29,11 +69,27 @@ class PropertyExpenseLine(models.Model):
|
||||
|
||||
reimbursement_id = fields.Many2one('property.reimbursement.form', string='关联报销单')
|
||||
expense_id = fields.Many2one('property.project.setting', string='费用项目')
|
||||
invoice_type = fields.Char(string='发票类型')
|
||||
invoice_type = fields.Selection([('ordinary_invoice', '普通发票'), ('vat_invoice', '增值税发票'), ('air_ticket', '机票'),
|
||||
('train_ticket', '火车票'), ('other_transport_ticket', '其他运输票'), ('other', '其他')], string='发票类型', default='ordinary_invoice')
|
||||
expense_amount = fields.Float(string='费用金额')
|
||||
applied_reimbursement_amount = fields.Float(string='申请报销金额')
|
||||
expense_department_id = fields.Many2one('hr.department', string='费用承担部门')
|
||||
invoice_receipt_number = fields.Char(string='收票单号')
|
||||
applied_payment_amount = fields.Float(string='申请付款金额')
|
||||
approved_reimbursement_amount = fields.Float(string='核定报销金额')
|
||||
approved_payment_amount = fields.Float(string='核定付款金额')
|
||||
approved_payment_amount = fields.Float(string='核定付款金额')
|
||||
|
||||
|
||||
class PropertyPhysicalLine(models.Model):
|
||||
_name = 'property.physical.line'
|
||||
_description = '体检费明细'
|
||||
|
||||
reimbursement_id = fields.Many2one('property.reimbursement.form', string='关联报销单')
|
||||
employee_id = fields.Many2one('hr.employee', string='姓名')
|
||||
department_id = fields.Many2one(related='employee_id.department_id', string="部门")
|
||||
sex = fields.Selection(related='employee_id.user_sex', string="性别")
|
||||
reimbursement_date = fields.Date(string='报销日期')
|
||||
fees = fields.Float(string='实收')
|
||||
package_grouping = fields.Char(string='套餐分组')
|
||||
package_fee = fields.Float(string='套餐费用')
|
||||
examination_fee = fields.Float(string='加查费用')
|
||||
|
||||
@@ -82,4 +82,6 @@ access_choose_property_wizard,choose_property_wizard,model_choose_property_wizar
|
||||
access_property_rental_wizard,property_rental_wizard,model_property_rental_wizard,base.group_user,1,1,1,1
|
||||
access_property_reimbursement_form,property_reimbursement_form,model_property_reimbursement_form,base.group_user,1,1,1,1
|
||||
access_property_expense_line,property_expense_line,model_property_expense_line,base.group_user,1,1,1,1
|
||||
access_property_physical_line,property_physical_line,model_property_physical_line,base.group_user,1,1,1,1
|
||||
access_property_physical_wizard,property_physical_wizard,model_property_physical_wizard,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
<field name="code" readonly="1" string="流水号:"/>
|
||||
</group>
|
||||
<sheet>
|
||||
<button name="compute_reimbursement" string="提交" type="object" class="oe_highlight"/>
|
||||
<group string="审批事项">
|
||||
<field name="name"/>
|
||||
<field name="users_id"/>
|
||||
@@ -47,6 +48,24 @@
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
<notebook>
|
||||
<page string="体检费明细">
|
||||
<button name="put_physical_in" string="导入" type="object" class="oe_highlight"/>
|
||||
<field name="physical_line_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="reimbursement_id" column_invisible="1"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="sex"/>
|
||||
<field name="department_id"/>
|
||||
<field name="package_grouping"/>
|
||||
<field name="reimbursement_date"/>
|
||||
<field name="package_fee"/>
|
||||
<field name="examination_fee"/>
|
||||
<field name="fees"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from . import property_contract_wizard
|
||||
from . import choose_property_wizard
|
||||
from . import property_rental_wizard
|
||||
from . import property_add_wizard
|
||||
from . import property_add_wizard
|
||||
from . import property_physical_wizard
|
||||
@@ -0,0 +1,43 @@
|
||||
from odoo import models, fields, api, _, SUPERUSER_ID
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
import xlrd
|
||||
import base64
|
||||
import datetime
|
||||
from datetime import datetime
|
||||
import pandas as pd
|
||||
|
||||
|
||||
class PropertyPhysicalWizard(models.Model):
|
||||
_name = 'property.physical.wizard'
|
||||
|
||||
excel_file = fields.Binary(string="上传Excel表")
|
||||
excel_name = fields.Char(string="文件名")
|
||||
reimbursement_id = fields.Many2one('property.reimbursement.form', string="关联报销单")
|
||||
|
||||
def confirm(self):
|
||||
"""
|
||||
导入excel文件,按行读取数据并处理
|
||||
"""
|
||||
if not self.excel_file:
|
||||
raise ValidationError('请上传文件。')
|
||||
book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file))
|
||||
sh = book.sheet_by_index(0)
|
||||
for rx in range(1, sh.nrows):
|
||||
row = sh.row(rx)
|
||||
self.yuthon_physical_update(row)
|
||||
|
||||
def yuthon_physical_update(self, row):
|
||||
package_grouping = row[1].value
|
||||
package_fee = row[4].value
|
||||
examination_fee = row[5].value
|
||||
fees = row[6].value
|
||||
employee_id = self.env['hr.employee'].search([('name', '=', row[2].value)])
|
||||
physical_date = {
|
||||
'reimbursement_id':self.reimbursement_id.id,
|
||||
'package_grouping': package_grouping,
|
||||
'package_fee': package_fee,
|
||||
'examination_fee': examination_fee,
|
||||
'fees': fees,
|
||||
'employee_id': employee_id.id,
|
||||
}
|
||||
self.env['property.physical.line'].create(physical_date)
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="property_physical_template_downloads_he_action" model="ir.actions.act_url">
|
||||
<field name="name">体检费模板</field>
|
||||
<field name="target">self</field>
|
||||
<field name="url">...</field>
|
||||
</record>
|
||||
|
||||
<record id="property_physical_wizard_form" model="ir.ui.view">
|
||||
<field name="name">体检费导入弹窗</field>
|
||||
<field name="model">property.physical.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<header>
|
||||
<button name="%(property_physical_template_downloads_he_action)d" string="模板下载" type="action"
|
||||
class="btn btn-primary"/>
|
||||
</header>
|
||||
<group>
|
||||
<group>
|
||||
<field name="excel_file" filename="excel_name"/>
|
||||
<field name="excel_name" invisible="1"/>
|
||||
</group>
|
||||
<group>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button name="confirm" string="确认" type="object" class="oe_highlight"/>
|
||||
<button string="返回" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
@@ -314,9 +314,9 @@
|
||||
<!-- 薪资管理 -->
|
||||
<menuitem id="human_resources_salary_root_board"
|
||||
name="薪资管理"
|
||||
parent="human_resources_menu_root_board"
|
||||
web_icon="yuthon_work_brand,static/description/salary.png"
|
||||
groups="yuthon_hr_employee.group_hr_employee_salary_user"
|
||||
sequence="11"/>
|
||||
sequence="9"/>
|
||||
<menuitem id="human_work_entry_board"
|
||||
name="工作分录"
|
||||
parent="human_resources_salary_root_board"
|
||||
@@ -355,15 +355,15 @@
|
||||
parent="human_pay_setting_structural_tt_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_tt_common_action"
|
||||
sequence="5"/>
|
||||
<menuitem id="hr_payroll_temporary_tt_board"
|
||||
name="临时项"
|
||||
parent="human_pay_setting_structural_tt_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_tt_temporary_action"
|
||||
sequence="7"/>
|
||||
<menuitem id="hr_payroll_insurance_tt_board"
|
||||
name="五险一金"
|
||||
parent="human_pay_setting_structural_tt_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_tt_insurances_action"
|
||||
sequence="7"/>
|
||||
<menuitem id="hr_payroll_temporary_tt_board"
|
||||
name="临时项"
|
||||
parent="human_pay_setting_structural_tt_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_tt_temporary_action"
|
||||
sequence="9"/>
|
||||
<!-- <menuitem id="human_pay_setting_payroll_items_tt_board"-->
|
||||
<!-- name="工资项"-->
|
||||
@@ -394,15 +394,15 @@
|
||||
parent="human_pay_setting_structural_lc_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_lc_common_action"
|
||||
sequence="5"/>
|
||||
<menuitem id="hr_payroll_temporary_lc_board"
|
||||
name="临时项"
|
||||
parent="human_pay_setting_structural_lc_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_lc_temporary_action"
|
||||
sequence="7"/>
|
||||
<menuitem id="hr_payroll_insurances_lc_board"
|
||||
name="五险一金"
|
||||
parent="human_pay_setting_structural_lc_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_lc_insurances_action"
|
||||
sequence="7"/>
|
||||
<menuitem id="hr_payroll_temporary_lc_board"
|
||||
name="临时项"
|
||||
parent="human_pay_setting_structural_lc_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_lc_temporary_action"
|
||||
sequence="9"/>
|
||||
<!-- <menuitem id="human_pay_setting_payroll_items_lc_board"-->
|
||||
<!-- name="工资项"-->
|
||||
@@ -433,15 +433,15 @@
|
||||
parent="human_pay_setting_structural_wg_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_wg_common_action"
|
||||
sequence="7"/>
|
||||
<menuitem id="hr_payroll_temporary_wg_board"
|
||||
name="临时项"
|
||||
parent="human_pay_setting_structural_wg_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_wg_temporary_action"
|
||||
sequence="9"/>
|
||||
<menuitem id="hr_payroll_insurance_wg_board"
|
||||
name="五险一金"
|
||||
parent="human_pay_setting_structural_wg_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_wg_insurances_action"
|
||||
sequence="9"/>
|
||||
<menuitem id="hr_payroll_temporary_wg_board"
|
||||
name="临时项"
|
||||
parent="human_pay_setting_structural_wg_board"
|
||||
action="yuthon_salary.view_yuthon_payroll_wg_temporary_action"
|
||||
sequence="11"/>
|
||||
<!-- <menuitem id="human_pay_setting_payroll_items_wg_board"-->
|
||||
<!-- name="工资项"-->
|
||||
|
||||
Reference in New Issue
Block a user