diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index c17fd5576..f134cd0e8 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -214,7 +214,7 @@ class HrAttendance(models.Model): # 保安部 - 白班 def ba_card_white_up(self): ba_up_users = self.env['planning.slot'].search( - [('role_id.name', '=', '保安部'), ('template_id.planning_name', '=', '白班')]) + [('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({ @@ -226,7 +226,7 @@ class HrAttendance(models.Model): def ba_card_white_down(self): ba_up_users = self.env['planning.slot'].search( - [('role_id.name', '=', '保安部'), ('template_id.planning_name', '=', '白班')]) + [('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({ diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index fdc9b65f8..0a85c6ed4 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -3,7 +3,7 @@ import pandas as pd import calendar from dateutil.relativedelta import relativedelta -from datetime import datetime, timedelta +from datetime import datetime, timedelta, date from odoo.tools.float_utils import float_round from numpy.ma.core import default_filler @@ -74,6 +74,11 @@ class PropertyLeaseContract(models.Model): term_start_time = fields.Date(string="开始时间", default=fields.Datetime.now) term_start_month_day = fields.Char(string="开始时间", compute="_compute_term_start_month_day") term_end_time = fields.Date(string="结束时间") + actual_start_time = fields.Date(string="实际开始时间") + actual_end_time = fields.Date(string="实际结束时间", default=fields.Datetime.now) + end_comparison = fields.Selection([('red', '红'),('yellow', '黄'),('blue', '蓝')], string="结束时间对比", compute='_compute_end_comparison', store=True) + is_equal = fields.Boolean(string="是否相等", compute='_compute_end_comparison', store=True) + term_end_month_day = fields.Char(string="结束时间", compute="_compute_term_end_month_day") cycle_dict =fields.Selection([('monthly','月度'), ('quarter','季度'), ('half','半年'),('year','年度')],string='付款方式', default='monthly', help="应收") cycle_mode = fields.Selection([('fixed_monthly','合同月'), ('floating_monthly','自然月'), ('fixed_quarter', '合同季'), ('floating_quarter', '自然季'), @@ -103,6 +108,7 @@ class PropertyLeaseContract(models.Model): first_pay = fields.Date(string="首次付款日") unit_price = fields.Float(string="单价") deposit_type = fields.Selection([('deposit', '押金'), ('performance', '履约保证金')], string="押金/履约保证金") + deposit_status = fields.Selection([('unpaid', '未支付'), ('paid', '已支付'), ('returned','已退'),('no_paid', '没收')], string='押金状态') deposit = fields.Float(string="押金/履约保证金", store=True) performance_bonds_write = fields.Char(string="履约保证金大写") first_year_rent = fields.Float(string="首年租金") @@ -120,8 +126,9 @@ class PropertyLeaseContract(models.Model): total_area = fields.Float(string="总面积", digits=(16, 4)) not_received = fields.Float(string="未收") actual_receivable = fields.Float(string="实际应收") - now_receivable = fields.Float(string="当前应收") + now_receivable = fields.Float(string="当期应收") total_receivable = fields.Float(string="总已收") + comparison = fields.Selection([('outweigh','大于'),('equal','等于'),('less','小于')], string="对比", compute='_compute_comparison', store=True) progress_percentage = fields.Float(string="合同进度", compute="_compute_progress_percentage") condition = fields.Selection([('new', '新建'),('approval','审批'),('cancel','作废')], string="状态", default='new') message_type = fields.Selection([('be_executed','待执行'), ('executed','已执行'), ('expired','已终止'), ('advance','提前终止')], string="合同状态") @@ -149,6 +156,35 @@ class PropertyLeaseContract(models.Model): responsibility_book_id = fields.Many2one('ir.attachment', string="安全生产责任书") handover_time = fields.Date(string="交接日期") + @api.depends('not_received', 'now_receivable') + def _compute_comparison(self): + for record in self: + if record.not_received and record.now_receivable: + if record.not_received > record.now_receivable: + record.comparison = 'outweigh' + elif record.not_received < record.now_receivable: + record.comparison = 'less' + else: + record.comparison = 'equal' + + @api.depends('term_end_time', 'actual_end_time', 'term_start_time') + def _compute_end_comparison(self): + for record in self: + if record.term_end_time and record.actual_end_time and record.term_start_time: + delta = record.term_end_time - record.actual_end_time + if 60<= abs(delta.days) < 90: + record.end_comparison = 'blue' + elif 30<= abs(delta.days) < 60: + record.end_comparison = 'yellow' + elif 30 > abs(delta.days): + record.end_comparison = 'red' + else: + record.end_comparison = None + if record.actual_end_time == record.term_start_time: + record.is_equal = True + else: + record.end_comparison = None + @api.depends('term_start_time') def _compute_term_start_month_day(self): for record in self: @@ -822,7 +858,8 @@ class PropertyLeaseContract(models.Model): company_id = record.lease_ids[0].address_id.company_id.id if record.lease_ids else '' admin_id = record.lease_ids[0].admin_id.id if record.lease_ids else '' record.write({'company_id': company_id, - 'admin_id': admin_id}) + 'admin_id': admin_id, + 'actual_end_time': datetime.now()}) def action_yuthon_property_contract_wizard(self): return { @@ -1006,7 +1043,8 @@ class PropertyLeaseContract(models.Model): if admin_id and user_id: record.write({ 'admin_id': user_id.id, - 'users_id': admin_id.id,}) + 'users_id': admin_id.id, + }) def choose_property_button(self): return { diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index aab02d0f0..e4f6d30af 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -294,23 +294,32 @@ - property.lease.contract.tree property.lease.contract - + - + + - + + - + + + @@ -371,7 +380,11 @@ + + + + @@ -438,6 +451,8 @@ + +