From 7826bf1b714e144deecad88d63c6b0721a9803a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Sun, 3 Aug 2025 16:39:28 +0800 Subject: [PATCH 1/2] 1 --- soong_workflow/models/soong_workflow_log.py | 2 +- soong_workflow/models/soong_workflow_mixin.py | 12 +- .../templates/soong_workflow_templates.xml | 116 ++++++++++-------- 3 files changed, 71 insertions(+), 59 deletions(-) diff --git a/soong_workflow/models/soong_workflow_log.py b/soong_workflow/models/soong_workflow_log.py index 52b6c9bde..82df3e152 100644 --- a/soong_workflow/models/soong_workflow_log.py +++ b/soong_workflow/models/soong_workflow_log.py @@ -20,7 +20,7 @@ class SoongWorkflowLog(models.Model): workflow_id = fields.Many2one(comodel_name="soong.workflow") node_id = fields.Many2one(comodel_name="soong.workflow.node") node_btn_id = fields.Many2one(comodel_name="soong.workflow.node.button", string="动作名称") - node_btn_name = fields.Selection([('0', ' '), ('1', '退回'), ('2', '加签'), ('3', '串'), ('4', '并')], string='节点功能', default='0') + node_btn_name = fields.Selection([('0', ' '), ('1', '退回'), ('2', '加签'), ('3', '串'), ('4', '并')], store=True, string='节点功能', default='0') done_by = fields.Many2one(comodel_name="res.users", string="审批人") lase_click_date = fields.Datetime(string="操作时间") approval_state = fields.Selection([('0', '待办'), ('1', '办理中'), ('2', '已办结'), ('3', '结束')], string='状态', default='0') diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index c8f91c1a2..c6954d7e1 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -533,10 +533,10 @@ class SoongWorkflowMixin(models.AbstractModel): # res = self._load_one2many_views(view_type, res) res = self._update_fields_view(view_type, res) # res = self._add_state_tree_view(view_type, res) - if self.env.user.has_group("soong_workflow.group_soong_workflow_manager"): - res = self._add_soong_workflow_log_manager(view_type, res, params) - else: - res = self._add_soong_workflow_log(view_type, res, params) + # if self.env.user.has_group("soong_workflow.group_soong_workflow_manager"): + res = self._add_soong_workflow_log_manager(view_type, res, params) + # else: + # res = self._add_soong_workflow_log(view_type, res, params) res = self._load_sign_view(view_type, res) # res = self._load_workflow_approver_view(view_type, res) return res @@ -1056,9 +1056,7 @@ class SoongWorkflowMixin(models.AbstractModel): all_models = res["models"].copy() for node in doc.xpath("/form/sheet"): # _add_tier_validation_reviews process - str_element = self.env["ir.qweb"]._render( - "soong_workflow.soong_workflow_log_manager", params - ) + str_element = self.env["ir.qweb"]._render("soong_workflow.soong_workflow_log_manager", params) new_node = etree.fromstring(str_element) new_arch, new_models = View.postprocess_and_fields(new_node, self._name) for model in new_models: diff --git a/soong_workflow/templates/soong_workflow_templates.xml b/soong_workflow/templates/soong_workflow_templates.xml index 806bb9af0..a48440704 100644 --- a/soong_workflow/templates/soong_workflow_templates.xml +++ b/soong_workflow/templates/soong_workflow_templates.xml @@ -2,7 +2,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a57370f099504c2eca269e77549c92b7c571f54f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Sun, 3 Aug 2025 18:09:56 +0800 Subject: [PATCH 2/2] 1 --- yuthon_holiday/models/inherit_hr_leave.py | 2 +- .../wizard/property_reconciliation_wizard.py | 29 ++++++------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index 56449bd23..6fd7a1ed7 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -626,7 +626,7 @@ class HolidaysRequestBatch(models.Model): def _compute_holiday_allowance(self): for record in self: reports_id = self.env['yuthon.vacation.reports'].search([('employee_id', '=', record.users_id.employee_id.id)], limit=1) - if reports_id: + if reports_id and not record.log_ids: leave_hours_str = reports_id.leave.split('小时')[0].strip() leave_hours = float(leave_hours_str) leave_days = leave_hours / 8 diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 8a5b48ebd..8f1bf00e8 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -10,16 +10,16 @@ class PropertyReconciliationWizard(models.Model): receivable_total = fields.Float(string='应收金额') bank_id = fields.Many2one('property.bank.statements', string='银行流水') account = fields.Char(string='账号') - amount_been_reconciled = fields.Float(string='已对金额', compute="_compute_amount", store=True) - amount_reconciled = fields.Float(string='未对金额', compute="_compute_amount", store=True) + amount_been_reconciled = fields.Float(string='已对金额', store=True) + amount_reconciled = fields.Float(string='未对金额', store=True) actual_total = fields.Float(string='实收金额') actual_date = fields.Date(string='实收日期') initial_total = fields.Float(string='初始金额', default=0.0) reconciliation_line_ids = fields.One2many('property.reconciliation.line', 'reconciliation_id', string='对账明细') - @api.depends('reconciliation_line_ids') - def _compute_amount(self): - pass + # @api.depends('reconciliation_line_ids') + # def _compute_amount(self): + # pass # for rec in self: # rec.amount_been_reconciled = 0.0 # rec.amount_reconciled = 0.0 @@ -30,13 +30,12 @@ class PropertyReconciliationWizard(models.Model): # else: # rec.amount_reconciled = 0.0 - @api.onchange('reconciliation_line_ids') + @api.onchange('actual_total', 'actual_date') def _onchange_reconciliation_line_ids(self): if not self.reconciliation_line_ids: return new_lines = [] remaining_amount = self.actual_total - line_count = len(self.reconciliation_line_ids) # 检查是否有单行的rent等于实际金额 exact_match_line = next((line for line in self.reconciliation_line_ids if line.rent == remaining_amount), None) if exact_match_line: @@ -61,37 +60,27 @@ class PropertyReconciliationWizard(models.Model): if key not in groups: groups[key] = [] groups[key].append(line) - all_lines = self.reconciliation_line_ids - sorted_lines = sorted( - all_lines, - key=lambda line: line.due_date if line.due_date else fields.Date.max - ) - + sorted_lines = sorted(all_lines, key=lambda line: line.due_date if line.due_date else fields.Date.max) for line in sorted_lines: rent = line.rent or 0 line.amount = 0 # 重置金额 if remaining_amount <= 0: continue - # 分配不超过租金和剩余金额的数值 assign_amount = min(rent, remaining_amount) line.amount = assign_amount remaining_amount -= assign_amount - # 检查是否违约 - if (line.due_date and self.actual_date and - line.collection_type != 'deposit'): + if (line.due_date and self.actual_date and line.collection_type != 'deposit'): # 计算应收日期的下月1号 next_month_first = (fields.Date.from_string(line.due_date) + relativedelta(months=1)).replace(day=1) - # 如果实收日期晚于下月1号,产生违约 if fields.Date.from_string(self.actual_date) > next_month_first: # 计算违约天数 late_days = (fields.Date.from_string(self.actual_date) - next_month_first).days + 1 - # 计算违约金 = 违约天数 * 应收租金 * 违约金百分比 - penalty_amount = late_days * line.rent * float(line.contract_id.percentage_liquidated_damages.name) + penalty_amount = late_days * round(line.rent * float(line.contract_id.percentage_liquidated_damages.name), 2) if penalty_amount > 0: # 创建新的违约金记录,顺序值为原记录+1 penalty_line_vals = {