diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py index 8fe8f2e63..3bba658fc 100644 --- a/yuthon_purchase/models/inherit_purchase_order.py +++ b/yuthon_purchase/models/inherit_purchase_order.py @@ -22,6 +22,7 @@ class PurchaseOrder(models.Model): active = fields.Boolean('Active', default=True, tracking=True) pay_way = fields.Selection([('onetime', '一次性'), ('installment', '分期')], string='付款方式', default='onetime') purchase_order_models_ids = fields.One2many('purchase.order.pay.line', 'purchase_id', string="付款详情") + work_end = fields.Boolean(string="结束") def _get_default_name_title(self): return self._description if self._description else self._name diff --git a/yuthon_salary/models/inherit_hr_payroll_structure.py b/yuthon_salary/models/inherit_hr_payroll_structure.py index 1fcabeeed..d3e90bfe0 100644 --- a/yuthon_salary/models/inherit_hr_payroll_structure.py +++ b/yuthon_salary/models/inherit_hr_payroll_structure.py @@ -236,6 +236,16 @@ class HrPayrollStructure(models.Model): for payroll in payroll_ids: payroll.renk_log_ids.unlink() + def onetime(self): + payroll_ids = self.env["hr.payroll.structure"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + for payroll in payroll_ids: + create_time = payroll.renk_log_ids[-1].effective_date + payroll.write({ + 'create_time': create_time, + }) + + def rank_log_time(self): """定时任务:根据日志记录的生效时间更新主模型字段值""" # 出发一下 @@ -251,9 +261,13 @@ class HrPayrollStructure(models.Model): 'base_salary': latest_log.base_salary, 'rank_salary': latest_log.rank_salary, 'communication_subsidy': latest_log.communication_subsidy, + 'create_time': latest_log.effective_date, 'position_salary': latest_log.position_salary, 'advance_performance_bonuses': latest_log.advance_performance_bonuses, }) + other_logs = valid_logs - latest_log + if other_logs: + other_logs.sudo().write({'is_enable': False}) class RankLogLine(models.Model): _name = 'rank.log.line' diff --git a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml index 2a420f82a..24236af8c 100644 --- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml +++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml @@ -170,4 +170,11 @@ code action = model.empty_the_log() + + 一次性 + + + code + action = model.onetime() + \ No newline at end of file