Merge pull request !1306 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-01-13 11:33:37 +00:00
committed by Gitee
8 changed files with 66 additions and 41 deletions
@@ -61,7 +61,6 @@
<group col="2" string="默认关联设置">
<group>
<field name="meter_reading_date"/>
<field name="related_fees"/>
<field name="yuthon_property_id"/>
</group>
<group>
@@ -61,7 +61,6 @@
<group col="2" string="默认关联设置">
<group>
<field name="meter_reading_date"/>
<field name="related_fees"/>
<field name="yuthon_property_id"/>
</group>
<group>
@@ -13,11 +13,11 @@ class PropertyEarlyQuitting(models.Model):
name = fields.Char(string='标题')
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('property_early_quitting_code'))
property_documents_ids = fields.Many2many('documents.document', string="提前退租文件")
lessee = fields.Char(string='承租方')
property_documents_ids = fields.Many2many('ir.attachment', string="提前退租文件")
lessee_id = fields.Many2one(related='address_id.lessee_id', string="承租方")
address_id = fields.Many2one('yuthon.property', string="物业地址")
start_data = fields.Date(string="合同开始日期")
end_data = fields.Date(string="合同结束日期")
early_quitting_date = fields.Date(string="提前退租日期")
contract_id = fields.Many2one('documents.document', string="合同")
address = fields.Char(string="地址")
contract_id = fields.Many2one('ir.attachment', string="合同")
reason = fields.Char(string="退租原因")
@@ -74,7 +74,6 @@ class PropertyLeaseContract(models.Model):
lease_term_month = fields.Integer(string="租期(月)")
lease_term_day = fields.Integer(string="租期(日)")
term_start_time = fields.Date(string="开始时间", default=fields.Datetime.now)
term_start_month_day = fields.Char(string="开始时间", compute="_compute_term_start_month_day")
term_end_time = fields.Date(string="结束时间")
actual_start_time = fields.Date(string="实际开始时间")
actual_end_time = fields.Date(string="实际结束时间", default=fields.Datetime.now)
@@ -82,7 +81,6 @@ class PropertyLeaseContract(models.Model):
expiration_coming = fields.Selection([('coming', '即将到期'), ('expired', '已到期')], string="结束时间对比(状态)", compute='_compute_expiration_coming', store=True)
is_equal = fields.Boolean(string="是否相等", compute='_compute_end_comparison', store=True)
term_end_month_day = fields.Char(string="结束时间", compute="_compute_term_end_month_day")
cycle_dict =fields.Selection([('monthly', '月度'), ('quarter', '季度'), ('half', '半年'),('year', '年度')],string='付款方式', default='monthly', help="应收")
cycle_mode = fields.Selection([('fixed_monthly', '合同月'), ('floating_monthly', '自然月'), ('fixed_quarter', '合同季'), ('floating_quarter', '自然季'),
('fixed_year', '合同年'), ('floating_year', '自然年')], string='周期方式', default='fixed_monthly')
@@ -201,22 +199,6 @@ class PropertyLeaseContract(models.Model):
else:
record.expiration_coming = None
@api.depends('term_start_time')
def _compute_term_start_month_day(self):
for record in self:
if record.term_start_time:
record.term_start_month_day = record.term_start_time.strftime('%Y-%m')
else:
record.term_start_month_day = ''
@api.depends('term_end_time')
def _compute_term_end_month_day(self):
for record in self:
if record.term_end_time:
record.term_end_month_day = record.term_end_time.strftime('%Y-%m')
else:
record.term_end_month_day = ''
@api.onchange('total_area', 'rent')
def _onchange_unit_price(self):
for i in self:
@@ -1104,6 +1086,49 @@ class PropertyLeaseContract(models.Model):
record.write({'condition': 'executed'})
elif current_date < record.term_start_time:
record.write({'condition': 'be_executed'})
# 延租
def button_lease_extension(self):
form_id = self.env.ref('yuthon_property_approval.view_property_lease_extension_form').id
address_id = self.lease_ids[0].address_id if self.lease_ids else ''
return {
'name': '延租申请',
"type": "ir.actions.act_window",
'res_model': 'property.lease.extension',
"views": [[form_id, "form"]],
"context": {
'default_address_id': address_id.id,
'default_end_date': self.term_end_time
},
}
# 退租
def button_lease_return(self):
form_id = self.env.ref('yuthon_property_approval.view_property_early_quitting_form').id
address_id = self.lease_ids[0].address_id if self.lease_ids else ''
return {
'name': '延租申请',
"type": "ir.actions.act_window",
'view_mode': 'form',
'res_model': 'property.early.quitting',
"views": [[form_id, "form"]],
"context": {
'default_address_id': address_id.id,
'default_end_data': self.term_end_time,
'default_start_data': self.term_start_time,
},
}
# 变更
def button_lease_change(self):
form_id = self.env.ref('yuthon_property_approval.view_property_lease_renewal_form').id
return {
'name': '变更申请',
"type": "ir.actions.act_window",
'view_mode': 'form',
'res_model': 'property.lease.renewal',
"views": [[form_id, "form"]],
}
class PropertyLeaseContractLine(models.Model):
_name = 'property.lease.contract.line'
@@ -13,10 +13,10 @@ class PropertyLeaseExtension(models.Model):
name = fields.Char(string='标题')
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('property_lease_extension_code'))
property_documents_ids = fields.Many2many('documents.document', string="延租文件")
original_contract_id = fields.Many2one('documents.document', string="原合同")
lessee = fields.Char(string="承租方")
address = fields.Char(string="地址")
property_documents_ids = fields.Many2many('ir.attachment', string="延租文件")
original_contract_id = fields.Many2one('ir.attachment', string="原合同")
lessee_id = fields.Many2one(related='address_id.lessee_id', string="承租方")
address_id = fields.Many2one('yuthon.property', string="物业地址")
end_date = fields.Date(string="原到期时间")
new_end_date = fields.Date(string="延期至")
reason_extension = fields.Char(string="延期原因")
@@ -27,18 +27,17 @@
<group>
<field name="code"/>
<field name="start_data"/>
<field name="property_documents_ids" widget="many2many_tags"/>
<field name="property_documents_ids" widget="preview_many2many"/>
<field name="reason"/>
</group>
<group>
<field name="lessee"/>
<field name="lessee_id"/>
<field name="end_data"/>
<field name="address"/>
</group>
<group>
<field name="address"/>
<field name="address_id"/>
<field name="early_quitting_date"/>
<field name="contract_id"/>
<field name="contract_id" widget="preview_many2one"/>
</group>
</group>
</sheet>
@@ -298,7 +298,7 @@
<field name="arch" type="xml">
<tree string="租赁合同审批">
<field name="name"/>
<field name="code" decoration-danger = "is_equal"/>
<field name="contract_code" decoration-danger = "is_equal"/>
<field name="lessee_id"/>
<field name="total_area"/>
<field name="is_equal" column_invisible="1"/>
@@ -312,14 +312,17 @@
<field name="comparison" column_invisible="1"/>
<field name="percentage_damages"/>
<field name="total_receivable"/>
<field name="term_start_month_day"/>
<field name="end_comparison" column_invisible="1"/>
<field name="term_end_month_day" decoration-info="end_comparison == 'blue'"
<field name="term_start_time"/>
<field name="term_end_time" decoration-info="end_comparison == 'blue'"
decoration-danger = "end_comparison == 'red'"
decoration-warning = "end_comparison == 'yellow'"/>
<field name="end_comparison" column_invisible="1"/>
<field name="deposit_status" column_invisible="1"/>
<field name="company_id" string="所属公司"/>
<field name="admin_id" string="负责人"/>
<button name="button_lease_extension" type="object" class="btn-primary" string="延租"/>
<button name="button_lease_return" type="object" class="btn-primary" string="退租"/>
<button name="button_lease_change" type="object" class="btn-primary" string="变更"/>
</tree>
</field>
</record>
@@ -26,15 +26,15 @@
<group col="3">
<group>
<field name="code"/>
<field name="property_documents_ids" widget="many2many_tags"/>
<field name="property_documents_ids" widget="preview_many2many"/>
<field name="new_end_date"/>
</group>
<group>
<field name="original_contract_id"/>
<field name="lessee"/>
<field name="original_contract_id" widget="preview_many2one"/>
<field name="lessee_id"/>
</group>
<group>
<field name="address"/>
<field name="address_id"/>
<field name="end_date"/>
<field name="reason_extension"/>
</group>