From ccfb84aa6a1260e1022e8140639e4c00f3003051 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Sat, 11 Jan 2025 15:27:53 +0800
Subject: [PATCH 1/3] =?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
---
.../models/property_lease_contract.py | 48 +++++++++++++++++--
.../views/property_lease_contract.xml | 7 ++-
.../wizard/property_rental_wizard.py | 7 ++-
3 files changed, 53 insertions(+), 9 deletions(-)
diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py
index b49e20b65..b7a846d71 100644
--- a/yuthon_property_approval/models/property_lease_contract.py
+++ b/yuthon_property_approval/models/property_lease_contract.py
@@ -144,7 +144,6 @@ class PropertyLeaseContract(models.Model):
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('ir.attachment', string="营业执照")
card_id = fields.Many2one('ir.attachment', string="经办人身份证")
@@ -155,6 +154,49 @@ class PropertyLeaseContract(models.Model):
responsibility_book_id = fields.Many2one('ir.attachment', string="安全生产责任书")
handover_time = fields.Date(string="交接日期")
+ def get_breakdown_rent(self, select_month, select_year):
+ rent_monthly = 0
+ monthly_records = self.env['property.lease.contract'].search([('cycle_dict', '=', 'monthly')])
+ year = int(select_year)
+ month = int(select_month)
+ date_field = datetime(year, month, 1).date()
+ for record in monthly_records:
+ days = record.date_payment_month
+ if not record.rent_free_period_month:
+ for rent_id in record.breakdown_ids:
+ start_date_year_month = rent_id.start_date.strftime('%Y-%m')
+ end_date_year_month = rent_id.end_date.strftime('%Y-%m')
+ date_field_year_month = date_field.strftime('%Y-%m')
+ if start_date_year_month <= date_field_year_month < end_date_year_month:
+ rent_monthly = rent_id.monthly_amount
+ elif start_date_year_month <= date_field_year_month <= end_date_year_month:
+ end_days = rent_id.end_date.day
+ if end_days < days:
+ rent_monthly = rent_id.monthly_amount
+ else:
+ rent_monthly = rent_id[+1].monthly_amount
+ else:
+ pass
+ else:
+ period_month = record.rent_free_period_month
+ for rent_id in record.breakdown_ids:
+ start_date_year_month = (rent_id.start_date + relativedelta(months=period_month)).strftime('%Y-%m')
+ end_date_year_month = rent_id.end_date.strftime('%Y-%m')
+ date_field_year_month = date_field.strftime('%Y-%m')
+ if start_date_year_month <= date_field_year_month < end_date_year_month:
+ rent_monthly = rent_id.monthly_amount
+ elif start_date_year_month <= date_field_year_month <= end_date_year_month:
+ end_days = rent_id.end_date.day
+ if end_days < days:
+ rent_monthly = rent_id.monthly_amount
+ else:
+ rent_monthly = rent_id[+1].monthly_amount
+ else:
+ pass
+
+ return rent_monthly
+
+
@api.depends('not_received', 'now_receivable')
def _compute_comparison(self):
for record in self:
@@ -416,7 +458,7 @@ class PropertyLeaseContract(models.Model):
all_period_rent = record.do_generate_details_core(start_date, first_year_end_date, False)
record.first_year_rent = all_period_rent
- def do_generate_details_core(self, start_date=None, end_date=None, write_db=False):
+ def do_generate_details_core(self, start_date, end_date, write_db=False):
all_period_rent = 0
unit_price = self.unit_price # 单价
@@ -823,7 +865,7 @@ class PropertyLeaseContract(models.Model):
rec.is_electricity = True
for electricity_id in property_id.energy_meter_ids:
electricity_list.append([0, 0, {
- 'fees_id': property_id.electricity_id.id,
+ 'fees_id': electricity_id.id,
'proportional':electricity_id.rate,
}])
else:
diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml
index 789e832e1..a86ae79fc 100644
--- a/yuthon_property_approval/views/property_lease_contract.xml
+++ b/yuthon_property_approval/views/property_lease_contract.xml
@@ -310,7 +310,7 @@
-
+
@@ -379,7 +379,7 @@
-
+
@@ -624,6 +624,7 @@
+
@@ -646,6 +647,7 @@
全部合同
property.lease.contract
+ [('condition', 'in', ['be_executed', 'executed', 'expired' ,'advance'])]
tree,form,search
合同审批
property.lease.contract
tree,form,search
+ [('condition', 'in', ['new', 'approval', 'cancel'])]
{'search_default_group_by_condition':1}
Date: Sat, 11 Jan 2025 15:27:53 +0800
Subject: [PATCH 2/3] =?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
---
.../models/property_lease_contract.py | 48 +++++++++++++++++--
.../views/property_lease_contract.xml | 7 ++-
.../wizard/property_rental_wizard.py | 7 ++-
3 files changed, 53 insertions(+), 9 deletions(-)
diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py
index b49e20b65..b7a846d71 100644
--- a/yuthon_property_approval/models/property_lease_contract.py
+++ b/yuthon_property_approval/models/property_lease_contract.py
@@ -144,7 +144,6 @@ class PropertyLeaseContract(models.Model):
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('ir.attachment', string="营业执照")
card_id = fields.Many2one('ir.attachment', string="经办人身份证")
@@ -155,6 +154,49 @@ class PropertyLeaseContract(models.Model):
responsibility_book_id = fields.Many2one('ir.attachment', string="安全生产责任书")
handover_time = fields.Date(string="交接日期")
+ def get_breakdown_rent(self, select_month, select_year):
+ rent_monthly = 0
+ monthly_records = self.env['property.lease.contract'].search([('cycle_dict', '=', 'monthly')])
+ year = int(select_year)
+ month = int(select_month)
+ date_field = datetime(year, month, 1).date()
+ for record in monthly_records:
+ days = record.date_payment_month
+ if not record.rent_free_period_month:
+ for rent_id in record.breakdown_ids:
+ start_date_year_month = rent_id.start_date.strftime('%Y-%m')
+ end_date_year_month = rent_id.end_date.strftime('%Y-%m')
+ date_field_year_month = date_field.strftime('%Y-%m')
+ if start_date_year_month <= date_field_year_month < end_date_year_month:
+ rent_monthly = rent_id.monthly_amount
+ elif start_date_year_month <= date_field_year_month <= end_date_year_month:
+ end_days = rent_id.end_date.day
+ if end_days < days:
+ rent_monthly = rent_id.monthly_amount
+ else:
+ rent_monthly = rent_id[+1].monthly_amount
+ else:
+ pass
+ else:
+ period_month = record.rent_free_period_month
+ for rent_id in record.breakdown_ids:
+ start_date_year_month = (rent_id.start_date + relativedelta(months=period_month)).strftime('%Y-%m')
+ end_date_year_month = rent_id.end_date.strftime('%Y-%m')
+ date_field_year_month = date_field.strftime('%Y-%m')
+ if start_date_year_month <= date_field_year_month < end_date_year_month:
+ rent_monthly = rent_id.monthly_amount
+ elif start_date_year_month <= date_field_year_month <= end_date_year_month:
+ end_days = rent_id.end_date.day
+ if end_days < days:
+ rent_monthly = rent_id.monthly_amount
+ else:
+ rent_monthly = rent_id[+1].monthly_amount
+ else:
+ pass
+
+ return rent_monthly
+
+
@api.depends('not_received', 'now_receivable')
def _compute_comparison(self):
for record in self:
@@ -416,7 +458,7 @@ class PropertyLeaseContract(models.Model):
all_period_rent = record.do_generate_details_core(start_date, first_year_end_date, False)
record.first_year_rent = all_period_rent
- def do_generate_details_core(self, start_date=None, end_date=None, write_db=False):
+ def do_generate_details_core(self, start_date, end_date, write_db=False):
all_period_rent = 0
unit_price = self.unit_price # 单价
@@ -823,7 +865,7 @@ class PropertyLeaseContract(models.Model):
rec.is_electricity = True
for electricity_id in property_id.energy_meter_ids:
electricity_list.append([0, 0, {
- 'fees_id': property_id.electricity_id.id,
+ 'fees_id': electricity_id.id,
'proportional':electricity_id.rate,
}])
else:
diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml
index 789e832e1..a86ae79fc 100644
--- a/yuthon_property_approval/views/property_lease_contract.xml
+++ b/yuthon_property_approval/views/property_lease_contract.xml
@@ -310,7 +310,7 @@
-
+
@@ -379,7 +379,7 @@
-
+
@@ -624,6 +624,7 @@
+
@@ -646,6 +647,7 @@
全部合同
property.lease.contract
+ [('condition', 'in', ['be_executed', 'executed', 'expired' ,'advance'])]
tree,form,search
合同审批
property.lease.contract
tree,form,search
+ [('condition', 'in', ['new', 'approval', 'cancel'])]
{'search_default_group_by_condition':1}
Date: Sat, 11 Jan 2025 16:19:17 +0800
Subject: [PATCH 3/3] =?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
---
.../models/property_lease_contract.py | 17 +++++++++++------
.../views/property_lease_contract.xml | 5 +++--
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py
index b7a846d71..e3658acea 100644
--- a/yuthon_property_approval/models/property_lease_contract.py
+++ b/yuthon_property_approval/models/property_lease_contract.py
@@ -66,6 +66,7 @@ class PropertyLeaseContract(models.Model):
tax_number = fields.Char(related='lessee_id.tax_number', string="税号")
industry_id = fields.Many2one(related='lessee_id.industry_id', string="行业")
address_for_delivery = fields.Char(string="送达地址")
+ precinct_id = fields.Many2one('yuthon.precinct.message', string="所属片区")
lease_term = fields.Float(string="租期")
lease_term_year = fields.Integer(string="租期(年)")
@@ -128,7 +129,7 @@ class PropertyLeaseContract(models.Model):
actual_receivable = fields.Float(string="实际应收")
now_receivable = fields.Float(string="当期应收")
total_receivable = fields.Float(string="总已收")
- comparison = fields.Selection([('outweigh', '大于'), ('equal', '等于'), ('less', '小于')], string="对比", compute='_compute_comparison', store=True)
+ comparison = fields.Selection([('outweigh', '大于'), ('equal', '等于'), ('less', '小于')], string="对比", compute='_compute_comparison')
progress_percentage = fields.Float(string="合同进度", compute="_compute_progress_percentage")
condition = fields.Selection([('new', '新建'), ('approval', '审批中'), ('cancel', '作废'), ('be_executed', '待执行'), ('executed', '已执行'), ('expired', '已终止'), ('advance', '提前终止')], string="状态", default='new')
contract_type = fields.Selection([('lease_renewal', '续租'), ('interim', '临租'), ('new', '补充协议'), ('first', '首租')], string="合同类型", default='first')
@@ -184,13 +185,13 @@ class PropertyLeaseContract(models.Model):
end_date_year_month = rent_id.end_date.strftime('%Y-%m')
date_field_year_month = date_field.strftime('%Y-%m')
if start_date_year_month <= date_field_year_month < end_date_year_month:
- rent_monthly = rent_id.monthly_amount
+ rent_monthly = rent_id.period_rent
elif start_date_year_month <= date_field_year_month <= end_date_year_month:
end_days = rent_id.end_date.day
if end_days < days:
- rent_monthly = rent_id.monthly_amount
+ rent_monthly = rent_id.period_rent
else:
- rent_monthly = rent_id[+1].monthly_amount
+ rent_monthly = rent_id[+1].period_rent
else:
pass
@@ -207,6 +208,8 @@ class PropertyLeaseContract(models.Model):
record.comparison = 'less'
else:
record.comparison = 'equal'
+ else:
+ record.comparison = None
@api.depends('term_end_time', 'actual_end_time', 'term_start_time')
def _compute_end_comparison(self):
@@ -882,7 +885,8 @@ class PropertyLeaseContract(models.Model):
rec.electricity_fee_ids = [(5, 0, 0)]
rec.mange_fee_ids = [(5, 0, 0)]
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.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 ''
rec.electricity_fee_ids = electricity_list
rec.mange_fee_ids = fee_list
@@ -893,7 +897,8 @@ class PropertyLeaseContract(models.Model):
admin_id = record.lease_ids[0].admin_id.id if record.lease_ids else ''
record.write({'company_id': company_id,
'admin_id': admin_id,
- 'actual_end_time': datetime.now()})
+ 'actual_end_time': datetime.now(),
+ 'precinct_id': record.lease_ids[0].address_id.precinct_id.id if record.lease_ids else ''})
def action_yuthon_property_contract_wizard(self):
return {
diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml
index a86ae79fc..94ea5bdc0 100644
--- a/yuthon_property_approval/views/property_lease_contract.xml
+++ b/yuthon_property_approval/views/property_lease_contract.xml
@@ -423,6 +423,7 @@
+
@@ -624,7 +625,7 @@
-
+
@@ -638,7 +639,7 @@
我的合同
property.lease.contract
tree,form,search
- [('admin_id','=',uid)]
+ [('admin_id', '=', uid)]
{'search_default_group_by_condition':1}