diff --git a/yuthon_property/views/property_bank_statements_views.xml b/yuthon_property/views/property_bank_statements_views.xml
index e0d967729..4c8c6c172 100644
--- a/yuthon_property/views/property_bank_statements_views.xml
+++ b/yuthon_property/views/property_bank_statements_views.xml
@@ -33,7 +33,7 @@
@@ -46,7 +46,6 @@
-
@@ -88,7 +87,6 @@
-
@@ -137,8 +135,7 @@
-
-
+
@@ -159,7 +156,6 @@
-
@@ -223,11 +219,4 @@
code
action = model.update_company_id()
-
- 更新账号单位
-
-
- code
- action = model.update_your_own_unit()
-
\ No newline at end of file
diff --git a/yuthon_property/wizard/property_statements_wizard.py b/yuthon_property/wizard/property_statements_wizard.py
index 91e8504bf..e539bd015 100644
--- a/yuthon_property/wizard/property_statements_wizard.py
+++ b/yuthon_property/wizard/property_statements_wizard.py
@@ -491,13 +491,16 @@ class PropertyStatementsWizard(models.Model):
lending_direction = 'borrow'
amount_str = get_val(8).replace(',', '') # I列:发生额
else:
+ _logger.info('[xy_debug] 跳过:direction_val=%r 行首=%r', direction_val, get_val(0))
return
try:
original_amount = float(amount_str)
except Exception:
+ _logger.info('[xy_debug] 金额转换失败:amount_str=%r', amount_str)
return
if not original_amount:
+ _logger.info('[xy_debug] 金额为0跳过')
return
name = get_val(9) # 对方账号
@@ -510,6 +513,7 @@ class PropertyStatementsWizard(models.Model):
your_own_unit = self.classify_by_last_four(your_own_account)
company_id = self._get_company_by_unit(your_own_unit)
if not company_id:
+ _logger.info('[xy_debug] 公司匹配失败:your_own_account=%r your_own_unit=%r', your_own_account, your_own_unit)
return
dedup_key = serial_number if serial_number and serial_number != '0' else (time_val + name)
@@ -536,12 +540,28 @@ class PropertyStatementsWizard(models.Model):
existing_record.write(bank_data)
def _get_company_by_unit(self, unit_name):
- if unit_name in ['天河投资', '天投城建', '兴源公司']:
+ """根据简称匹配 yuthon.property.company 配置,再匹配 res.company"""
+ if not unit_name:
+ return False
+ # 先从物业公司配置表找到全称
+ company_config = self.env['yuthon.property.company'].sudo().search(
+ [('referred', '=', unit_name)], limit=1
+ )
+ if company_config:
+ # 用全称匹配 res.company
+ company = self.env['res.company'].sudo().search(
+ [('name', '=', company_config.name)], limit=1
+ )
+ if company:
+ return company
+ # 兑容旧逻辑
+ if unit_name in ['天河投资', '天投城建', '兴源公司', '车陂民政', '中城公司']:
return self.env['res.company'].sudo().search([('name', '=', '集团本部')], limit=1)
elif unit_name == '天河物管':
return self.env['res.company'].sudo().search([('name', '=', '天河物管')], limit=1)
elif unit_name == '天河粮储':
return self.env['res.company'].sudo().search([('name', '=', '天河粮储')], limit=1)
+ _logger.warning('[银行流水导入] 未能匹配公司: unit_name=%s', unit_name)
return False
def classify_by_last_four(self, input_str):