From 41ff63b1a4f3f57b72b689eaddf030ba2e57551e Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Tue, 14 Jan 2025 16:32:19 +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 --- yuthon_property/__manifest__.py | 2 + .../models/property_bank_statements.py | 27 ++++++- .../models/yuthon_resource_mgmt_config.py | 8 +- yuthon_property/security/ir.model.access.csv | 5 +- yuthon_property/views/menuitem.xml | 10 ++- .../views/property_bank_statements_views.xml | 35 +++++++++ .../yuthon_resource_mgmt_config_views.xml | 14 ++++ yuthon_property/wizard/__init__.py | 1 + .../wizard/property_statements_wizard.py | 75 +++++++++++++++++++ .../property_statements_wizard_views.xml | 41 ++++++++++ yuthon_property_approval/models/__init__.py | 2 +- .../models/property_lease_contract.py | 8 +- .../security/ir.model.access.csv | 2 +- .../views/property_lease_contract.xml | 32 ++++---- .../views/property_menu_all.xml | 10 +-- yuthon_property_approval/wizard/__init__.py | 2 +- 16 files changed, 240 insertions(+), 34 deletions(-) create mode 100644 yuthon_property/views/property_bank_statements_views.xml create mode 100644 yuthon_property/wizard/property_statements_wizard.py create mode 100644 yuthon_property/wizard/property_statements_wizard_views.xml diff --git a/yuthon_property/__manifest__.py b/yuthon_property/__manifest__.py index 5f25807ae..1fe6787be 100644 --- a/yuthon_property/__manifest__.py +++ b/yuthon_property/__manifest__.py @@ -45,11 +45,13 @@ 'views/property_check_stairs_views.xml', 'views/property_check_decorate_views.xml', 'views/property_other_list_views.xml', + 'views/property_bank_statements_views.xml', 'views/property_meter_reading_views.xml', 'wizard/yuthon_property_wizard_views.xml', 'wizard/property_meter_wizard_views.xml', 'wizard/property_tenant_wizard_views.xml', 'wizard/property_water_wizard_views.xml', + 'wizard/property_statements_wizard_views.xml', 'views/menuitem.xml', ], 'assets': { diff --git a/yuthon_property/models/property_bank_statements.py b/yuthon_property/models/property_bank_statements.py index 0de3c6131..f4aaa6d36 100644 --- a/yuthon_property/models/property_bank_statements.py +++ b/yuthon_property/models/property_bank_statements.py @@ -1,8 +1,29 @@ -from odoo import models, fields, api +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models, fields, api, exceptions, _ class PropertyBankStatements(models.Model): _name = 'property.bank.statements' - _description = 'Bank Statement' + _description = '银行流水' - name = fields.Char(string='Name') \ No newline at end of file + name = fields.Char('账号', required=True) + company_id = fields.Many2one('yuthon.property.company', string="出租方") + start_time = fields.Datetime('交易时间', required=True) + withdraw = fields.Float('支取') + deposit = fields.Float('收入') + balance = fields.Float('余额') + currency = fields.Char('币种') + lessee_id = fields.Many2one('property.tenant.information', string='对方户名') + lessee_account = fields.Char('对方账号') + lessee_agencies = fields.Char('对方开户机构') + billing_date = fields.Date('记账日期') + registered = fields.Char(string='用途') + summary = fields.Char('摘要') + remark = fields.Char('备注') + bank_id = fields.Many2one('yuthon.bank.setting', string='银行') + transaction_number = fields.Char('交易流水号') + business_number = fields.Char('企业流水号') + voucher_type = fields.Char('凭证种类') + voucher_number = fields.Char('凭证号') diff --git a/yuthon_property/models/yuthon_resource_mgmt_config.py b/yuthon_property/models/yuthon_resource_mgmt_config.py index 64add33bc..5b40ba804 100644 --- a/yuthon_property/models/yuthon_resource_mgmt_config.py +++ b/yuthon_property/models/yuthon_resource_mgmt_config.py @@ -124,4 +124,10 @@ class YuthonManagementType(models.Model): _name = 'yuthon.management.type' _description = '管理类型' - name = fields.Char(string="管理类型") \ No newline at end of file + name = fields.Char(string="管理类型") + +class YuthonBankSetting(models.Model): + _name = 'yuthon.bank.setting' + _description = '银行' + + name = fields.Char(string="银行") \ No newline at end of file diff --git a/yuthon_property/security/ir.model.access.csv b/yuthon_property/security/ir.model.access.csv index 2b575c946..9367e0bea 100644 --- a/yuthon_property/security/ir.model.access.csv +++ b/yuthon_property/security/ir.model.access.csv @@ -59,4 +59,7 @@ access_yuthon_industry_setting,yuthon_industry_setting,model_yuthon_industry_set access_property_tenant_wizard,property_tenant_wizard,model_property_tenant_wizard,base.group_user,1,1,1,1 access_property_water_wizard,property_water_wizard,model_property_water_wizard,base.group_user,1,1,1,1 access_yuthon_purpose_evidence,yuthon_purpose_evidence,model_yuthon_purpose_evidence,base.group_user,1,1,1,1 -access_yuthon_management_type,yuthon_management_type,model_yuthon_management_type,base.group_user,1,1,1,1 \ No newline at end of file +access_yuthon_management_type,yuthon_management_type,model_yuthon_management_type,base.group_user,1,1,1,1 +access_yuthon_bank_setting,yuthon_bank_setting,model_yuthon_bank_setting,base.group_user,1,1,1,1 +access_property_bank_statements,property_bank_statements,model_property_bank_statements,base.group_user,1,1,1,1 +access_property_statements_wizard,property_statements_wizard,model_property_statements_wizard,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_property/views/menuitem.xml b/yuthon_property/views/menuitem.xml index 21e8dfd97..b6a211135 100644 --- a/yuthon_property/views/menuitem.xml +++ b/yuthon_property/views/menuitem.xml @@ -195,7 +195,12 @@ sequence="3" name="银行流水" parent="yuthon_property_other_list" - action="view_property_rent_list_action2"/> + action="view_property_bank_statements_action"/> + - + + + + property.bank.statements.tree + property.bank.statements + + + + + + + + + + + + + + + + + + + + + + + + + + Property Bank Statements + property.bank.statements + tree + + \ No newline at end of file diff --git a/yuthon_property/views/yuthon_resource_mgmt_config_views.xml b/yuthon_property/views/yuthon_resource_mgmt_config_views.xml index 640c72689..5ec5474ae 100644 --- a/yuthon_property/views/yuthon_resource_mgmt_config_views.xml +++ b/yuthon_property/views/yuthon_resource_mgmt_config_views.xml @@ -235,4 +235,18 @@ yuthon.management.type tree + + yuthon.bank.setting.tree + yuthon.bank.setting + + + + + + + + 银行设置 + yuthon.bank.setting + tree + diff --git a/yuthon_property/wizard/__init__.py b/yuthon_property/wizard/__init__.py index ef88acd72..1738ed28b 100644 --- a/yuthon_property/wizard/__init__.py +++ b/yuthon_property/wizard/__init__.py @@ -2,3 +2,4 @@ from . import yuthon_property_wizard from . import property_meter_wizard from . import property_tenant_wizard from . import property_water_wizard +from . import property_statements_wizard diff --git a/yuthon_property/wizard/property_statements_wizard.py b/yuthon_property/wizard/property_statements_wizard.py new file mode 100644 index 000000000..4fbc52d4a --- /dev/null +++ b/yuthon_property/wizard/property_statements_wizard.py @@ -0,0 +1,75 @@ +from odoo import models, fields, api, _, SUPERUSER_ID +from odoo.exceptions import UserError, ValidationError +from dateutil.relativedelta import relativedelta +from datetime import datetime, time, timedelta +import xlrd +import base64 +import pandas as pd + + +class PropertyStatementsWizard(models.Model): + _name = 'property.statements.wizard' + _description = '银行流水向导弹窗' + + selection_bank_id = fields.Many2one('yuthon.bank.setting', string='选择银行', required=True) + excel_file = fields.Binary(string="上传Excel表") + excel_name = fields.Char(string="文件名") + + def confirm(self): + """ + 导入excel文件,按行读取数据并处理 + """ + if not self.excel_file: + raise ValidationError('请上传文件。') + book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file)) + sh = book.sheet_by_index(0) + for rx in range(1, sh.nrows): + row = sh.row(rx) + self.property_bank_statements_data(row) + + def property_bank_statements_data(self, row): + name = row[0].value + start_time = pd.to_datetime(row[2].value, unit='d', origin='1899-12-30') + company_id = self.env['yuthon.property.company'].search([('name', '=', row[1].value)]) + withdraw = row[3].value + deposit = row[4].value + balance = row[5].value + currency = row[6].value + if row[7].value: + lessee_id = self.env['property.tenant.information'].search([('name', '=', row[7].value)]) + else: + lessee_id = None + lessee_account = row[8].value + lessee_agencies = row[9].value + billing_date = pd.to_datetime(row[10].value, unit='d', origin='1899-12-30') + summary = row[11].value + remark = row[12].value + transaction_number = row[13].value + business_number = row[14].value + voucher_type = row[15].value + voucher_number = row[16].value + registered = row[17].value + bank_data = { + 'name':name, + 'start_time':start_time, + 'company_id': company_id.id, + 'withdraw': withdraw, + 'deposit': deposit, + 'balance': balance, + 'currency': currency, + 'lessee_id': lessee_id.id if lessee_id else False, + 'lessee_account': lessee_account, + 'lessee_agencies': lessee_agencies, + 'billing_date': billing_date, + 'summary': summary, + 'remark': remark, + 'transaction_number': transaction_number, + 'business_number': business_number, + 'voucher_type': voucher_type, + 'voucher_number': voucher_number, + 'bank_id':self.selection_bank_id.id, + 'registered': registered + } + self.env['property.bank.statements'].create(bank_data) + + diff --git a/yuthon_property/wizard/property_statements_wizard_views.xml b/yuthon_property/wizard/property_statements_wizard_views.xml new file mode 100644 index 000000000..b9f57482c --- /dev/null +++ b/yuthon_property/wizard/property_statements_wizard_views.xml @@ -0,0 +1,41 @@ + + + + 银行流水模板 下载 + self + . + + + 银行流水导入弹窗 + property.statements.wizard + +
+ +
+
+ + + + + + + + + +
+
+
+
+
+
+ + 银行流水向导 + property.statements.wizard + form + new + +
diff --git a/yuthon_property_approval/models/__init__.py b/yuthon_property_approval/models/__init__.py index 45f520c79..673da9b6e 100644 --- a/yuthon_property_approval/models/__init__.py +++ b/yuthon_property_approval/models/__init__.py @@ -36,4 +36,4 @@ from . import property_rental_conditions from . import property_merge_approval from . import property_split_approval from . import property_intention_approval -from . import property_transfer_approval \ No newline at end of file +from . import property_transfer_approval diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index f12a6e855..98360f0eb 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -44,7 +44,7 @@ class PropertyLeaseContract(models.Model): contract_code = fields.Char(string="合同编号") contract_date = fields.Date(string="合同签订日期") property_documents_ids = fields.Many2many('ir.attachment', string="租赁合同文件") - title_certificate = fields.Char('产权证号') + title_address = fields.Char(string="产权地址") company_id = fields.Many2one('yuthon.property.company', string="出租方") rent_company = fields.Char(related='company_id.name', string="收租公司名称") rent_account = fields.Char(related='company_id.rent_account', string="收租公司账号") @@ -101,7 +101,7 @@ class PropertyLeaseContract(models.Model): date_payment_month = fields.Char(string="支付日期") date_payment_day = fields.Char(string="支付日期") first_pay = fields.Date(string="首次付款日") - unit_price = fields.Float(string="单价") + unit_price = fields.Float(string="单价", store=True) deposit_type = fields.Selection([('deposit', '押金'), ('performance', '履约保证金')], string="押金/履约保证金") deposit_status = fields.Selection([('unpaid', '未支付'), ('paid', '已支付'), ('returned','已退'),('no_paid', '没收')], string='押金状态') deposit = fields.Float(string="押金/履约保证金", store=True) @@ -808,13 +808,16 @@ class PropertyLeaseContract(models.Model): def _onchange_lease_ids(self): lease_name = [] electricity_list = [] + title_address = [] fee_list = [] for rec in self: for record in rec.lease_ids: if record.address_id: lease_name.append(record.address_id.name) + title_address.append(record.address_id.title_address.name) rec.name = ','.join(lease_name) rec.use_address = ','.join(lease_name) + rec.title_address = ','.join(title_address) property_id = self.env['yuthon.property'].search([('id', '=', record.address_id.id)]) if property_id.energy_meter_ids: rec.is_electricity = True @@ -836,7 +839,6 @@ class PropertyLeaseContract(models.Model): rec.electricity_fee_ids = [(5, 0, 0)] rec.mange_fee_ids = [(5, 0, 0)] - rec.title_certificate = rec.lease_ids[0].address_id.title_deed if rec.lease_ids else '' rec.admin_id = rec.lease_ids[0].admin_id.id if rec.lease_ids else '' rec.company_id = rec.lease_ids[0].address_id.company_id.id if rec.lease_ids else '' rec.precinct_id = rec.lease_ids[0].address_id.precinct_id.id if rec.lease_ids else '' diff --git a/yuthon_property_approval/security/ir.model.access.csv b/yuthon_property_approval/security/ir.model.access.csv index 270c413c7..4658e01f7 100644 --- a/yuthon_property_approval/security/ir.model.access.csv +++ b/yuthon_property_approval/security/ir.model.access.csv @@ -64,4 +64,4 @@ access_property_subset_contract,property_subset_contract,model_property_subset_c access_property_contract_line,property_contract_line,model_property_contract_line,base.group_user,1,1,1,1 access_choose_property_wizard,choose_property_wizard,model_choose_property_wizard,base.group_user,1,1,1,1 -access_property_rental_wizard,property_rental_wizard,model_property_rental_wizard,base.group_user,1,1,1,1 \ No newline at end of file +access_property_rental_wizard,property_rental_wizard,model_property_rental_wizard,base.group_user,1,1,1,1 diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index 104fb4724..80329bedd 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -71,7 +71,7 @@ - + @@ -136,18 +136,22 @@ 日 - - +