添加功能
This commit is contained in:
@@ -299,21 +299,25 @@ class HolidaysRequestBatch(models.Model):
|
||||
self.leave_ids.action_validate()
|
||||
self.hour_leave_ids.action_validate()
|
||||
|
||||
# @api.model_create_multi
|
||||
# def create(self, vals_list):
|
||||
# for vals in vals_list:
|
||||
# number_hours = 0
|
||||
# if vals.get('yuthon_company') == 'thwg':
|
||||
# if 'hour_leave_ids' in vals:
|
||||
# for leave_info in vals.get('hour_leave_ids', []):
|
||||
# hours_text = leave_info[2]['number_of_hours_text']
|
||||
# match = re.search(r'\d+', hours_text)
|
||||
# if match:
|
||||
# number_hours += float(match.group())
|
||||
# valid_hours = [2, 4, 6, 8]
|
||||
# if number_hours not in valid_hours:
|
||||
# raise ValidationError("休假时长必须为 2、4、6 或 8 小时才可以保存!")
|
||||
# return super(HolidaysRequestBatch, self).create(vals_list)
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
number_hours = 0
|
||||
company_id = vals.get('company_id')
|
||||
if company_id:
|
||||
company = self.env['res.company'].browse(company_id)
|
||||
has_tianhe_property = any(child.name == '天河物管' for child in company.child_ids)
|
||||
if has_tianhe_property:
|
||||
if 'hour_leave_ids' in vals:
|
||||
for leave_info in vals.get('hour_leave_ids', []):
|
||||
hours_text = leave_info[2]['number_of_hours_text']
|
||||
match = re.search(r'\d+', hours_text)
|
||||
if match:
|
||||
number_hours += float(match.group())
|
||||
valid_hours = [2, 4, 6, 8]
|
||||
if number_hours not in valid_hours:
|
||||
raise ValidationError("休假时长必须为 2、4、6 或 8 小时才可以保存!")
|
||||
return super(HolidaysRequestBatch, self).create(vals_list)
|
||||
|
||||
@api.onchange('leave_ids', 'hour_leave_ids', 'employee_id')
|
||||
def _onchange_leave_dates(self):
|
||||
|
||||
@@ -16,6 +16,7 @@ class OvertimeApprovals(models.Model):
|
||||
name = fields.Char(string="标题", compute='_compute_name')
|
||||
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('overtime_approval'))
|
||||
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
|
||||
company_id = fields.Many2one('res.company', string='公司', index=True, default=lambda self: self.env.company)
|
||||
# overtime_approval_ids = fields.One2many('overtime.user.line', 'overtime_approval_id', string="加班审批行")
|
||||
reason_application = fields.Text(string="事由")
|
||||
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
|
||||
@@ -50,14 +51,18 @@ class OvertimeApprovals(models.Model):
|
||||
else:
|
||||
rec.duration = 0.0
|
||||
|
||||
# @api.model_create_multi
|
||||
# def create(self, vals_list):
|
||||
# for vals in vals_list:
|
||||
# if vals.get('yuthon_company') == 'thwg':
|
||||
# if vals.get('duration'):
|
||||
# if (vals['duration']) % 1 != 0.5:
|
||||
# raise ValidationError("时长不对!请重新编辑")
|
||||
# return super(OvertimeApprovals, self).create(vals_list)
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
company_id = vals.get('company_id')
|
||||
if company_id:
|
||||
company = self.env['res.company'].browse(company_id)
|
||||
has_tianhe_property = any(child.name == '天河物管' for child in company.child_ids)
|
||||
if has_tianhe_property:
|
||||
if vals.get('duration'):
|
||||
if (vals['duration']) % 1 != 0.5:
|
||||
raise ValidationError("时长不对!请重新编辑")
|
||||
return super(OvertimeApprovals, self).create(vals_list)
|
||||
|
||||
@api.onchange('is_issues')
|
||||
def _onchange_is_issues(self):
|
||||
@@ -105,12 +110,17 @@ class OvertimeApprovals(models.Model):
|
||||
}))
|
||||
over.overtime_user_ids = users_data_list
|
||||
|
||||
# @api.onchange('yuthon_company')
|
||||
# def onchange_company(self):
|
||||
# for record in self:
|
||||
# overtime_id = record.env['overtime.page'].search([('yuthon_company', '=', record.yuthon_company)])
|
||||
# record.details = (f"1、每天加班不得超过{overtime_id.day_time}\n"
|
||||
# f"2、每月加班不得超过{overtime_id.month_time}\n")
|
||||
@api.onchange('company_id')
|
||||
def onchange_company(self):
|
||||
for record in self:
|
||||
if record.company_id:
|
||||
# 根据 company_id 搜索 overtime.page 模型中的记录
|
||||
overtime_id = record.env['overtime.page'].search([('company_id', '=', record.company_id.id)], limit=1)
|
||||
if overtime_id:
|
||||
record.details = (f"1、每天加班不得超过{overtime_id.day_time}\n"
|
||||
f"2、每月加班不得超过{overtime_id.month_time}\n")
|
||||
else:
|
||||
record.details = ""
|
||||
|
||||
def put_hr_employee(self):
|
||||
for record in self:
|
||||
|
||||
@@ -10,3 +10,4 @@ class OvertimePage(models.Model):
|
||||
day_time = fields.Char(string="工作日加班时间不超过")
|
||||
month_time = fields.Char(string="公休日和节假日不超过")
|
||||
year_time = fields.Char(string="每月合计不超过")
|
||||
company_id = fields.Many2one('res.company', string='公司', index=True, default=lambda self: self.env.company)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="company_id"/>
|
||||
<field name="department_id"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -8,8 +8,6 @@ class YuthonHrDepartment(models.Model):
|
||||
_rec_name = 'name'
|
||||
_order = 'department_code asc'
|
||||
|
||||
|
||||
|
||||
department_phone = fields.Char(string="部门电话")
|
||||
department_fax = fields.Char(string="部门传真")
|
||||
department_location = fields.Char(string="部门地址")
|
||||
|
||||
@@ -187,21 +187,18 @@
|
||||
<menuitem id="yuthon_notice_menu_config_root"
|
||||
name="通知公告"
|
||||
web_icon="yuthon_notice,static/description/icon.png"
|
||||
groups="group_notice_admin"
|
||||
sequence="1"/>
|
||||
|
||||
<menuitem id="yuthon_notice_menu1"
|
||||
parent="yuthon_notice_menu_config_root"
|
||||
name="通知公告"
|
||||
action="approval_notice_action"
|
||||
groups="group_notice_admin"
|
||||
sequence="1"/>
|
||||
|
||||
<menuitem id="yuthon_notice_my_menu"
|
||||
parent="yuthon_notice_menu_config_root"
|
||||
name="通知公告管理"
|
||||
action="approval_notice_action2"
|
||||
groups="group_notice_admin"
|
||||
sequence="2"/>
|
||||
|
||||
</odoo>
|
||||
@@ -71,6 +71,7 @@
|
||||
'wizard/property_contract_wizard.xml',
|
||||
'wizard/property_physical_wizard_views.xml',
|
||||
'wizard/choose_contract_wizard_views.xml',
|
||||
'wizard/rental_scheme_wizard_views.xml',
|
||||
'wizard/property_reconciliation_wizard_views.xml',
|
||||
'wizard/property_rental_wizard_views.xml',
|
||||
'views/property_menu_all.xml',
|
||||
|
||||
@@ -26,7 +26,7 @@ class YuthonTaskApproval(models.Model):
|
||||
default='normal')
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
work_end = fields.Boolean(string="结束")
|
||||
duration = fields.Float(string="时长", store=True)
|
||||
duration = fields.Float(string="时长", store=True, compute='_compute_duration')
|
||||
concentration = fields.Float(string="浓度")
|
||||
warning_value = fields.Float(string="警戒值")
|
||||
number = fields.Integer(string="数量")
|
||||
@@ -35,4 +35,15 @@ class YuthonTaskApproval(models.Model):
|
||||
def _get_default_name_title(self):
|
||||
return self._description if self._description else self._name
|
||||
|
||||
name_title = fields.Char(default=_get_default_name_title)
|
||||
name_title = fields.Char(default=_get_default_name_title)
|
||||
|
||||
@api.depends('task_start_time', 'task_end_time')
|
||||
def _compute_duration(self):
|
||||
for record in self:
|
||||
if record.task_start_time and record.task_end_time:
|
||||
start = fields.Datetime.to_datetime(record.task_start_time)
|
||||
end = fields.Datetime.to_datetime(record.task_end_time)
|
||||
delta = end - start
|
||||
record.duration = delta.total_seconds() / 3600
|
||||
else:
|
||||
record.duration = 0
|
||||
@@ -3,36 +3,30 @@
|
||||
<menuitem id='menu_yuthon_will_task'
|
||||
name='日程'
|
||||
web_icon="yuthon_will_task,static/description/icon.png"
|
||||
groups="group_yuthon_will_task_user"
|
||||
sequence='10'/>
|
||||
<menuitem id='menu_yuthon_will_task_root'
|
||||
name='我的日程'
|
||||
parent='menu_yuthon_will_task'
|
||||
action='view_yuthon_will_task_action'
|
||||
groups="group_yuthon_will_task_user"
|
||||
sequence='1'/>
|
||||
<menuitem id='menu_yuthon_will_task_root21'
|
||||
name='领导日程'
|
||||
parent='menu_yuthon_will_task'
|
||||
action='view_yuthon_will_task_action21'
|
||||
groups="group_yuthon_will_task_leader"
|
||||
sequence='2'/>
|
||||
<menuitem id='menu_yuthon_will_task_root4'
|
||||
name='全部领导日程'
|
||||
parent='menu_yuthon_will_task'
|
||||
action='view_yuthon_will_task_action4'
|
||||
groups="group_yuthon_will_task_leader"
|
||||
sequence='8'/>
|
||||
<menuitem id='menu_yuthon_will_task_roo3'
|
||||
name='全部日程'
|
||||
parent='menu_yuthon_will_task'
|
||||
action='view_yuthon_will_task_action3'
|
||||
groups="group_yuthon_will_task_leader"
|
||||
sequence='10'/>
|
||||
<menuitem id="task_type_menu"
|
||||
name="配置"
|
||||
parent="menu_yuthon_will_task"
|
||||
groups="group_yuthon_will_task_leader"
|
||||
sequence="100"/>
|
||||
<menuitem id="task_type_setting_menu"
|
||||
name="任务类型"
|
||||
|
||||
@@ -452,91 +452,76 @@
|
||||
<menuitem id="yuthon_accounts_receivable_menu"
|
||||
sequence="1"
|
||||
name="应收账单"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_financial_management_menu"
|
||||
action="yuthon_property.property_accounts_receivable_action"/>
|
||||
<menuitem id="yuthon_subject_form_menu"
|
||||
sequence="5"
|
||||
name="预算科目表"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_financial_management_menu"
|
||||
action="yuthon_property.view_property_subject_action"/>
|
||||
<menuitem id="yuthon_bank_statement_menu"
|
||||
sequence="20"
|
||||
name="对账"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_financial_management_menu"
|
||||
action="yuthon_property.view_property_bank_statements_action"/>
|
||||
<menuitem id="yuthon_bank_statement_menu1"
|
||||
sequence="23"
|
||||
name="银行流水"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_financial_management_menu"
|
||||
action="yuthon_property.view_property_bank_statements_action1"/>
|
||||
<!--财务报表 -->
|
||||
<menuitem id="yuthon_property_process"
|
||||
sequence="90"
|
||||
name="流程"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_financial_management_menu"/>
|
||||
<menuitem id="yuthon_property_fee_adjust"
|
||||
sequence="3"
|
||||
name="费用调整"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_property_process"
|
||||
action="yuthon_property_approval.property_record_action"/>
|
||||
<menuitem id="yuthon_property_rent_relief"
|
||||
sequence="5"
|
||||
name="租金减免"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_property_process"
|
||||
action="yuthon_property_approval.property_rent_relief_action"/>
|
||||
<menuitem id="yuthon_property_penalty_relief"
|
||||
sequence="7"
|
||||
name="违约金减免"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_property_process"
|
||||
action="yuthon_property_approval.property_penalty_relief_action"/>
|
||||
<menuitem id="yuthon_property_renovation_application"
|
||||
sequence="11"
|
||||
name="装修申请"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_property_process"
|
||||
action="yuthon_property_approval.property_fitment_action"/>
|
||||
<menuitem id="yuthon_property_increase_application"
|
||||
sequence="13"
|
||||
name="增容申请"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_property_process"
|
||||
action="yuthon_property_approval.property_capacity_action"/>
|
||||
<menuitem id="yuthon_property_management_fee_adjustments"
|
||||
sequence="15"
|
||||
name="管理费调整"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_property_process"
|
||||
action="yuthon_property_approval.property_management_fee_action"/>
|
||||
<menuitem id="yuthon_property_penalty_tweaks"
|
||||
sequence="17"
|
||||
name="违约金比例调整"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_property_process"
|
||||
action="yuthon_property_approval.property_penalty_proportion_action"/>
|
||||
<menuitem id="property_reimbursement_form_menu"
|
||||
sequence="19"
|
||||
name="体检费报销单"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_property_process"
|
||||
action="yuthon_property_approval.view_property_reimbursement_form_action"/>
|
||||
<menuitem id="property_claim_form_menu"
|
||||
sequence="20"
|
||||
name="业务报销单"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_property_process"
|
||||
action="yuthon_property_approval.view_property_claim_approval_action"/>
|
||||
<menuitem id="property_borrowing_approval_menu"
|
||||
sequence="21"
|
||||
name="借支申请表"
|
||||
groups="yuthon_property.group_account_user"
|
||||
parent="yuthon_property_process"
|
||||
action="yuthon_property_approval.view_property_borrowing_approval_action"/>
|
||||
<menuitem id="yuthon_property_process_setting"
|
||||
@@ -546,13 +531,11 @@
|
||||
<menuitem id="yuthon_property_account_setting_menu"
|
||||
sequence="1"
|
||||
name="账户设置"
|
||||
groups="yuthon_property.group_account_admin"
|
||||
parent="yuthon_property_process_setting"
|
||||
action="yuthon_property.yuthon_property_account_setting_action"/>
|
||||
<menuitem id="yuthon_property_project_setting_menu"
|
||||
sequence="5"
|
||||
name="费用项目"
|
||||
groups="yuthon_property.group_account_admin"
|
||||
parent="yuthon_property_process_setting"
|
||||
action="yuthon_property.yuthon_property_project_setting_action"/>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user