diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py
index 77b4af08c..4edb68384 100644
--- a/soong_workflow/wizard/soong_workflow_comment_wizard.py
+++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py
@@ -203,7 +203,18 @@ class SoongWorkflowCommentWizard(models.TransientModel):
continue
record_id = self.env[record.res_model].browse(record.res_id) if record.res_model and record.res_id else None
for link in record.trans_link_id:
- employee_user_role_ids = self._get_approvers_for_link(link, record_id)
+ if link.name == '印章管理员':
+ stamp_types = record_id.type_stamp_ids
+ if stamp_types:
+ user_ids = self.env['res.users']
+ for stamp in stamp_types:
+ user_ids |= stamp.user_ids
+ if user_ids:
+ employee_user_role_ids = self.env['hr.employee'].sudo().search([
+ ('user_id', 'in', user_ids.ids)
+ ])
+ else:
+ employee_user_role_ids = self._get_approvers_for_link(link, record_id)
workflow_id = link.node_button_id.workflow_id
node = workflow_id.node_ids.search([
('name', '=', link.name),
diff --git a/yuthon_property/models/property_bank_statements.py b/yuthon_property/models/property_bank_statements.py
index 301cee6ed..d706e5e2c 100644
--- a/yuthon_property/models/property_bank_statements.py
+++ b/yuthon_property/models/property_bank_statements.py
@@ -37,6 +37,7 @@ class PropertyBankStatements(models.Model):
reconciliation_time = fields.Datetime('对账时间')
voucher_type = fields.Selection([('electronic_transfer', '电子转账凭证'), ('telegraphic_transfer', '电汇凭证')], string='凭证种类')
remake = fields.Text('备注')
+ marking = fields.Text(string='标注')
registered = fields.Float('挂账')
is_reconciliation = fields.Boolean('是否对账')
workflow_record_id = fields.Many2one('soong.workflow.record', string="流程")
@@ -281,7 +282,8 @@ class ReceivableModifyLine(models.Model):
- reconciliation_date = fields.Date(string='对账日期')
+ reconciliation_date = fields.Date(string='收款日期')
+ operation_date = fields.Date(string='操作日期')
is_penalty = fields.Boolean(string='是否为违约金')
not_collected = fields.Float(related='receivable_id.submitted', string='未收', store=False)
amount = fields.Float(string='已对金额')
diff --git a/yuthon_property/views/property_bank_statements_views.xml b/yuthon_property/views/property_bank_statements_views.xml
index 8e760fb12..6a67acaf6 100644
--- a/yuthon_property/views/property_bank_statements_views.xml
+++ b/yuthon_property/views/property_bank_statements_views.xml
@@ -46,6 +46,7 @@
+
@@ -136,7 +137,8 @@
-
+
+
@@ -157,6 +159,7 @@
+
diff --git a/yuthon_property_approval/wizard/click_reconciliation_wizard.py b/yuthon_property_approval/wizard/click_reconciliation_wizard.py
index d980a96a1..e64e6d450 100644
--- a/yuthon_property_approval/wizard/click_reconciliation_wizard.py
+++ b/yuthon_property_approval/wizard/click_reconciliation_wizard.py
@@ -10,74 +10,82 @@ class ClickReconciliationWizard(models.Model):
def action_confirm(self):
unreconciled_states = ['not_reconciled', 'registered']
-
bank_statements = self.env["property.bank.statements"].search([
('bank_state', 'in', unreconciled_states),
- ('is_company', '=', True),
+ ('company_id', '=', self.env.company.id),
], order='start_time asc')
- # 3. 按“月份+合同组”分组汇总流水金额(同一月同一批合同的流水合并)
stmt_groups = {}
for stmt in bank_statements:
stmt_datetime = fields.Datetime.from_string(stmt.start_time)
stmt_date = (stmt_datetime - timedelta(hours=8)).date()
- month_key = (stmt_date.year, stmt_date.month) # 月份标识(年,月)
+ month_key = (stmt_date.year, stmt_date.month)
contract_ids = tuple(stmt.contract_ids.ids)
if not contract_ids:
continue
- # 3.3 按“月份+合同组”汇总金额
- group_key = (month_key, contract_ids)
+ # 关键:加stmt.id → 每一笔流水独立分组,绝不合并多流水
+ group_key = (month_key, contract_ids, stmt.id)
if group_key not in stmt_groups:
stmt_groups[group_key] = {
- 'total_stmt_amount': 0.0,
- 'statements': self.env["property.bank.statements"], # 存储该组所有流水
+ 'total_stmt_amount': stmt.original_amount,
+ 'statements': self.env["property.bank.statements"] + stmt,
}
- # 累加流水金额并收集流水记录
- stmt_groups[group_key]['total_stmt_amount'] += stmt.original_amount
- stmt_groups[group_key]['statements'] |= stmt
- # 4. 遍历每个分组,匹配应收单
+ # 外层大循环
for group_key, group_data in stmt_groups.items():
- (month_key, contract_ids) = group_key
+ month_key, contract_ids, stmt_id = group_key
total_stmt_amount = group_data['total_stmt_amount']
statements = group_data['statements']
year, month = month_key
- # 4.1 计算该月份的时间范围
month_start = datetime(year, month, 1).date()
month_end = datetime(year + 1, 1, 1).date() if month == 12 else datetime(year, month + 1, 1).date()
- # 4.2 查找该月份、该合同组的未对账应收单
+ # 匹配当月该合同所有未对账应收
receivables = self.env["property.accounts.receivable"].search([
('is_reconciliation', '=', False),
- ('contract_id', 'in', contract_ids),
+ ('contract_id', 'in', list(contract_ids)),
('due_date', '>=', month_start),
('due_date', '<', month_end),
])
if not receivables:
- continue # 无匹配应收单,跳过
+ continue
- # 4.3 计算应收总金额
total_receivable = sum(rec.original_amount for rec in receivables)
- # 4.4 检查该合同组是否有前期未对账记录
+ # 判断有无前期未对账
has_prev_unreconciled = self.env["property.accounts.receivable"].search([
- ('contract_id', 'in', contract_ids),
+ ('contract_id', 'in', list(contract_ids)),
('is_reconciliation', '=', False),
('due_date', '<', month_start),
], limit=1)
-
- # 4.5 核心条件:多笔流水总和 == 应收总和,且无前期未对账
if total_stmt_amount == total_receivable and not has_prev_unreconciled:
- # 4.6 更新该组所有流水为“已对账”
+ # # 打印所有符合条件数据
+ # print("\n========================================")
+ # print("✅ 满足对账条件(单流水可对多应收)")
+ # print(f"年月:{year}年{month}月 | 流水总金额:{total_stmt_amount} | 应收总金额:{total_receivable}")
+ #
+ # print("\n【当前独立单条流水】")
+ # for st in statements:
+ # print(f"→ 流水ID: {st.id} | 金额: {st.original_amount} | 户名: {st.name_account}")
+ #
+ # print("\n【匹配的多笔应收单】")
+ # for rec in receivables:
+ # print(f"→ 应收ID: {rec.id} | 金额: {rec.original_amount} | 合同: {rec.contract_id.name}")
+ # print("========================================\n")
+ #
+ # # # 测试版:直接跳过写入,不修改任何数据
+ # # continue
+ # # # 下面是你原来的逻辑,完全不动
for stmt in statements:
stmt.write({
'change_amount': stmt.original_amount,
'bank_state': 'reconciled',
'reconciliation_time': fields.Datetime.now() - timedelta(hours=8),
'no_amount': 0,
- 'yes_amount': stmt.original_amount
+ 'yes_amount': stmt.original_amount,
+ 'marking': '系统一键对账'
})
for rec in receivables:
@@ -85,8 +93,7 @@ class ClickReconciliationWizard(models.Model):
'is_reconciliation': True,
'delivered1': rec.original_amount,
'reconciliation_time': fields.Datetime.now() - timedelta(hours=8),
- 'payout_date': statements[0].start_time.date() if statements else False, # 取第一笔流水日期
- 'receivable_log': f'当前登录人{self.env.user.name}于{fields.Datetime.now()}对户名为{statements[0].name_account}进行对账操作(多笔流水合并)'
+ 'payout_date': statements[0].start_time.date() if statements else False,
})
modify = self.env['receivable.modify.line'].search([
@@ -94,15 +101,18 @@ class ClickReconciliationWizard(models.Model):
('bank_id', '=', statements[0].id),
('is_write', '=', True),
('is_penalty', '=', False),
- ('reconciliation_date', '=', (fields.Datetime.from_string(statements[0].start_time) - timedelta(hours=8)).date()),
+ ('reconciliation_date', '=',
+ (fields.Datetime.from_string(statements[0].start_time) - timedelta(hours=8)).date()),
('amount', '=', rec.original_amount)
- ])
+ ])
if not modify:
self.env['receivable.modify.line'].create({
'is_write': True,
'is_penalty': False,
'bank_id': statements[0].id,
- 'reconciliation_date': (fields.Datetime.from_string(statements[0].start_time) - timedelta(hours=8)).date(),
+ 'reconciliation_date': (fields.Datetime.from_string(statements[0].start_time) - timedelta(
+ hours=8)).date(),
+ 'operation_date': fields.Date.today(),
'receivable_id': rec.id,
'amount': rec.original_amount,
})
\ No newline at end of file
diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py
index 76628b652..9e21cd161 100644
--- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py
+++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py
@@ -406,6 +406,7 @@ class PropertyReconciliationWizard(models.Model):
'reconciliation_date': rec.actual_date if line.amount != 0 else None,
'receivable_id': receivable.id,
'is_write': True if line.amount != 0 else False,
+ 'operation_date': fields.Date.today(),
'is_penalty': False,
'remake1': line.remake,
'amount': line.amount,
@@ -489,6 +490,7 @@ class PropertyReconciliationWizard(models.Model):
'is_write': True if line.amount != 0 else False,
'is_penalty': True,
'reconciliation_date': rec.actual_date if line.amount != 0 else None,
+ 'operation_date': fields.Date.today(),
'receivable_id': receivable_id.id,
'amount': line.amount,
})
diff --git a/yuthon_trade/models/yuthon_trade_setting.py b/yuthon_trade/models/yuthon_trade_setting.py
index c274a1af7..66e0f2ccf 100644
--- a/yuthon_trade/models/yuthon_trade_setting.py
+++ b/yuthon_trade/models/yuthon_trade_setting.py
@@ -29,7 +29,7 @@ class SealsTypeSetting(models.Model):
name = fields.Char(string='名称')
scope_setting_id = fields.Many2one('seals.scope.setting', string="用章范围")
department_id = fields.Many2one('hr.department', string="部门")
- user_id = fields.Many2one('res.users', string="保管人")
+ user_ids = fields.Many2many('res.users', string="保管人")
start_date = fields.Date(string="生效日期", copy=False, default=fields.Date.today())
end_date = fields.Date(string="失效日期")
is_effect = fields.Boolean(string="是否生效", compute="_compute_is_effect")
diff --git a/yuthon_trade/views/yuthon_trade_setting_views.xml b/yuthon_trade/views/yuthon_trade_setting_views.xml
index bbc012d22..725aab14f 100644
--- a/yuthon_trade/views/yuthon_trade_setting_views.xml
+++ b/yuthon_trade/views/yuthon_trade_setting_views.xml
@@ -35,7 +35,7 @@
-
+