diff --git a/yuthon_holiday/__manifest__.py b/yuthon_holiday/__manifest__.py
index f1968c02a..5f3092d54 100644
--- a/yuthon_holiday/__manifest__.py
+++ b/yuthon_holiday/__manifest__.py
@@ -14,6 +14,7 @@
'report/hr_leave_batch_report_action.xml',
'views/inherit_hr_type_views.xml',
'views/inherit_hr_leave_allocation_views.xml',
+ 'views/extended_vacation_approval_views.xml',
'views/inherit_hr_leave_accrual_plan_views.xml',
'views/hr_leave_accrual_views.xml',
'views/yuthon_fixes_approval_views.xml',
diff --git a/yuthon_holiday/data/yuthon_holiday_data.xml b/yuthon_holiday/data/yuthon_holiday_data.xml
index e40998543..7b607a966 100644
--- a/yuthon_holiday/data/yuthon_holiday_data.xml
+++ b/yuthon_holiday/data/yuthon_holiday_data.xml
@@ -14,6 +14,13 @@
4
+
+ 修正编号
+ yuthon_extended_code
+ JQYC
+ 4
+
+
哺乳编号
yuthon_breastfeed_leave_code
diff --git a/yuthon_holiday/models/__init__.py b/yuthon_holiday/models/__init__.py
index 1bd3fb868..5bd4cf43d 100644
--- a/yuthon_holiday/models/__init__.py
+++ b/yuthon_holiday/models/__init__.py
@@ -4,4 +4,5 @@ from . import inherit_hr_leave
from . import inherit_hr_leave_accrual_plan
from . import yuthon_fixes_approval
from . import yuthon_holiday_setting
-from . import yuthon_breastfeed_leave
\ No newline at end of file
+from . import yuthon_breastfeed_leave
+from . import extended_vacation_approval
\ No newline at end of file
diff --git a/yuthon_holiday/models/extended_vacation_approval.py b/yuthon_holiday/models/extended_vacation_approval.py
new file mode 100644
index 000000000..efb32ea59
--- /dev/null
+++ b/yuthon_holiday/models/extended_vacation_approval.py
@@ -0,0 +1,91 @@
+# -*- coding: utf-8 -*-
+from email.policy import default
+
+from odoo import models, fields, api
+
+
+class ExtendedVacationApproval(models.Model):
+ _name = 'extended.vacation.approval'
+ _description = '假期延长申请'
+ _inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
+
+ name = fields.Char(string="标题")
+ code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_extended_code'))
+ users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
+ department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
+ employee_ids = fields.Many2many('hr.employee', string="假期顺延人员")
+ type_vacations_ids = fields.Many2many('hr.leave.type', string="假期类型")
+ is_issues = fields.Boolean(string='是否上会')
+ issues_result = fields.Html(string="会议结果")
+ related_issues_id = fields.Many2one('issue.library', string="关联议题")
+ reason_application = fields.Text(string="申请事由")
+ documents_ids = fields.Many2many('ir.attachment', string="附件")
+ date_postponed = fields.Date(string="延期至")
+ active = fields.Boolean('Active', default=True, tracking=True)
+ remarks = fields.Text(string="备注")
+ work_end = fields.Boolean(string="结束")
+ urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
+ default='normal')
+ line_ids = fields.One2many('extended.vacation.line', 'vacation_id', string="延期假期")
+
+ def _get_default_name_title(self):
+ return self._description if self._description else self._name
+ name_title = fields.Char(default=_get_default_name_title)
+ self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])])
+
+ @api.onchange('employee_ids')
+ def _onchange_employee_ids(self):
+ if not self.employee_ids:
+ self.line_ids = [(5, 0, 0)]
+ return
+ current_date = fields.Date.today()
+ target_date = fields.Date.to_date(f"{current_date.year}-{current_date.month}-01")
+ self.line_ids = [(5, 0, 0)]
+ line_values = []
+ for employee in self.employee_ids:
+ report_record = self.env['yuthon.vacation.reports'].search([
+ ('employee_id', '=', employee.id.origin),
+ ('vacation_date', '=', target_date)
+ ], limit=1)
+ line_data = {
+ 'employee_id': employee.id,
+ 'dynamic_previous_year': report_record.dynamic_previous_year if report_record else 0.0,
+ 'dynamic_previous_year1': report_record.dynamic_previous_year1 if report_record else 0.0,
+ }
+ line_values.append((0, 0, line_data))
+ self.line_ids = line_values
+
+ def end_approval(self):
+ current_date = fields.Date.today()
+ start_date = fields.Date.to_date(f"{current_date.year}-01-01")
+ end_date = fields.Date.to_date(f"{current_date.year}-{current_date.month}-01")
+ if self.employee_ids:
+ has_annual_leave = self.type_vacations_ids.filtered(lambda r: r.name == '年假')
+ has_overtime_leave = self.type_vacations_ids.filtered(lambda r: r.name == '加班')
+
+ for employee in self.employee_ids:
+ report_records = self.env['yuthon.vacation.reports'].search([
+ ('employee_id', '=', employee.id.origin),
+ ('vacation_date', '>=', start_date),
+ ('vacation_date', '<=', end_date)
+ ])
+ if report_records:
+ write_vals = {}
+ if has_annual_leave:
+ write_vals['valid_date'] = self.date_postponed
+ if has_overtime_leave:
+ write_vals['valid_date1'] = self.date_postponed
+
+ if write_vals:
+ report_records.write(write_vals)
+ for record in report_records:
+ record.update_line()
+
+class ExtendedVacationLine(models.Model):
+ _name = 'extended.vacation.line'
+ _description = "假期延长明细"
+
+ vacation_id = fields.Many2one('extended.vacation.approval', string="假期延长")
+ employee_id = fields.Many2one('hr.employee', string="姓名")
+ dynamic_previous_year = fields.Float(string="上年年假剩余d", digits=(16, 3))
+ dynamic_previous_year1 = fields.Float(string="上年补休剩余d", digits=(16, 3))
\ No newline at end of file
diff --git a/yuthon_holiday/security/ir.model.access.csv b/yuthon_holiday/security/ir.model.access.csv
index 29aef657e..70ee2a65b 100644
--- a/yuthon_holiday/security/ir.model.access.csv
+++ b/yuthon_holiday/security/ir.model.access.csv
@@ -6,4 +6,6 @@ access_yuthon_fixes_wizard,yuthon_fixes_wizard,model_yuthon_fixes_wizard,base.gr
access_yuthon_holiday_setting,yuthon_holiday_setting,model_yuthon_holiday_setting,base.group_user,1,1,1,1
access_leave_allocation_wizard,leave_allocation_wizard,model_leave_allocation_wizard,base.group_user,1,1,1,1
access_yuthon_leave_wizard,yuthon_leave_wizard,model_yuthon_leave_wizard,base.group_user,1,1,1,1
-access_yuthon_breastfeed_leave,yuthon_breastfeed_leave,model_yuthon_breastfeed_leave,base.group_user,1,1,1,1
\ No newline at end of file
+access_yuthon_breastfeed_leave,yuthon_breastfeed_leave,model_yuthon_breastfeed_leave,base.group_user,1,1,1,1
+access_extended_vacation_approval,extended_vacation_approval,model_extended_vacation_approval,base.group_user,1,1,1,1
+access_extended_vacation_line,extended_vacation_line,model_extended_vacation_line,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/yuthon_holiday/views/extended_vacation_approval_views.xml b/yuthon_holiday/views/extended_vacation_approval_views.xml
new file mode 100644
index 000000000..7e01fc5e8
--- /dev/null
+++ b/yuthon_holiday/views/extended_vacation_approval_views.xml
@@ -0,0 +1,77 @@
+
+
+
+ extended.vacation.approval.tree
+ extended.vacation.approval
+
+
+
+
+
+
+
+
+ extended.vacation.approval.form
+ extended.vacation.approval
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py
index 8ad5bb1b8..40deb101c 100644
--- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py
+++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py
@@ -1365,12 +1365,21 @@ class YuthonVacationReports(models.Model):
}
rec.write(inherit_vals)
+ current_date = fields.Date.today()
if last_month_record:
+ if last_month_record.valid_date and last_month_record.valid_date < current_date:
+ dynamic_previous_year_val = 0.0
+ else:
+ dynamic_previous_year_val = last_month_record.dynamic_previous_year
+ if last_month_record.valid_date1 and last_month_record.valid_date1 < current_date:
+ dynamic_previous_year1_val = 0.0
+ else:
+ dynamic_previous_year1_val = last_month_record.dynamic_previous_year1
inherit_vals = {
'leave': last_month_record.leave,
- 'dynamic_previous_year': last_month_record.dynamic_previous_year,
+ 'dynamic_previous_year': dynamic_previous_year_val,
'dynamic_remainder_year': last_month_record.dynamic_remainder_year,
- 'dynamic_previous_year1': last_month_record.dynamic_previous_year1,
+ 'dynamic_previous_year1': dynamic_previous_year1_val,
'this_year1': last_month_record.this_year1,
'working_overtime': last_month_record.working_overtime,
'medical_fee': last_month_record.medical_fee,
diff --git a/yuthon_property/wizard/property_statements_wizard.py b/yuthon_property/wizard/property_statements_wizard.py
index 7c369f47b..41f69f7d2 100644
--- a/yuthon_property/wizard/property_statements_wizard.py
+++ b/yuthon_property/wizard/property_statements_wizard.py
@@ -11,7 +11,7 @@ class PropertyStatementsWizard(models.Model):
_name = 'property.statements.wizard'
_description = '银行流水向导弹窗'
- selection_bank = fields.Selection([('js', '建设银行'), ('gs', '工商银行'),('sh', '农商')], string="选择银行")
+ selection_bank = fields.Selection([('js', '建设银行'), ('gs', '工商银行'),('sh', '农商'), ('ms', '民生'), ('zc', '中城'), ('dj', '东进')], string="选择银行")
excel_file = fields.Binary(string="上传Excel表")
excel_name = fields.Char(string="文件名")
@@ -31,6 +31,12 @@ class PropertyStatementsWizard(models.Model):
self.property_bank_statements_gc_data(row)
elif self.selection_bank == 'sh':
self.property_bank_statements_sh_data(row)
+ elif self.selection_bank == 'ms':
+ self.property_bank_statements_ms_data(row)
+ elif self.selection_bank == 'zc':
+ self.property_bank_statements_zc_data(row)
+ elif self.selection_bank == 'dj':
+ self.property_bank_statements_dj_data(row)
def property_bank_statements_gc_data(self, row):
if row[0].value:
@@ -171,6 +177,31 @@ class PropertyStatementsWizard(models.Model):
elif original_amount:
self.env['property.bank.statements'].create(bank_data)
+ def property_bank_statements_ms_data(self, row):
+ if row[2].value:
+ start_time = datetime.strptime(row[2].value, '%Y-%m-%d %H:%M:%S')
+ else:
+ start_time = None
+ name = row[1].value
+ number = row[0].value
+ if row[3].value == "贷":
+ lending_direction = "loan"
+ elif row[3].value == "借":
+ lending_direction = "borrow"
+ name_account = row[4].value
+ bank_number = row[5].value
+ purpose = row[6].value
+ extract = row[7].value
+ remake = row[8].value
+ company_id = self.env['res.company'].search([('name', '=', '天河物管')], limit=1)
+ pass
+
+ def property_bank_statements_zc_data(self, row):
+ pass
+
+ def property_bank_statements_dj_data(self, row):
+ pass
+
def classify_by_last_four(self, input_str):
if not isinstance(input_str, str) or len(input_str) < 4: