diff --git a/yuthon_hr_employee/__manifest__.py b/yuthon_hr_employee/__manifest__.py
index f9e41a957..7b0da0e38 100644
--- a/yuthon_hr_employee/__manifest__.py
+++ b/yuthon_hr_employee/__manifest__.py
@@ -38,6 +38,7 @@
'wizard/hr_employee_wizard_views.xml',
'wizard/hr_employee_time_wizard_views.xml',
'wizard/hr_job_add_wizard_views.xml',
+ 'wizard/medical_manage_wizard_viwes.xml',
'wizard/reset_password_wizard_viwes.xml',
],
'assets': {
diff --git a/yuthon_hr_employee/models/yuthon_medical_manage.py b/yuthon_hr_employee/models/yuthon_medical_manage.py
index e083ac509..a46806428 100644
--- a/yuthon_hr_employee/models/yuthon_medical_manage.py
+++ b/yuthon_hr_employee/models/yuthon_medical_manage.py
@@ -21,7 +21,7 @@ class YuthonMedicalManage(models.Model):
this_year_usage = fields.Float(string='本年使用')
this_year_quota = fields.Float(string='本年额度')
medical_line_ids = fields.One2many('yuthon.medical.line', 'medical_manage_id', string="体检费明细")
- company_id = fields.Many2one("res.company", string="公司", default=lambda self: self.env.company)
+ company_id = fields.Many2one(related="employee_id.company_id", string="公司", default=lambda self: self.env.company)
def button_details(self):
form_id = self.env.ref('yuthon_hr_employee.view_yuthon_medical_manage_form').id
@@ -42,6 +42,15 @@ class YuthonMedicalManage(models.Model):
"views": [[form_id, "form"]],
}
+ def medical_manage_wizard(self):
+ return {
+ 'name': '体检费导入',
+ 'type': 'ir.actions.act_window',
+ 'res_model': 'medical.manage.wizard',
+ 'view_mode': 'form',
+ 'target': 'new',
+ }
+
class YuthonMedicalLine(models.Model):
_name = 'yuthon.medical.line'
_description = '体检费明细'
diff --git a/yuthon_hr_employee/security/ir.model.access.csv b/yuthon_hr_employee/security/ir.model.access.csv
index 167fe5ab7..11eb7fb05 100644
--- a/yuthon_hr_employee/security/ir.model.access.csv
+++ b/yuthon_hr_employee/security/ir.model.access.csv
@@ -23,4 +23,5 @@ access_yuthon_salary_group,yuthon_salary_group,model_yuthon_salary_group,base.gr
access_child_care_line,child_care_line,model_child_care_line,base.group_user,1,1,1,1
access_child_education_line,child_education_line,model_child_education_line,base.group_user,1,1,1,1
access_elderly_support_line,elderly_support_line,model_elderly_support_line,base.group_user,1,1,1,1
-access_reset_password_wizard, reset_password_wizard,model_reset_password_wizard,base.group_user,1,1,1,1
\ No newline at end of file
+access_reset_password_wizard, reset_password_wizard,model_reset_password_wizard,base.group_user,1,1,1,1
+access_medical_manage_wizard, medical_manage_wizard,model_medical_manage_wizard,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/yuthon_hr_employee/views/yuthon_medical_manage_views.xml b/yuthon_hr_employee/views/yuthon_medical_manage_views.xml
index 78c6c174b..c2d99934d 100644
--- a/yuthon_hr_employee/views/yuthon_medical_manage_views.xml
+++ b/yuthon_hr_employee/views/yuthon_medical_manage_views.xml
@@ -75,5 +75,12 @@
yuthon.medical.manage
tree
+
+ 批量导入体检费
+
+
+ code
+ action = model.medical_manage_wizard()
+
diff --git a/yuthon_hr_employee/wizard/__init__.py b/yuthon_hr_employee/wizard/__init__.py
index 4faef946d..c87fda3ed 100644
--- a/yuthon_hr_employee/wizard/__init__.py
+++ b/yuthon_hr_employee/wizard/__init__.py
@@ -2,3 +2,4 @@ from . import hr_employee_wizard
from . import hr_employee_time_wizard
from . import hr_job_add_wizard
from . import reset_password_wizard
+from . import medical_manage_wizard
diff --git a/yuthon_hr_employee/wizard/medical_manage_wizard.py b/yuthon_hr_employee/wizard/medical_manage_wizard.py
new file mode 100644
index 000000000..3351db7a2
--- /dev/null
+++ b/yuthon_hr_employee/wizard/medical_manage_wizard.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+from odoo import models, fields, api, _, SUPERUSER_ID
+from odoo.exceptions import ValidationError, UserError
+from datetime import datetime, timedelta
+import xlrd
+import base64
+import datetime
+from datetime import datetime
+import pandas as pd
+
+
+class MedicalManageWizard(models.Model):
+ _name = 'medical.manage.wizard'
+
+ 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.medical_manage_data(row)
+
+ def medical_manage_data(self, row):
+ employee_id = self.env['hr.employee'].search([('name', '=', row[0].value)], limit=1)
+ this_year_quota = row[1].value
+ last_year_balance = row[2].value
+ this_year_usage = row[3].value
+ current_year_remaining = row[4].value
+ if employee_id:
+ self.env['yuthon.medical.manage'].create({
+ 'employee_id': employee_id.id,
+ 'this_year_quota': this_year_quota,
+ 'last_year_balance': last_year_balance,
+ 'this_year_usage': this_year_usage,
+ 'current_year_remaining': current_year_remaining,
+ })
+
+
diff --git a/yuthon_hr_employee/wizard/medical_manage_wizard_viwes.xml b/yuthon_hr_employee/wizard/medical_manage_wizard_viwes.xml
new file mode 100644
index 000000000..d60160e49
--- /dev/null
+++ b/yuthon_hr_employee/wizard/medical_manage_wizard_viwes.xml
@@ -0,0 +1,34 @@
+
+
+
+ 模板下载
+ self
+ .
+
+
+ 审批意见弹窗
+ medical.manage.wizard
+
+
+
+
+
\ No newline at end of file
diff --git a/yuthon_property/__manifest__.py b/yuthon_property/__manifest__.py
index ffdd80c5f..a4ea85b69 100644
--- a/yuthon_property/__manifest__.py
+++ b/yuthon_property/__manifest__.py
@@ -58,6 +58,7 @@
'wizard/property_meter_wizard_views.xml',
'wizard/property_tenant_wizard_views.xml',
'wizard/evaluation_plan_wizard_views.xml',
+ 'wizard/initialize_wizard_views.xml',
'wizard/property_water_wizard_views.xml',
'wizard/receivable_log_wizard_views.xml',
'wizard/water_price_wizard.xml',
diff --git a/yuthon_property/models/property_accounts_receivable.py b/yuthon_property/models/property_accounts_receivable.py
index 609a4b99f..de724a321 100644
--- a/yuthon_property/models/property_accounts_receivable.py
+++ b/yuthon_property/models/property_accounts_receivable.py
@@ -58,6 +58,16 @@ class PropertyAccountsReceivable(models.Model):
else:
record.submitted = 0
+ def initialize_wizard(self):
+ return {
+ 'name': '应收账单初始化数据弹窗',
+ 'type': 'ir.actions.act_window',
+ 'res_model': 'initialize.wizard',
+ 'view_mode': 'form',
+ 'target': 'new',
+ }
+
+
def invalid(self):
receivable_log = (f'当前登录人{self.env.user.name}于{fields.Datetime.now()}将物业为 {self.property_id.name}的应收账单状态修改为作废')
for record in self:
diff --git a/yuthon_property/security/ir.model.access.csv b/yuthon_property/security/ir.model.access.csv
index b3e2867c3..cc217e889 100644
--- a/yuthon_property/security/ir.model.access.csv
+++ b/yuthon_property/security/ir.model.access.csv
@@ -93,4 +93,5 @@ access_receivable_modify_line, receivable.modify.line,model_receivable_modify_li
access_meter_price_wizard, meter_price_wizard,model_meter_price_wizard,base.group_user,1,1,1,1
access_water_price_wizard, water_price_wizard,model_water_price_wizard,base.group_user,1,1,1,1
-access_hydropower_logs,hydropower.logs,model_hydropower_logs,base.group_user,1,1,1,1
\ No newline at end of file
+access_hydropower_logs,hydropower.logs,model_hydropower_logs,base.group_user,1,1,1,1
+access_initialize_wizard,initialize.wizard,model_initialize_wizard,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/yuthon_property/views/property_accounts_receivable_views.xml b/yuthon_property/views/property_accounts_receivable_views.xml
index 7c9af3ab6..22ab85ec0 100644
--- a/yuthon_property/views/property_accounts_receivable_views.xml
+++ b/yuthon_property/views/property_accounts_receivable_views.xml
@@ -4,7 +4,7 @@
property.accounts.receivable
+ decoration-success="is_reconciliation == True" edit="false" delete="false">
@@ -40,11 +40,11 @@
- 批量导入合同
+ 导入应收初始化数据
code
- action = model.report_button_xls()
+ action = model.initialize_wizard()
发票基本信息模板下载
diff --git a/yuthon_property/views/property_bank_statements_views.xml b/yuthon_property/views/property_bank_statements_views.xml
index dcc957ef5..7437406e6 100644
--- a/yuthon_property/views/property_bank_statements_views.xml
+++ b/yuthon_property/views/property_bank_statements_views.xml
@@ -4,32 +4,17 @@
property.bank.statements.tree
property.bank.statements
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -38,36 +23,22 @@
property.bank.statements.tree
property.bank.statements
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_property/views/property_management_list_views.xml b/yuthon_property/views/property_management_list_views.xml
index 9e4517069..4606e504e 100644
--- a/yuthon_property/views/property_management_list_views.xml
+++ b/yuthon_property/views/property_management_list_views.xml
@@ -4,7 +4,7 @@
property.management.list.tree
property.management.list
-
+
diff --git a/yuthon_property/views/property_rent_list_views.xml b/yuthon_property/views/property_rent_list_views.xml
index 15fca25e5..f46cccc7f 100644
--- a/yuthon_property/views/property_rent_list_views.xml
+++ b/yuthon_property/views/property_rent_list_views.xml
@@ -5,7 +5,7 @@
property.rent.list
+ decoration-success="charge_status == 'fully_paid'" js_class="custom_rent_list_button" edit="false" delete="false">
diff --git a/yuthon_property/views/property_tariff_list_views.xml b/yuthon_property/views/property_tariff_list_views.xml
index 74deede81..997cee1bd 100644
--- a/yuthon_property/views/property_tariff_list_views.xml
+++ b/yuthon_property/views/property_tariff_list_views.xml
@@ -4,7 +4,7 @@
property.tariff.list.tree
property.tariff.list
-
+
diff --git a/yuthon_property/views/property_water_list_views.xml b/yuthon_property/views/property_water_list_views.xml
index 33503a5f5..5241ee273 100644
--- a/yuthon_property/views/property_water_list_views.xml
+++ b/yuthon_property/views/property_water_list_views.xml
@@ -4,7 +4,7 @@
property.water.list.tree
property.water.list
-
+
diff --git a/yuthon_property/wizard/__init__.py b/yuthon_property/wizard/__init__.py
index d72576f0c..db5a4567e 100644
--- a/yuthon_property/wizard/__init__.py
+++ b/yuthon_property/wizard/__init__.py
@@ -7,3 +7,4 @@ from . import evaluation_plan_wizard
from . import receivable_log_wizard
from . import meter_price_wizard
from . import water_price_wizard
+from . import initialize_wizard
diff --git a/yuthon_property/wizard/initialize_wizard.py b/yuthon_property/wizard/initialize_wizard.py
new file mode 100644
index 000000000..0ac8c9f44
--- /dev/null
+++ b/yuthon_property/wizard/initialize_wizard.py
@@ -0,0 +1,53 @@
+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
+import re
+
+class InitializeWizard(models.TransientModel):
+ _name = 'initialize.wizard'
+ _description = '应收账单初始化数据弹窗'
+
+ 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_initializer_data(row)
+
+ def property_initializer_data(self, row):
+ contract_id = self.env['property.lease.contract'].search([('contract_code', '=', row[0].value)], limit=1)
+ property_id = self.env['yuthon.property'].search([('name', '=', row[1].value)], limit=1)
+ lessee_id = self.env['property.tenant.information'].search([('name', '=', row[2].value)], limit=1)
+ due_date = datetime.strptime(row[3].value, '%Y-%m-%d')
+ if row[4].value:
+ due_date_end = datetime.strptime(row[4].value, '%Y-%m-%d')
+ else:
+ due_date_end = False
+ original_amount = row[5].value
+ submitted = row[6].value
+ management_type_id = self.env['yuthon.management.type'].search([('name', '=', row[8].value)], limit=1)
+ remark = row[7].value
+
+ self.env['property.accounts.receivable'].create({
+ 'contract_id': contract_id.id if contract_id else False,
+ 'property_id': property_id.id if property_id else False,
+ 'lessee_id': lessee_id.id,
+ 'due_date': due_date,
+ 'due_date_end': due_date_end,
+ 'original_amount': original_amount,
+ 'submitted': submitted,
+ 'management_type_id': management_type_id.id,
+ 'remark': remark,
+ })
diff --git a/yuthon_property/wizard/initialize_wizard_views.xml b/yuthon_property/wizard/initialize_wizard_views.xml
new file mode 100644
index 000000000..baddaca2a
--- /dev/null
+++ b/yuthon_property/wizard/initialize_wizard_views.xml
@@ -0,0 +1,34 @@
+
+
+
+ 初始化模板下载
+ self
+ .
+
+
+ 审批意见弹窗
+ initialize.wizard
+
+
+
+
+
\ No newline at end of file
diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml
index cd7f9fbb6..72572c4c5 100644
--- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml
+++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml
@@ -489,7 +489,7 @@
-
+
@@ -500,7 +500,7 @@
property.bank.statements
-
+
diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml
index a95903271..61101e55b 100644
--- a/yuthon_property_approval/views/property_lease_contract.xml
+++ b/yuthon_property_approval/views/property_lease_contract.xml
@@ -365,7 +365,7 @@
property.lease.contract.tree
property.lease.contract
-
+