From 67da938400a5ff8926ea3080767aa07268b8fdfe Mon Sep 17 00:00:00 2001 From: ljmwkx <1340053001@qq.com> Date: Mon, 3 Mar 2025 17:50:48 +0800 Subject: [PATCH 1/6] 1 --- .../models/hr_attendance_detail_wechat.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py index 6a365a312..39142b909 100644 --- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py +++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py @@ -467,7 +467,7 @@ class HrAttendanceDetail(models.Model): min_time = min(checkin_time_list) # 查询最早时间上班时间 查询最晚下班时间 # 判断时间 在10分钟内说明是 异常 - if will_datetime_start + timedelta(minutes=10) > min_time > will_datetime_start: + if will_datetime_start + timedelta(minutes=10) > min_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": min_time, @@ -476,7 +476,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, "absenteeism_card": False, }) - elif will_datetime_start + timedelta(hours=1) > min_time > will_datetime_start: + elif will_datetime_start + timedelta(hours=1) > min_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": min_time, @@ -485,7 +485,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": False, "absenteeism_card": False, }) - elif min_time > will_datetime_start + timedelta(hours=1) and min_time > will_datetime_start: + elif min_time > will_datetime_start + timedelta(hours=1) and min_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": min_time, @@ -553,7 +553,7 @@ class HrAttendanceDetail(models.Model): max_time = max(checkin_time_list) # 如果上班没有打卡 if not attendance_obj.check_in: - if will_datetime_start + timedelta(minutes=10) > max_time > will_datetime_start: + if will_datetime_start + timedelta(minutes=10) > max_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": max_time, @@ -562,7 +562,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, "absenteeism_card": True, }) - elif will_datetime_start + timedelta(hours=1) > max_time > will_datetime_start: + elif will_datetime_start + timedelta(hours=1) > max_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": max_time, @@ -571,7 +571,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, "absenteeism_card": True, }) - elif max_time > will_datetime_start + timedelta(hours=1) and max_time > will_datetime_start: + elif max_time > will_datetime_start + timedelta(hours=1) and max_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": max_time, @@ -594,7 +594,7 @@ class HrAttendanceDetail(models.Model): elif attendance_obj.check_in >= max_time: attendance_obj.sudo().write({"is_no_card": True, "is_abnormal": True, "absenteeism_card": True}) else: - if will_datetime_end - timedelta(minutes=10) < max_time < will_datetime_end: + if will_datetime_end - timedelta(minutes=10) < max_time < will_datetime_end - timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_out_time": will_datetime_end, "check_out": max_time, @@ -603,7 +603,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, # "absenteeism_card": False, }) - elif will_datetime_end - timedelta(hours=1) < max_time < will_datetime_end: + elif will_datetime_end - timedelta(hours=1) < max_time < will_datetime_end - timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_out_time": will_datetime_end, "check_out": max_time, From 01269179ca89b98461c9f21de654edb470eef869 Mon Sep 17 00:00:00 2001 From: ljmwkx <1340053001@qq.com> Date: Mon, 3 Mar 2025 17:52:24 +0800 Subject: [PATCH 2/6] 1 --- .../models/hr_attendance_detail_wechat.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py index 39142b909..419e5ca56 100644 --- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py +++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py @@ -718,7 +718,7 @@ class HrAttendanceDetail(models.Model): # "is_no_card": False, # "is_abnormal": False, # }) - if will_datetime_start + timedelta(minutes=10) > min_time > will_datetime_start: + if will_datetime_start + timedelta(minutes=10) > min_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": min_time, @@ -727,7 +727,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, "absenteeism_card": False, }) - elif will_datetime_start + timedelta(hours=1) > min_time > will_datetime_start: + elif will_datetime_start + timedelta(hours=1) > min_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": min_time, @@ -736,7 +736,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": False, "absenteeism_card": False, }) - elif min_time > will_datetime_start + timedelta(hours=1) and min_time > will_datetime_start: + elif min_time > will_datetime_start + timedelta(hours=1) and min_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": min_time, @@ -786,7 +786,7 @@ class HrAttendanceDetail(models.Model): # "is_abnormal": True, # }) - if will_datetime_start + timedelta(minutes=10) > max_time > will_datetime_start: + if will_datetime_start + timedelta(minutes=10) > max_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": max_time, @@ -795,7 +795,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, "absenteeism_card": True, }) - elif will_datetime_start + timedelta(hours=1) > max_time > will_datetime_start: + elif will_datetime_start + timedelta(hours=1) > max_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": max_time, @@ -804,7 +804,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, "absenteeism_card": True, }) - elif max_time > will_datetime_start + timedelta(hours=1) and max_time > will_datetime_start: + elif max_time > will_datetime_start + timedelta(hours=1) and max_time > will_datetime_start + timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": max_time, @@ -833,7 +833,7 @@ class HrAttendanceDetail(models.Model): # "is_no_card": False, # "is_abnormal": False, # }) - if will_datetime_end - timedelta(minutes=10) < max_time < will_datetime_end: + if will_datetime_end - timedelta(minutes=10) < max_time < will_datetime_end - timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_out_time": will_datetime_end, "check_out": max_time, @@ -842,7 +842,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, # "absenteeism_card": False, }) - elif will_datetime_end - timedelta(hours=1) < max_time < will_datetime_end: + elif will_datetime_end - timedelta(hours=1) < max_time < will_datetime_end - timedelta(minutes=1): attendance_obj.sudo().write({ "sch_check_out_time": will_datetime_end, "check_out": max_time, From 2606ee0541dd423a576e5fc59afea91cc2a42123 Mon Sep 17 00:00:00 2001 From: ljmwkx <1340053001@qq.com> Date: Mon, 3 Mar 2025 17:53:10 +0800 Subject: [PATCH 3/6] 1 --- .../models/hr_attendance_detail_wechat.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py index 419e5ca56..39142b909 100644 --- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py +++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py @@ -718,7 +718,7 @@ class HrAttendanceDetail(models.Model): # "is_no_card": False, # "is_abnormal": False, # }) - if will_datetime_start + timedelta(minutes=10) > min_time > will_datetime_start + timedelta(minutes=1): + if will_datetime_start + timedelta(minutes=10) > min_time > will_datetime_start: attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": min_time, @@ -727,7 +727,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, "absenteeism_card": False, }) - elif will_datetime_start + timedelta(hours=1) > min_time > will_datetime_start + timedelta(minutes=1): + elif will_datetime_start + timedelta(hours=1) > min_time > will_datetime_start: attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": min_time, @@ -736,7 +736,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": False, "absenteeism_card": False, }) - elif min_time > will_datetime_start + timedelta(hours=1) and min_time > will_datetime_start + timedelta(minutes=1): + elif min_time > will_datetime_start + timedelta(hours=1) and min_time > will_datetime_start: attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": min_time, @@ -786,7 +786,7 @@ class HrAttendanceDetail(models.Model): # "is_abnormal": True, # }) - if will_datetime_start + timedelta(minutes=10) > max_time > will_datetime_start + timedelta(minutes=1): + if will_datetime_start + timedelta(minutes=10) > max_time > will_datetime_start: attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": max_time, @@ -795,7 +795,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, "absenteeism_card": True, }) - elif will_datetime_start + timedelta(hours=1) > max_time > will_datetime_start + timedelta(minutes=1): + elif will_datetime_start + timedelta(hours=1) > max_time > will_datetime_start: attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": max_time, @@ -804,7 +804,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, "absenteeism_card": True, }) - elif max_time > will_datetime_start + timedelta(hours=1) and max_time > will_datetime_start + timedelta(minutes=1): + elif max_time > will_datetime_start + timedelta(hours=1) and max_time > will_datetime_start: attendance_obj.sudo().write({ "sch_check_in_time": will_datetime_start, "check_in": max_time, @@ -833,7 +833,7 @@ class HrAttendanceDetail(models.Model): # "is_no_card": False, # "is_abnormal": False, # }) - if will_datetime_end - timedelta(minutes=10) < max_time < will_datetime_end - timedelta(minutes=1): + if will_datetime_end - timedelta(minutes=10) < max_time < will_datetime_end: attendance_obj.sudo().write({ "sch_check_out_time": will_datetime_end, "check_out": max_time, @@ -842,7 +842,7 @@ class HrAttendanceDetail(models.Model): "is_abnormal": True, # "absenteeism_card": False, }) - elif will_datetime_end - timedelta(hours=1) < max_time < will_datetime_end - timedelta(minutes=1): + elif will_datetime_end - timedelta(hours=1) < max_time < will_datetime_end: attendance_obj.sudo().write({ "sch_check_out_time": will_datetime_end, "check_out": max_time, From 595a2b82f5bbd1e5fdd69997dfe5aaef11930695 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Mon, 3 Mar 2025 18:05:30 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/yuthon_onboard_approval.py | 2 +- .../models/property_bank_statements.py | 15 ++++++- .../wizard/property_statements_wizard.py | 43 +++++++++++-------- .../views/inherit_yuthon_property_views.xml | 2 +- 4 files changed, 39 insertions(+), 23 deletions(-) diff --git a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py index 28d42f7df..a3debf01a 100644 --- a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py @@ -26,7 +26,7 @@ class YuthonOnboardApproval(models.Model): employee_name = fields.Char(string='姓名') 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="部门") - yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), + yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('ttcj','天投城建'), ('thlc', '天河粮储')], string="甲方") account = fields.Char(string='账号') reason = fields.Html(string="正文") diff --git a/yuthon_property/models/property_bank_statements.py b/yuthon_property/models/property_bank_statements.py index 243c07292..d789967da 100644 --- a/yuthon_property/models/property_bank_statements.py +++ b/yuthon_property/models/property_bank_statements.py @@ -21,10 +21,21 @@ class PropertyBankStatements(models.Model): def button_reconciliation(self): - pass + for rec in self: + receivable_id = self.env['property.accounts.receivable'].search([('property_id', '=', rec.property_id.id)]) + if receivable_id: + difference_amount = receivable_id.original_amount - rec.original_amount + receivable_id.write({'is_reconciliation': True, + 'difference_amount': difference_amount}) def button_all_reconciliation(self): - pass + statements_ids = self.env["property.bank.statements"].browse(self._context.get('active_ids', self._context.get('active_id'))) + for statements_id in statements_ids: + receivable_id = self.env['property.accounts.receivable'].search([('property_id', '=', statements_id.property_id.id)]) + if receivable_id: + difference_amount = receivable_id.original_amount - statements_id.original_amount + receivable_id.write({'is_reconciliation': True, + 'difference_amount': difference_amount}) def unlink(self): return super().unlink() \ No newline at end of file diff --git a/yuthon_property/wizard/property_statements_wizard.py b/yuthon_property/wizard/property_statements_wizard.py index f990cdd9b..7bd6481d3 100644 --- a/yuthon_property/wizard/property_statements_wizard.py +++ b/yuthon_property/wizard/property_statements_wizard.py @@ -27,33 +27,38 @@ class PropertyStatementsWizard(models.Model): self.property_bank_statements_data(row) def property_bank_statements_data(self, row): - if row[0].value: - start_time = pd.to_datetime(row[0].value, unit='d', origin='1899-12-30') + if row[2].value: + start_time = pd.to_datetime(row[2].value, unit='d', origin='1899-12-30') else: start_time = None + name = row[0].value company_id = self.env['yuthon.property.company'].search([('name', '=', row[1].value)]) - name = row[2].value - name_account = row[3].value - remake = row[4].value - original_amount = row[5].value - contract_id = self.env['property.lease.contract'].search([('name', '=', row[6].value)]) - property_id = self.env['yuthon.property'].search([('name', '=', row[7].value)]) - contract_account = row[8].value - contract_penalty = row[9].value - voucher_type = row[10].value + name_account = row[7].value + voucher_type = row[15].value voucher_type_dict = {'电子转账凭证': 'electronic_transfer', '电汇凭证': 'telegraphic_transfer'} voucher_type = voucher_type_dict.get(voucher_type) + if name: + bank_id = self.env['property.bank.line'].search([('bank', '=', name)]) + if bank_id: + contract_id = self.env['property.lease.contract'].search([('lessee_id', '=', bank_id.tenant_id.id)]) + if contract_id: + lease_id = contract_id.lease_ids[0].address_id + else: + lease_id = None + + else: + contract_id = None + lease_id = None + else: + contract_id = None + lease_id = None bank_data = { - 'name':name, - 'start_time':start_time, + 'name': name, + 'contract_id':contract_id.id if contract_id else None, + 'property_id':lease_id.id if lease_id else None, 'company_id': company_id.id, + 'start_time': start_time, 'name_account': name_account, - 'remake': remake, - 'original_amount': original_amount, - 'contract_id': contract_id.id, - 'property_id': property_id.id, - 'contract_account': contract_account, - 'contract_penalty': contract_penalty, 'voucher_type': voucher_type } self.env['property.bank.statements'].create(bank_data) diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml index 01ccb8e84..9123e18d6 100644 --- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml +++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml @@ -335,7 +335,7 @@ -