From 3201775b0a1dde8a9689e364c5a5e345f1581a9b Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Mon, 30 Dec 2024 11:46:57 +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_hr_employee/__manifest__.py | 2 +-
.../models/yuthon_hr_employee.py | 7 +-
.../security/hr_company_security_group.xml | 39 +++++++
yuthon_hr_employee/security/hr_group.xml | 2 +-
.../hr_job_company_security_group.xml | 12 ---
.../views/yuthon_hr_employee_views.xml | 2 -
.../models/property_management_list.py | 2 +-
yuthon_property/models/property_other_list.py | 2 +-
.../models/property_penalty_list.py | 2 +-
yuthon_property/models/property_rent_list.py | 2 +-
.../models/property_tariff_list.py | 2 +-
yuthon_property/models/property_water_list.py | 2 +-
yuthon_property/models/yuthon_property.py | 2 +-
.../models/property_lease_contract.py | 100 ++++++++++++------
.../security/ir.model.access.csv | 4 +-
.../views/property_lease_contract.xml | 93 ++++++++--------
16 files changed, 172 insertions(+), 103 deletions(-)
create mode 100644 yuthon_hr_employee/security/hr_company_security_group.xml
delete mode 100644 yuthon_hr_employee/security/hr_job_company_security_group.xml
diff --git a/yuthon_hr_employee/__manifest__.py b/yuthon_hr_employee/__manifest__.py
index d7b2f38fe..cb55d5fef 100644
--- a/yuthon_hr_employee/__manifest__.py
+++ b/yuthon_hr_employee/__manifest__.py
@@ -20,7 +20,7 @@
'data/publish_applicant_setting_data.xml',
'security/ir.model.access.csv',
'security/hr_group.xml',
- 'security/hr_job_company_security_group.xml',
+ 'security/hr_company_security_group.xml',
'views/yuthon_hr_employee_views.xml',
'views/yuthon_hr_department_views.xml',
'views/applicant_tage_setting_views.xml',
diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py
index 0abf50e19..b64bd6ca4 100644
--- a/yuthon_hr_employee/models/yuthon_hr_employee.py
+++ b/yuthon_hr_employee/models/yuthon_hr_employee.py
@@ -73,7 +73,6 @@ class YuthonHrEmployee(models.Model):
social_insurance_date = fields.Date(string="缴纳社保日期")
social_insurance_time = fields.Char(string="社保时长", compute='_compute_social_insurance_info', store=True)
compute_month = fields.Integer(string="社保时长假期")
- open_start_time_today = fields.Date(string="工作至今")
interrupt_work_month = fields.Integer(string="中断工作月数")
cumulative_work_month = fields.Integer(string="累计工作月数", compute='_compute_social_insurance_info', store=True)
cumulative_work_years = fields.Char(string="累计工作年限", compute='_compute_cumulative_work_years', store=True)
@@ -243,13 +242,13 @@ class YuthonHrEmployee(models.Model):
else:
record.company_old = None
- @api.depends('social_insurance_date', 'interrupt_work_month')
+ @api.depends('open_start_time', 'interrupt_work_month')
def _compute_social_insurance_info(self):
for record in self:
cumulative_months = 0
- if record.social_insurance_date:
+ if record.open_start_time:
today = datetime.now().date()
- delta = relativedelta(today, record.social_insurance_date)
+ delta = relativedelta(today, record.open_start_time)
cumulative_months = delta.years * 12 + delta.months
record.cumulative_work_month = cumulative_months
total_months = cumulative_months - record.interrupt_work_month
diff --git a/yuthon_hr_employee/security/hr_company_security_group.xml b/yuthon_hr_employee/security/hr_company_security_group.xml
new file mode 100644
index 000000000..ef9eeabf4
--- /dev/null
+++ b/yuthon_hr_employee/security/hr_company_security_group.xml
@@ -0,0 +1,39 @@
+
+
+
+ 岗位编制公司过滤
+
+ [('yuthon_company', '=', user.employee_id.yuthon_company)]
+
+
+
+
+
+
+ 花名册公司过滤
+
+ [('yuthon_company', '=', user.employee_id.yuthon_company)]
+
+
+
+
+
+
+ 角色公司过滤
+
+ [('yuthon_company', '=', user.employee_id.yuthon_company)]
+
+
+
+
+
+
+ 部门公司过滤
+
+ [('yuthon_company', '=', user.employee_id.yuthon_company)]
+
+
+
+
+
+
diff --git a/yuthon_hr_employee/security/hr_group.xml b/yuthon_hr_employee/security/hr_group.xml
index b1b09290a..b674b3c6b 100644
--- a/yuthon_hr_employee/security/hr_group.xml
+++ b/yuthon_hr_employee/security/hr_group.xml
@@ -16,7 +16,7 @@
User: 角色匹配的数据访问
-
+
diff --git a/yuthon_hr_employee/security/hr_job_company_security_group.xml b/yuthon_hr_employee/security/hr_job_company_security_group.xml
deleted file mode 100644
index 1eeb7be81..000000000
--- a/yuthon_hr_employee/security/hr_job_company_security_group.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- 岗位编制公司过滤
-
- [('yuthon_company', '=', user.employee_id.yuthon_company)]
-
-
-
-
-
-
diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
index d42d3072f..4803ee5cb 100644
--- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
+++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
@@ -116,7 +116,6 @@
-
@@ -237,7 +236,6 @@
-
diff --git a/yuthon_property/models/property_management_list.py b/yuthon_property/models/property_management_list.py
index 0986cce1c..f860f17b6 100644
--- a/yuthon_property/models/property_management_list.py
+++ b/yuthon_property/models/property_management_list.py
@@ -7,7 +7,7 @@ class PropertyManagementList(models.Model):
contract_code = fields.Char(string='合同编号', required=True)
property_id = fields.Many2one('yuthon.property', string='物业')
- lessee_id = fields.Many2one('yuthon.property.lessee', string='承租方')
+ lessee_id = fields.Many2one('property.tenant.information', string='承租方')
due_date = fields.Date(string='应收日期')
year = fields.Char(string='所属年')
month = fields.Char(string='所属月')
diff --git a/yuthon_property/models/property_other_list.py b/yuthon_property/models/property_other_list.py
index dad5cb4e0..bd69ff33b 100644
--- a/yuthon_property/models/property_other_list.py
+++ b/yuthon_property/models/property_other_list.py
@@ -7,4 +7,4 @@ class PropertyOtherList(models.Model):
contract_code = fields.Char(string='合同编号', required=True)
property_id = fields.Many2one('yuthon.property', string='物业')
- lessee_id = fields.Many2one('yuthon.property.lessee', string='承租方')
+ lessee_id = fields.Many2one('property.tenant.information', string='承租方')
diff --git a/yuthon_property/models/property_penalty_list.py b/yuthon_property/models/property_penalty_list.py
index 181f0c3d6..3e6680831 100644
--- a/yuthon_property/models/property_penalty_list.py
+++ b/yuthon_property/models/property_penalty_list.py
@@ -7,7 +7,7 @@ class PropertyPenaltyList(models.Model):
contract_code = fields.Char(string='合同编号', required=True)
property_id = fields.Many2one('yuthon.property', string='物业')
- lessee_id = fields.Many2one('yuthon.property.lessee', string='承租方')
+ lessee_id = fields.Many2one('property.tenant.information', string='承租方')
rent_id = fields.Char(string='租金id')
start_date = fields.Date(string='开始日期')
end_date = fields.Date(string='结束日期')
diff --git a/yuthon_property/models/property_rent_list.py b/yuthon_property/models/property_rent_list.py
index 21a0a0e06..ea677dfa0 100644
--- a/yuthon_property/models/property_rent_list.py
+++ b/yuthon_property/models/property_rent_list.py
@@ -7,7 +7,7 @@ class PropertyRentList(models.Model):
contract_code = fields.Char(string='合同编号', required=True)
property_id = fields.Many2one('yuthon.property', string='物业')
- lessee_id = fields.Many2one('yuthon.property.lessee', string='承租方')
+ lessee_id = fields.Many2one('property.tenant.information', string='承租方')
due_date = fields.Date(string='应收日期')
year = fields.Char(string='所属年')
month = fields.Char(string='所属月')
diff --git a/yuthon_property/models/property_tariff_list.py b/yuthon_property/models/property_tariff_list.py
index dfd7c1211..2dc27b896 100644
--- a/yuthon_property/models/property_tariff_list.py
+++ b/yuthon_property/models/property_tariff_list.py
@@ -7,7 +7,7 @@ class PropertyTariffList(models.Model):
contract_code = fields.Char(string='合同编号')
property_id = fields.Many2one('yuthon.property', string='物业')
- lessee_id = fields.Many2one('yuthon.property.lessee', string='承租方')
+ lessee_id = fields.Many2one('property.tenant.information', string='承租方')
tariff_meter_number = fields.Char(string='电费编号')
due_date = fields.Date(string='应收日期')
year = fields.Char(string='所属年')
diff --git a/yuthon_property/models/property_water_list.py b/yuthon_property/models/property_water_list.py
index 90d6e68ce..8b0475e84 100644
--- a/yuthon_property/models/property_water_list.py
+++ b/yuthon_property/models/property_water_list.py
@@ -7,7 +7,7 @@ class PropertyWaterList(models.Model):
contract_code = fields.Char(string='合同编号')
property_id = fields.Many2one('yuthon.property', string='物业')
- lessee_id = fields.Many2one('yuthon.property.lessee', string='承租方')
+ lessee_id = fields.Many2one('property.tenant.information', string='承租方')
water_meter_number = fields.Char(string='水表编号')
due_date = fields.Date(string='应收日期')
year = fields.Char(string='所属年')
diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py
index 89b76a7de..dde9ba63d 100644
--- a/yuthon_property/models/yuthon_property.py
+++ b/yuthon_property/models/yuthon_property.py
@@ -63,7 +63,7 @@ class YuthonProperty(models.Model):
end_date = fields.Date(string="失效日期")
purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
admin_id = fields.Many2one('res.users', string="管理员")
- lessee_id = fields.Many2one('yuthon.property.lessee', string='承租方')
+ lessee_id = fields.Many2one('property.tenant.information', string='承租方')
title_address = fields.Many2one('yuthon.property.message', string="产权地址")
yuthon_company = fields.Selection([('thtz', '天河投资'), ('thwg', '天河物管'), ('thlc', '天河粮储'), ('thtj', '天城投建'), ('housing', '房总')],string="所属公司")
rental_address = fields.Text(string="出租地址")
diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py
index 2437ccab3..48919bd57 100644
--- a/yuthon_property_approval/models/property_lease_contract.py
+++ b/yuthon_property_approval/models/property_lease_contract.py
@@ -29,24 +29,25 @@ class PropertyLeaseContract(models.Model):
_rec_name = 'name'
name = fields.Char(string='物业信息')
- serial_number = fields.Char(string="流水号")
+ code = fields.Char(string="流水号", default=lambda self: self.env['ir.sequence'].next_by_code('property_lease_contract_code'))
admin_id = fields.Many2one('res.users', string="管理员")
- code = fields.Char(string="合同编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_lease_contract_code'))
- property_documents_ids = fields.Many2many('documents.document', string="租赁合同文件")
+ contract_code = fields.Char(string="合同编号")
+ property_documents_ids = fields.Many2many('ir.attachment', string="租赁合同文件")
lessor = fields.Char(string="出租方")
- lessee_id = fields.Many2one('yuthon.property.lessee', string='承租方')
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
- #承租方的个人信息
- contact = fields.Char(string="联系人")
- phone = fields.Char(string="联系电话")
- email = fields.Char(string="电子邮箱")
- invoicing_type = fields.Selection([('spot', '专票'), ('cape', '普票')], string="开票类型")
- rental_purposes = fields.Many2one('yuthon.rental.purpose',string="出租用途")
- invoicing_begins = fields.Char(string="开票开头")
- tax_number = fields.Char(string="税号")
- industry = fields.Char(string="行业")
- address_for_delivery = fields.Char(string="送达地址")
+ # 承租方的个人信息
+ lessee_id = fields.Many2one('property.tenant.information', string='承租方')
+ contact = fields.Char(related='lessee_id.contact', string="联系人")
+ phone = fields.Char(related='lessee_id.phone', string="联系电话")
+ email = fields.Char(related='lessee_id.email', string="电子邮箱")
+ invoicing_type = fields.Selection([('spot', '专票'), ('cape', '普票')], related='lessee_id.invoicing_type', string="开票类型")
+ rental_purposes = fields.Many2one(related='lessee_id.rental_purposes', string="出租用途")
+ invoicing_begins = fields.Char(related='lessee_id.invoicing_begins', string="开票开头")
+ tax_number = fields.Char(related='lessee_id.tax_number', string="税号")
+ industry = fields.Char(related='lessee_id.industry', string="行业")
+ address_for_delivery = fields.Text(related='lessee_id.address',string="送达地址")
+
lease_term = fields.Float(string="租期")
lease_term_year = fields.Integer(string="租期(年)")
# lease_term_year_uom = fields.Selection([('year', '年')], default="year", readonly=True, string="免租期单位")
@@ -55,7 +56,8 @@ class PropertyLeaseContract(models.Model):
term_start_time = fields.Date(string="租期开始时间", default=fields.Datetime.now)
term_end_time = fields.Date(string="租期结束时间")
cycle_dict =fields.Selection([('monthly','月度'), ('quarter','季度'), ('half','半年'),('year','年度')],string='付款方式')
- cycle_mode = fields.Selection([('fixed','合同月'), ('floating','自然月')],string='周期方式')
+ cycle_mode = fields.Selection([('fixed_monthly','合同月'), ('floating_monthly','自然月'), ('fixed_quarter', '合同季'), ('floating_monthly', '自然季'),
+ ('fixed_year', '合同年'), ('floating_year', '自然年')], string='周期方式', default='fixed_monthly')
expected_reminders = fields.Char(string="逾期提醒")
increment_method = fields.Selection([('percentage','百分比'),('increment_price','递增单价'),('increment_amount','递增金额')], string='每月递增', default='percentage')
increment_percentage = fields.Float(string="递增百分比")
@@ -84,28 +86,28 @@ class PropertyLeaseContract(models.Model):
tax = fields.Float(string="税金")
miscellaneous = fields.Char(string="其他约定")
total_area = fields.Float(string="总面积", digits=(16, 4))
- hydropower_company = fields.Char(string="收管理水电公司名称")
- hydropower_account = fields.Char(string="收管理水电公司账号")
- contract_type = fields.Selection([('lease_renewal', '续租'), ('interim', '临租'), ('new', '补充协议')], string="合同类型")
+ contract_type = fields.Selection([('lease_renewal', '续租'), ('interim', '临租'), ('new', '补充协议'), ('first', '首租')], string="合同类型", default='first')
rent_company = fields.Char(string="收租公司名称")
rent_account = fields.Char(string="收租公司账号")
lease_ids = fields.One2many('property.lease.contract.line', 'lease_id',string="租赁信息明细行")
breakdown_ids = fields.One2many('property.rent.breakdown.line', 'breakdown_id', string="物业租金明细行")
- fee_ids = fields.One2many('property.meter.fee.line', 'fee_id', string="物业仪表费明细行")
+ water_fee_ids = fields.One2many('property.water.fee.line', 'contract_id', string="物业水费明细行")
+ electricity_fee_ids = fields.One2many('property.electric.fee.line', 'contract_id', string="物业电费明细行")
+ mange_fee_ids = fields.One2many('property.manage.fee.line', 'contract_id', string="物业管理费明细行")
other_ids = fields.One2many('property.other.fee.line', 'other_id', string="其他费用明细行")
rent_list_ids = fields.One2many('property.rent.list', 'contract_id', string="租金明细行")
management_list_ids = fields.One2many('property.management.list', 'contract_id', string="管理费用明细行")
# 附件
- license_id = fields.Many2one('documents.document', string="营业执照")
- card_id = fields.Many2one('documents.document', string="身份证")
- legal_entity_id = fields.Many2one('documents.document', string="法人身份证")
- power_attorney_id = fields.Many2one('documents.document', string="授权委托书")
- handle_cards_id = fields.Many2one('documents.document', string="经办人身份证")
- confirmation_transaction_id = fields.Many2one('documents.document', string="交易确认书")
- responsibility_book_id = fields.Many2one('documents.document', string="安全生产责任书")
- contract_id = fields.Many2one('documents.document', string="合同")
- safety_id = fields.Many2one('documents.document', string="安全生产")
+ license_id = fields.Many2one('ir.attachment', string="营业执照")
+ card_id = fields.Many2one('ir.attachment', string="身份证")
+ legal_entity_id = fields.Many2one('ir.attachment', string="法人身份证")
+ power_attorney_id = fields.Many2one('ir.attachment', string="授权委托书")
+ handle_cards_id = fields.Many2one('ir.attachment', string="经办人身份证")
+ confirmation_transaction_id = fields.Many2one('ir.attachment', string="交易确认书")
+ responsibility_book_id = fields.Many2one('ir.attachment', string="安全生产责任书")
+ contract_id = fields.Many2one('ir.attachment', string="合同")
+ safety_id = fields.Many2one('ir.attachment', string="安全生产")
contract_time = fields.Date(string="合同签订日期")
handover_time = fields.Date(string="交接日期")
@@ -128,7 +130,6 @@ class PropertyLeaseContract(models.Model):
end_date = start_date + relativedelta(months=12)
all_period_rent = record.my_compute_all_period_rent(start_date, end_date)
record.first_year_rent = all_period_rent
-
all_start_date = record.term_start_time
all_end_date = record.term_end_time + relativedelta(days=1)
record.total_contract_receivables = record.my_compute_all_period_rent(all_start_date, all_end_date)
@@ -155,6 +156,15 @@ class PropertyLeaseContract(models.Model):
start_time = end_of_range
return time_ranges
+ @api.onchange('cycle_dict')
+ def onchange_cycle_dict(self):
+ if self.cycle_dict == 'monthly':
+ self.cycle_mode = 'fixed_monthly'
+ elif self.cycle_dict == 'quarter':
+ self.cycle_mode = 'fixed_quarter'
+ elif self.cycle_dict == 'year':
+ self.cycle_mode = 'fixed_year'
+
# @staticmethod
# def divide_time_range_floating(start_time, end_time, months):
# time_ranges = []
@@ -452,11 +462,35 @@ class PropertyRentBreakdownLine(models.Model):
month_number = fields.Integer(string="期间月数")
period_rent = fields.Float(string="期间租金")
-class PropertyMeterFeeLine(models.Model):
- _name = 'property.meter.fee.line'
- _description = '物业仪表费明细行'
- fee_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
+class PropertyWaterFeeLine(models.Model):
+ _name = 'property.water.fee.line'
+ _description = '物业水费明细行'
+
+ contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
+ charges = fields.Char(string="收费项")
+ fees = fields.Char(string="收费标准")
+ proportional = fields.Float(string="赔率/比例")
+ start_data = fields.Date(string="开始日期")
+ end_data = fields.Date(string="结束日期")
+
+
+class PropertyElectricFeeLine(models.Model):
+ _name = 'property.electric.fee.line'
+ _description = '物业电费明细行'
+
+ contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
+ charges = fields.Char(string="收费项")
+ fees = fields.Char(string="收费标准")
+ proportional = fields.Float(string="赔率/比例")
+ start_data = fields.Date(string="开始日期")
+ end_data = fields.Date(string="结束日期")
+
+class PropertyManageFeeLine(models.Model):
+ _name = 'property.manage.fee.line'
+ _description = '物业管理费明细行'
+
+ contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
charges = fields.Char(string="收费项")
fees = fields.Char(string="收费标准")
proportional = fields.Float(string="赔率/比例")
diff --git a/yuthon_property_approval/security/ir.model.access.csv b/yuthon_property_approval/security/ir.model.access.csv
index 8ff78a0c4..cea1e788d 100644
--- a/yuthon_property_approval/security/ir.model.access.csv
+++ b/yuthon_property_approval/security/ir.model.access.csv
@@ -27,7 +27,9 @@ access_property_equity,property_equity,model_property_equity,base.group_user,1,1
access_property_information_detail_lines,property_information_detail_lines,model_property_information_detail_lines,base.group_user,1,1,1,1
access_property_lease_contract_line,property_lease_contract_line,model_property_lease_contract_line,base.group_user,1,1,1,1
access_property_rent_breakdown_line,property_rent_breakdown_line,model_property_rent_breakdown_line,base.group_user,1,1,1,1
-access_property_meter_fee_line,property_meter_fee_line,model_property_meter_fee_line,base.group_user,1,1,1,1
+access_property_water_fee_line,property_water_fee_line,model_property_water_fee_line,base.group_user,1,1,1,1
+access_property_electric_fee_line,property_electric_fee_line,model_property_electric_fee_line,base.group_user,1,1,1,1
+access_property_manage_fee_line,property_manage_fee_line,model_property_manage_fee_line,base.group_user,1,1,1,1
access_property_other_fee_line,property_other_fee_line,model_property_other_fee_line,base.group_user,1,1,1,1
access_property_renamed,property_renamed,model_property_renamed,base.group_user,1,1,1,1
access_property_lessee_change,property_lessee_change,model_property_lessee_change,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 ce6be273e..f686eac9a 100644
--- a/yuthon_property_approval/views/property_lease_contract.xml
+++ b/yuthon_property_approval/views/property_lease_contract.xml
@@ -27,9 +27,9 @@
+
-
@@ -38,7 +38,7 @@
-
+
@@ -70,7 +70,13 @@
-
+
+
+
+
+
+
+
@@ -78,7 +84,13 @@
-
+
+
+
+
+
+
+
@@ -90,40 +102,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -152,17 +137,41 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+