diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml
index f66a7735f..0fab0d917 100644
--- a/soong_workflow/views/soong_workflow_record.xml
+++ b/soong_workflow/views/soong_workflow_record.xml
@@ -15,7 +15,6 @@
-
@@ -119,9 +118,8 @@
ir.actions.act_window
soong.workflow.record
tree,kanban,search
- [('reclaim_state', '=', False)]
+ [('employee_ids.user_id', '=', uid), ('reclaim_state', '=', False)]
- {'search_default_group_by_employee': True}
人事相关流程
diff --git a/yuthon_hr_attendance/models/go_approval.py b/yuthon_hr_attendance/models/go_approval.py
index 0d5553625..6a24ce917 100644
--- a/yuthon_hr_attendance/models/go_approval.py
+++ b/yuthon_hr_attendance/models/go_approval.py
@@ -50,12 +50,7 @@ class GoApprovals(models.Model):
@api.onchange('is_day', 'is_hour')
def _onchange_role_selection(self):
if self.is_day and self.is_hour:
- return {
- 'warning': {
- 'title': _('输入错误'),
- 'message': _('只能选择主角色或者角色组中的一个,不能同时选择。')
- }
- }
+ raise UserError("只能选择按天或按小时")
@api.onchange('start_day_selection', 'end_day_selection')
def _onchange_selection_fields(self):
diff --git a/yuthon_property/models/property_accounts_receivable.py b/yuthon_property/models/property_accounts_receivable.py
index f4c341030..729c9f5c8 100644
--- a/yuthon_property/models/property_accounts_receivable.py
+++ b/yuthon_property/models/property_accounts_receivable.py
@@ -28,7 +28,7 @@ class PropertyAccountsReceivable(models.Model):
remark = fields.Text(string='备注')
red_date = fields.Date(string='红冲日期')
charge_status = fields.Selection([('unpaid', '未收'), ('fully_paid', '已收')], string='收费状态')
- is_suspend = fields.Boolean(string='挂起')
+ is_suspend = fields.Boolean(string='是否挂起')
create_time = fields.Date(string='创建日期', default=lambda self: fields.Date.today())
is_billing = fields.Boolean(string='开票')
is_reconciliation = fields.Boolean(string='对账')
@@ -41,4 +41,13 @@ class PropertyAccountsReceivable(models.Model):
last_update_time = fields.Datetime(string='最后修改时间')
def unlink(self):
- return super().unlink()
\ No newline at end of file
+ return super().unlink()
+
+ # 激活
+ def suspend(self):
+ return self.write({'is_suspend': False})
+
+
+ # 挂起
+ def unsuspend(self):
+ return self.write({'is_suspend': True})
\ No newline at end of file
diff --git a/yuthon_property/views/property_accounts_receivable_views.xml b/yuthon_property/views/property_accounts_receivable_views.xml
index d692aa404..39b55ae5c 100644
--- a/yuthon_property/views/property_accounts_receivable_views.xml
+++ b/yuthon_property/views/property_accounts_receivable_views.xml
@@ -24,7 +24,10 @@
+
+
+
@@ -36,27 +39,12 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
- 应收列表
- property.accounts.receivable
- tree
- {'search_default_group_is_reconciliation': 0}
批量导入合同
diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py
index bee31be23..9e7633c45 100644
--- a/yuthon_property_approval/models/inherit_yuthon_property.py
+++ b/yuthon_property_approval/models/inherit_yuthon_property.py
@@ -52,7 +52,7 @@ class PropertyBankStatements(models.Model):
dt = datetime.strptime(str(record.start_time), '%Y-%m-%d %H:%M:%S').date() # 对账日期
due = datetime.strptime(str(receivable_id.due_date), '%Y-%m-%d').date() # 应收日期
# 判断是否违约
- if receivable_id.due_date > record.start_time and not receivable_id.is_reconciliation:
+ if receivable_id.due_date > record.start_time and not receivable_id.is_reconciliation or not receivable_id.is_suspend:
original_amount = (due - dt).days * (receivable_id.original_amount - record.original_amount) * 0.001
self.env['property.penalty.list'].create({
'contract_id': contract_id.id,
@@ -136,6 +136,8 @@ class PropertyBankStatements(models.Model):
}
total_rent_month += original_amount # 累加总金额
vals_list.append((0, 0, vals))
+
+
return vals_list
all_vals = []
@@ -145,30 +147,6 @@ class PropertyBankStatements(models.Model):
all_vals.extend(create_reconciliation_vals(water_ids, 'water_fee'))
all_vals.extend(create_reconciliation_vals(electricity_ids, 'electricity_fee'))
- # 处理违约金(关键新增逻辑)
- transaction_date = record.transaction_time # 银行流水交易时间
- if transaction_date:
- # 查找违约金记录中 start_date <= 交易时间 <= end_date 的记录
- penalty_records = penalty_ids.filtered(
- lambda p: p.start_date and p.end_date and
- p.start_date <= transaction_date and
- p.end_date >= transaction_date
- )
- for penalty in penalty_records:
- # 计算违约金金额(original_amount - deduction_amount)
- penalty_amount = (penalty.original_amount or 0) - (penalty.deduction_amount or 0)
- if penalty_amount > 0:
- vals = {
- 'property_id': penalty.property_id.id if penalty.property_id else False,
- 'contract_id': penalty.contract_id.id if penalty.contract_id else False,
- 'rent_month': penalty_amount,
- 'rent': penalty_amount,
- 'collection_type': 'penalty', # 新增违约金类型
- 'due_date': penalty.due_date if penalty.due_date else False,
- }
- total_rent_month -= penalty_amount
- all_vals.append((0, 0, vals))
-
return all_vals, total_rent_month
return [], 0
diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml
index 4266599e0..1ae0f18d9 100644
--- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml
+++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml
@@ -348,6 +348,12 @@
+
+ 应收列表
+ property.accounts.receivable
+ tree
+ {'group_by': 'contract_id'}
+
批量生成违约金
diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py
index 5365abe01..f094722dd 100644
--- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py
+++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py
@@ -9,8 +9,28 @@ class PropertyReconciliationWizard(models.Model):
receivable_total = fields.Float(string='应收金额')
account = fields.Char(string='账号')
actual_total = fields.Float(string='实收金额')
+ initial_total = fields.Float(string='初始金额', default=0.0)
reconciliation_line_ids = fields.One2many('property.reconciliation.line', 'reconciliation_id', string='对账明细')
+ @api.onchange('actual_total')
+ def _onchange_actual_total(self):
+ if not self.reconciliation_line_ids:
+ return
+ # 首次设置时记录初始值
+ if not self.initial_total:
+ self.initial_total = self.actual_total
+ # 遍历明细行,按规则分配金额
+ for index, line in enumerate(self.reconciliation_line_ids):
+ if index == 0:
+ # 第一行等于初始值
+ line.amount = self.initial_total
+ elif index == 1:
+ # 第二行等于当前值减去初始值
+ line.amount = max(0, self.actual_total - self.initial_total)
+ else:
+ # 第三行及以后:当前值 - (初始值 * 行号),但不小于0
+ line.amount = max(0, self.actual_total - (self.initial_total * index))
+
def confirm(self):
pass
diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml
index 65942fe59..6606721df 100644
--- a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml
+++ b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml
@@ -10,6 +10,7 @@
+
diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml
index 2f88e9505..1345205dd 100644
--- a/yuthon_work_brand/views/hr_menus.xml
+++ b/yuthon_work_brand/views/hr_menus.xml
@@ -704,7 +704,7 @@
sequence="1"
name="应收账单"
parent="yuthon_financial_management_menu"
- action="yuthon_property.property_accounts_receivable_action"/>
+ action="yuthon_property_approval.property_accounts_receivable_action"/>