Merge pull request !1183 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-01-08 02:14:22 +00:00
committed by Gitee
7 changed files with 67 additions and 41 deletions
+6 -2
View File
@@ -42,7 +42,7 @@ class YuthonProperty(models.Model):
is_confirm_authorization = fields.Boolean(string="确权")
property_card = fields.Html(string="产权证")
life_timer = fields.Datetime(string="使用时间")
property_use_time = fields.Selection([('a', '70年'), ('b', '40年')], string="使用年限")
property_use_time = fields.Selection([('a', '70年'), ('b', '40年'), ('c', '50年'), ('e', '30年'), ('f', '60年')], string="产权年限")
asset_type_id = fields.Many2one('yuthon.resource.type', string="出租类型")
is_hvac = fields.Boolean(string="使用中央空调")
is_handle_land = fields.Boolean(string="办理土地有偿使用手续")
@@ -89,6 +89,8 @@ class YuthonProperty(models.Model):
'rent_area': latest_record_id.rent_area,
'admin_id':latest_record_id.admin_id.id,
'company_id':latest_record_id.company_id.id,
'property_type':latest_record_id.property_type,
'tenure_type': latest_record_id.tenure_type,
})
@api.onchange('energy_meter_ids')
@@ -310,7 +312,9 @@ class TitleInformationLine(models.Model):
property_message_id = fields.Many2one('yuthon.property.message', string='产权地址')
owner_id = fields.Many2one(related='property_message_id.owner_id', string="权属人")
equity_area = fields.Float(related='property_message_id.equity_area', string="产权面积", digits=(16, 4))
registered_use = fields.Char(related='property_message_id.registered_use', string='证载用途')
title_certificate = fields.Char(related='property_message_id.title_certificate', string="产权证号")
start_time = fields.Date(string="生效日期", default=fields.Date.today)
end_date = fields.Date(string="失效日期")
@@ -322,7 +326,7 @@ class ManageInformationLine(models.Model):
yuthon_property_id = fields.Many2one('yuthon.property', string="关联物业信息")
purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
precinct_id = fields.Many2one(related='yuthon_property_id.precinct_id',string="所属片区", readonly=False)
tenure_type = fields.Selection([('self', '自营'), ('agency', '代管')], string='权属类型')
tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型')
management_area = fields.Float(string="管理面积", digits=(16, 4))
rent_area = fields.Float(string="可租面积", digits=(16, 4))
admin_id = fields.Many2one('res.users', string="管理员")
@@ -12,5 +12,6 @@ class YuthonPropertyMessage(models.Model):
pooled_area = fields.Float(string="公摊面积", digits=(16, 4))
ctual_area = fields.Float(string="实际面积", digits=(16, 4))
equity_area = fields.Float(string="产权面积", digits=(16, 4))
registered_use = fields.Char(string='证载用途')
documents_ids = fields.Many2many('ir.attachment', string="附件")
@@ -11,6 +11,7 @@
<field name="equity_area"/>
<field name="pooled_area"/>
<field name="ctual_area"/>
<field name="registered_use"/>
<field name="documents_ids" widget="preview_many2many"/>
</tree>
</field>
@@ -93,6 +93,7 @@
<field name="owner_id"/>
<field name="title_certificate"/>
<field name="equity_area"/>
<field name="registered_use"/>
<field name="start_time"/>
<field name="end_date"/>
</tree>
@@ -94,8 +94,8 @@ class PropertyLeaseContract(models.Model):
is_split = fields.Boolean(string="是否合同拆分")
split_context = fields.Char(string="拆分内容", default="该合同已拆分")
percentage_liquidated_damages = fields.Many2one('yuthon.penalty.setting', string="违约金比例")
date_payment_month = fields.Date(string="支付日期")
date_payment_day = fields.Date(string="支付日期")
date_payment_month = fields.Char(string="支付日期")
date_payment_day = fields.Char(string="支付日期")
first_pay = fields.Date(string="首次付款日")
unit_price = fields.Float(string="单价")
deposit_type = fields.Selection([('deposit', '押金'), ('performance', '履约保证金')], string="押金/履约保证金")
@@ -117,6 +117,9 @@ class PropertyLeaseContract(models.Model):
condition = fields.Selection([('new', '新建'),('approval','审批'),('cancel','作废')], string="状态", default='new')
message_type = fields.Selection([('be_executed','待执行'), ('executed','已执行'), ('expired','已终止'), ('advance','提前终止')], string="合同状态")
contract_type = fields.Selection([('lease_renewal', '续租'), ('interim', '临租'), ('new', '补充协议'), ('first', '首租')], string="合同类型", default='first')
performance_bonds = fields.Float(string="经营履约保证金")
utility_bills = fields.Float(string="水电费押金")
renovation_deposit = fields.Float(string="装修押金")
lease_ids = fields.One2many('property.lease.contract.line', 'lease_id',string="物业信息明细行")
subset_ids = fields.One2many('property.subset.contract', 'subset_id',string="子集明细")
breakdown_ids = fields.One2many('property.rent.breakdown.line', 'breakdown_id', string="物业租金明细行")
@@ -140,7 +143,8 @@ class PropertyLeaseContract(models.Model):
@api.onchange('total_area', 'rent')
def _onchange_unit_price(self):
for i in self:
i.unit_price = i.total_area / i.rent
if i.total_area and i.rent:
i.unit_price = i.total_area / i.rent
@api.depends('breakdown_ids')
def _compute_total_contract_receivables(self):
@@ -332,27 +336,27 @@ class PropertyLeaseContract(models.Model):
"original_amount": record.total_area * record.management_fee * months,
})
@api.onchange("term_start_time", "term_end_time",
"increments_every_few_years", "unit_price",
"first_years_begin", "increment_method", "increment_value",
"rent_free_period_month", "rent_free_period_days", "total_area")
def _onchange_action_generate_details(self):
"""
生产租金明细
:return:
"""
# todo 还没有计算递增递减
# todo 还没有计算首月优惠
# todo 还没有计算开始和结束不足月份和季度的计算比例
for record in self:
if not record.term_start_time:
raise UserError(_("请填写租期开始时间!"))
if not record.term_end_time:
raise UserError(_("请填写租期结束时间!"))
record.write({'breakdown_ids': [(5, 0, 0)]})
start_date = record.term_start_time
end_date = record.term_end_time + relativedelta(days=1)
record.do_generate_details_core(start_date, end_date)
# @api.onchange("term_start_time", "term_end_time",
# "increments_every_few_years", "unit_price",
# "first_years_begin", "increment_method", "increment_value",
# "rent_free_period_month", "rent_free_period_days", "total_area")
# def _onchange_action_generate_details(self):
# """
# 生产租金明细
# :return:
# """
# # todo 还没有计算递增递减
# # todo 还没有计算首月优惠
# # todo 还没有计算开始和结束不足月份和季度的计算比例
# for record in self:
# if not record.term_start_time:
# raise UserError(_("请填写租期开始时间!"))
# if not record.term_end_time:
# raise UserError(_("请填写租期结束时间!"))
# record.write({'breakdown_ids': [(5, 0, 0)]})
# start_date = record.term_start_time
# end_date = record.term_end_time + relativedelta(days=1)
# record.do_generate_details_core(start_date, end_date)
def do_generate_details_core(self, start_date, end_date):
"""
@@ -451,7 +455,7 @@ class PropertyLeaseContract(models.Model):
"monthly_amount": monthly_amount,
"breakdown_id": self.id,
"start_data": free_start,
"end_data": first_years_begin_end,
"end_data": first_years_begin_end - relativedelta(days=1),
"month_number": first_months,
"period_rent": first_months * monthly_amount,
})]})
@@ -619,6 +623,7 @@ class PropertyLeaseContract(models.Model):
self._context.get('active_ids', self._context.get('active_id')))
for record in contract_ids:
record.use_address = record.name
record.address_for_delivery = record.name
def action_update_contract(self):
contract_ids = self.env["property.lease.contract"].browse(self._context.get('active_ids', self._context.get('active_id')))
@@ -232,11 +232,7 @@
style="max-width: 3rem !important;"/>年递增
<field name="increment_method" required="1" class="me-2"
style="max-width: 5rem !important;"/>
<field name="increment_percentage" invisible="increment_method != 'percentage'"
class="me-2" style="max-width: 5rem !important;"/>
<field name="increment_price" invisible="increment_method != 'increment_price'"
class="me-2" style="max-width: 5rem !important;"/>
<field name="increment_amount" invisible="increment_method != 'increment_amount'"
<field name="increment_value"
class="me-2" style="max-width: 5rem !important;"/>
</div>
<field name="tax_rate"/>
@@ -251,7 +247,7 @@
<group>
<label for="breach"/>
<div class="d-inline-flex w-100">
<field name="breach" string="自第" class="me-2"
<field name="breach" string="违约金时点" class="me-2"
style="max-width: 11rem !important;"/>违约金比例
<field name="percentage_liquidated_damages" class="me-2"
style="max-width: 11rem !important;"/>
@@ -262,6 +258,17 @@
<field name="total_contract_receivables"/>
</group>
</group>
<group col="3">
<group>
<field name="performance_bonds"/>
</group>
<group>
<field name="utility_bills"/>
</group>
<group>
<field name="renovation_deposit"/>
</group>
</group>
<group>
<field name="miscellaneous"/>
</group>
@@ -501,11 +508,7 @@
style="max-width: 3rem !important;"/>年递增
<field name="increment_method" required="1" class="me-2"
style="max-width: 5rem !important;"/>
<field name="increment_percentage" invisible="increment_method != 'percentage'"
class="me-2" style="max-width: 5rem !important;"/>
<field name="increment_price" invisible="increment_method != 'increment_price'"
class="me-2" style="max-width: 5rem !important;"/>
<field name="increment_amount" invisible="increment_method != 'increment_amount'"
<field name="increment_value"
class="me-2" style="max-width: 5rem !important;"/>
</div>
<field name="tax_rate"/>
@@ -520,7 +523,7 @@
<group>
<label for="breach"/>
<div class="d-inline-flex w-100">
<field name="breach" string="自第" class="me-2"
<field name="breach" string="违约金时点" class="me-2"
style="max-width: 11rem !important;"/>违约金比例
<field name="percentage_liquidated_damages" class="me-2"
style="max-width: 11rem !important;"/>
@@ -530,6 +533,17 @@
<field name="first_year_rent"/>
</group>
</group>
<group col="3">
<group>
<field name="performance_bonds"/>
</group>
<group>
<field name="utility_bills"/>
</group>
<group>
<field name="renovation_deposit"/>
</group>
</group>
<group>
<field name="miscellaneous"/>
</group>
@@ -638,7 +652,7 @@
<field name="code">action = model.trigger_lease_ids()</field>
</record>
<record id="all_data_action_use_address" model="ir.actions.server">
<field name="name">更新使用地址</field>
<field name="name">更新使用地址和送达地址</field>
<field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
<field name="binding_model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
<field name="state">code</field>
@@ -8,7 +8,7 @@
<sheet>
<group>
<group>
<field name="lease_contract_id" invisible="1"/>
<field name="lease_contract_id"/>
<field name="property_ids" widget="many2many_tags"/>
</group>
<group/>