From 35a69d78b7c1f9173d0686690e89fcdf7e75b27d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Tue, 24 Mar 2026 19:59:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wizard/property_statements_wizard.py | 52 ++++--------------- 1 file changed, 9 insertions(+), 43 deletions(-) diff --git a/yuthon_property/wizard/property_statements_wizard.py b/yuthon_property/wizard/property_statements_wizard.py index a101abcfb..1cc8be146 100644 --- a/yuthon_property/wizard/property_statements_wizard.py +++ b/yuthon_property/wizard/property_statements_wizard.py @@ -11,7 +11,7 @@ class PropertyStatementsWizard(models.Model): _name = 'property.statements.wizard' _description = '银行流水向导弹窗' - selection_bank = fields.Selection([('js', '建设银行'), ('gs', '工商银行'), ('sh', '农商'), ('ms', '民生'), ('zc', '广州银行(中城)'), ('dj', '农商行(东进)'), ('xy', '工商银行(兴源)')], string="选择银行") + selection_bank = fields.Selection([('js', '建设银行'), ('gs', '工商银行'), ('sh', '农商'), ('ms', '民生'), ('zc', '广州银行(中城)'), ('dj', '农商行(东进)')], string="选择银行") excel_file = fields.Binary(string="上传Excel表") excel_name = fields.Char(string="文件名") @@ -40,20 +40,23 @@ class PropertyStatementsWizard(models.Model): row = sh.row(rx) self.property_bank_statements_dj_data(row, your_own_account) else: + first_round = True book = xlrd.open_workbook(file_contents=file_content) sh = book.sheet_by_index(0) for rx in range(1, sh.nrows): row = sh.row(rx) + if self.selection_bank == 'gs': + if first_round: + first_round = False + continue if self.selection_bank == 'js': self.property_bank_statements_jh_data(row) - elif self.selection_bank == 'gs': - self.property_bank_statements_gc_data(row) elif self.selection_bank == 'sh': self.property_bank_statements_sh_data(row) elif self.selection_bank == 'ms': self.property_bank_statements_ms_data(row) - elif self.selection_bank == 'xy': - self.property_bank_statements_xy_data(row) + elif self.selection_bank == 'gs': + self.property_bank_statements_gc_data(row) return { 'type': 'ir.actions.client', @@ -66,43 +69,6 @@ class PropertyStatementsWizard(models.Model): } } - 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 = original_amount.replace(',', '') - float_amount = float(cleaned_amount) - 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) - 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), - '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_jh_data(self, row): your_own_account = row[0].value if row[1].value: @@ -378,7 +344,7 @@ class PropertyStatementsWizard(models.Model): existing_record.write(bank_data) - def property_bank_statements_xy_data(self, row): + def property_bank_statements_gc_data(self, row): """工商银行(兴苑)解析:数据从第2行开始,列结构(共34列): 0:交易时间, 1:对方单位, 2:摘要, 7:借贷标志, 8:发生额, 9:对方账号, 16:本方账号, 22:对方行名, 31:顺序号