|
|
|
@@ -13,7 +13,7 @@ class PropertyStatementsWizard(models.Model):
|
|
|
|
|
_name = 'property.statements.wizard'
|
|
|
|
|
_description = '银行流水向导弹窗'
|
|
|
|
|
|
|
|
|
|
selection_bank = fields.Selection([('js', '建设银行'), ('gs', '工商银行'), ('ms', '民生'), ('zc', '广州银行(中城)'), ('dj', '农商行(东进)')], string="选择银行")
|
|
|
|
|
selection_bank = fields.Selection([('js', '建设银行'), ('gs', '工商银行'), ('ms', '民生'), ('zc', '广州银行(中城)'), ('dj', '农商行(东进)')], string="选择银行", default='js')
|
|
|
|
|
excel_file = fields.Binary(string="上传Excel表")
|
|
|
|
|
excel_name = fields.Char(string="文件名")
|
|
|
|
|
|
|
|
|
@@ -86,39 +86,37 @@ class PropertyStatementsWizard(models.Model):
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def property_bank_statements_jh_data(self, row):
|
|
|
|
|
your_own_account = row[0].value
|
|
|
|
|
if row[1].value:
|
|
|
|
|
start_time = datetime.strptime(row[2].value, '%Y%m%d %H:%M:%S')
|
|
|
|
|
else:
|
|
|
|
|
start_time = None
|
|
|
|
|
if row[3].value:
|
|
|
|
|
original_amount = float(row[3].value)
|
|
|
|
|
your_own_account = row[11].value
|
|
|
|
|
start_time = None
|
|
|
|
|
if row[0].value:
|
|
|
|
|
time_str = str(row[0].value).strip()
|
|
|
|
|
dt = datetime.strptime(time_str, '%Y%m%d %H:%M:%S')
|
|
|
|
|
dt = dt - timedelta(hours=8)
|
|
|
|
|
start_time = fields.Datetime.to_string(dt)
|
|
|
|
|
|
|
|
|
|
if row[2].value:
|
|
|
|
|
original_amount = float(row[2].value)
|
|
|
|
|
lending_direction = 'borrow'
|
|
|
|
|
elif row[4].value:
|
|
|
|
|
original_amount = float(row[4].value)
|
|
|
|
|
elif row[3].value:
|
|
|
|
|
original_amount = float(row[3].value)
|
|
|
|
|
lending_direction = 'loan'
|
|
|
|
|
name_account = row[7].value
|
|
|
|
|
name = row[8].value
|
|
|
|
|
bank_branch = row[9].value
|
|
|
|
|
remake = row[12].value
|
|
|
|
|
extract = row[11].value
|
|
|
|
|
serial_number = row[13].value
|
|
|
|
|
your_own_unit = self.classify_by_last_four(your_own_account)
|
|
|
|
|
if your_own_unit in ['天河投资', '天投城建']:
|
|
|
|
|
company_id = self.env['res.company'].search([('name', '=', '集团本部')], limit=1)
|
|
|
|
|
elif your_own_unit in ['天河物管']:
|
|
|
|
|
company_id = self.env['res.company'].search([('name', '=', '天河物管')], limit=1)
|
|
|
|
|
elif your_own_unit in ['天河粮储']:
|
|
|
|
|
company_id = self.env['res.company'].search([('name', '=', '天河粮储')], limit=1)
|
|
|
|
|
name_account = row[1].value
|
|
|
|
|
name = row[6].value
|
|
|
|
|
bank_branch = row[7].value
|
|
|
|
|
remake = row[5].value
|
|
|
|
|
extract = row[4].value
|
|
|
|
|
your_own_unit = self.classify_by_last_four(your_own_account).referred
|
|
|
|
|
company_id = self.env['res.company'].search([('name', '=', '集团本部')], limit=1)
|
|
|
|
|
if your_own_unit:
|
|
|
|
|
company_id = self.classify_by_last_four(your_own_account).company_id
|
|
|
|
|
bank_data = {
|
|
|
|
|
'name': name,
|
|
|
|
|
'serial_number': serial_number,
|
|
|
|
|
'your_own_unit': your_own_unit,
|
|
|
|
|
'no_amount': original_amount,
|
|
|
|
|
'company_id': company_id.id,
|
|
|
|
|
'bank_branch': bank_branch,
|
|
|
|
|
'original_amount': original_amount,
|
|
|
|
|
'start_time': start_time - timedelta(hours=8),
|
|
|
|
|
'start_time': start_time,
|
|
|
|
|
'your_own_account': your_own_account,
|
|
|
|
|
'extract': extract,
|
|
|
|
|
'name_account': name_account,
|
|
|
|
@@ -126,12 +124,10 @@ class PropertyStatementsWizard(models.Model):
|
|
|
|
|
'lending_direction': lending_direction
|
|
|
|
|
}
|
|
|
|
|
existing_record = self.env['property.bank.statements'].search(
|
|
|
|
|
[('serial_number', '=', serial_number)], limit=1
|
|
|
|
|
[('start_time', '=', start_time)], limit=1
|
|
|
|
|
)
|
|
|
|
|
if not existing_record:
|
|
|
|
|
self.env['property.bank.statements'].create(bank_data)
|
|
|
|
|
else:
|
|
|
|
|
existing_record.write(bank_data)
|
|
|
|
|
|
|
|
|
|
def property_bank_statements_sh_data(self, row):
|
|
|
|
|
your_own_account = row[12].value
|
|
|
|
@@ -153,13 +149,10 @@ class PropertyStatementsWizard(models.Model):
|
|
|
|
|
extract = row[10].value
|
|
|
|
|
serial_number = row[0].value
|
|
|
|
|
lending_direction = lending_direction
|
|
|
|
|
your_own_unit = self.classify_by_last_four(your_own_account)
|
|
|
|
|
if your_own_unit in ['天河投资', '天投城建']:
|
|
|
|
|
company_id = self.env['res.company'].search([('name', '=', '集团本部')], limit=1)
|
|
|
|
|
elif your_own_unit in ['天河物管']:
|
|
|
|
|
company_id = self.env['res.company'].search([('name', '=', '天河物管')], limit=1)
|
|
|
|
|
elif your_own_unit in ['天河粮储']:
|
|
|
|
|
company_id = self.env['res.company'].search([('name', '=', '天河粮储')], limit=1)
|
|
|
|
|
your_own_unit = self.classify_by_last_four(your_own_account).referred
|
|
|
|
|
company_id = self.env['res.company'].search([('name', '=', '集团本部')], limit=1)
|
|
|
|
|
if your_own_unit:
|
|
|
|
|
company_id = your_own_unit.company_id
|
|
|
|
|
bank_data = {
|
|
|
|
|
'name': name,
|
|
|
|
|
'serial_number': serial_number,
|
|
|
|
@@ -432,41 +425,6 @@ class PropertyStatementsWizard(models.Model):
|
|
|
|
|
else:
|
|
|
|
|
existing_record.write(bank_data)
|
|
|
|
|
|
|
|
|
|
# def property_bank_statements_gc_data(self, row):
|
|
|
|
|
# """工商银行(原始格式)解析"""
|
|
|
|
|
# if row[0].value:
|
|
|
|
|
# start_time = datetime.strptime(row[0].value, '%Y-%m-%d %H:%M:%S')
|
|
|
|
|
# else:
|
|
|
|
|
# start_time = None
|
|
|
|
|
# name = row[4].value
|
|
|
|
|
# name_account = row[1].value
|
|
|
|
|
# remake = row[2].value
|
|
|
|
|
# original_amount = row[3].value
|
|
|
|
|
# your_own_account = row[6].value
|
|
|
|
|
# cleaned_amount = str(original_amount).replace(',', '')
|
|
|
|
|
# float_amount = float(cleaned_amount)
|
|
|
|
|
# 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:
|
|
|
|
|
# return
|
|
|
|
|
# sequence_number = row[5].value
|
|
|
|
|
# bank_data = {
|
|
|
|
|
# 'name': name,
|
|
|
|
|
# 'your_own_unit': your_own_unit,
|
|
|
|
|
# 'original_amount': float_amount,
|
|
|
|
|
# 'company_id': company_id.id,
|
|
|
|
|
# 'sequence_number': sequence_number,
|
|
|
|
|
# 'start_time': start_time - timedelta(hours=8) if start_time else False,
|
|
|
|
|
# 'your_own_account': your_own_account,
|
|
|
|
|
# 'name_account': name_account,
|
|
|
|
|
# 'remake': remake,
|
|
|
|
|
# }
|
|
|
|
|
# existing_record = self.env['property.bank.statements'].search(
|
|
|
|
|
# [('sequence_number', '=', sequence_number)], limit=1
|
|
|
|
|
# )
|
|
|
|
|
# if not existing_record:
|
|
|
|
|
# self.env['property.bank.statements'].create(bank_data)
|
|
|
|
|
|
|
|
|
|
def property_bank_statements_xy_data_openpyxl(self, row):
|
|
|
|
|
"""工商银行(兴源)openpyxl版本解析,row为元组,列结构:
|
|
|
|
|
0:交易时间, 1:对方单位, 2:摘要, 4:转入金额(贷时取), 7:借贷标志,
|
|
|
|
@@ -554,13 +512,13 @@ class PropertyStatementsWizard(models.Model):
|
|
|
|
|
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
|
|
|
|
|
if company_config:
|
|
|
|
|
return company_config
|
|
|
|
|
# 兼容旧逻辑:账号后四位模糊匹配
|
|
|
|
|
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
|
|
|
|
|
if company_config:
|
|
|
|
|
return company_config
|
|
|
|
|
return ''
|