!10273 !10272 Merge branch 'dev' of <a href="https://gitee.com/jinan-pengyuse…

Merge pull request !10273 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2026-03-26 04:07:07 +00:00
committed by Gitee
2 changed files with 38 additions and 17 deletions
@@ -87,6 +87,7 @@
<field name="name_account"/>
<field name="name"/>
<field name="original_amount"/>
<field name="your_own_account" string="本方账号"/>
</search>
</field>
</record>
@@ -466,26 +466,46 @@ class PropertyStatementsWizard(models.Model):
# self.env['property.bank.statements'].create(bank_data)
def _get_company_by_unit(self, unit_name):
"""根据账号单位返回对应公司"""
"""根据简称匹配 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 not company_config:
return False
# 用全称匹配 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'].search([('name', '=', '集团本部')], limit=1)
return self.env['res.company'].sudo().search([('name', '=', '集团本部')], limit=1)
elif unit_name == '天河物管':
return self.env['res.company'].search([('name', '=', '天河物管')], limit=1)
return self.env['res.company'].sudo().search([('name', '=', '天河物管')], limit=1)
elif unit_name == '天河粮储':
return self.env['res.company'].search([('name', '=', '天河粮储')], limit=1)
return self.env['res.company'].sudo().search([('name', '=', '天河粮储')], limit=1)
return False
def classify_by_last_four(self, input_str):
if not isinstance(input_str, str) or len(input_str) < 4:
return "天投城建" # 输入不是字符串或长度不足4,默认为天投城建
last_four = input_str[-4:] # 获取后四位字符
if last_four == "3619":
return "天河物管"
elif last_four == "0222":
return "天河投资"
elif last_four == "9661":
return "天河粮储"
else:
return "天投城建"
"""根据本方账号匹配 yuthon.property.company 中的收租公司账号,返回简称"""
if not isinstance(input_str, str) or not input_str.strip():
return ''
account = input_str.strip()
# 从物业公司配置表中查找匹配的收租公司账号
company_config = self.env['yuthon.property.company'].sudo().search(
[('rent_account', '=', account)], limit=1
)
if company_config and company_config.referred:
return company_config.referred
# 兼容旧逻辑:账号后四位模糊匹配
last_four = account[-4:] if len(account) >= 4 else ''
company_config = self.env['yuthon.property.company'].sudo().search(
[('rent_account', 'like', last_four)], limit=1
)
if company_config and company_config.referred:
return company_config.referred
return ''