添加功能

This commit is contained in:
zhou
2025-01-09 19:41:58 +08:00
parent 4fbeb23126
commit 0e8a1e267a
2 changed files with 30 additions and 8 deletions
@@ -72,7 +72,9 @@ 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="结束时间")
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')
@@ -116,6 +118,7 @@ class PropertyLeaseContract(models.Model):
miscellaneous = fields.Text(string="其他约定")
number = fields.Integer(string="次数", default=0)
total_area = fields.Float(string="总面积", digits=(16, 4))
not_received = fields.Float(string="未收")
actual_receivable = fields.Float(string="实际应收")
now_receivable = fields.Float(string="当前应收")
total_receivable = fields.Float(string="总已收")
@@ -146,6 +149,22 @@ class PropertyLeaseContract(models.Model):
responsibility_book_id = fields.Many2one('ir.attachment', string="安全生产责任书")
handover_time = fields.Date(string="交接日期")
@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:
@@ -300,16 +300,19 @@
<field name="model">property.lease.contract</field>
<field name="arch" type="xml">
<tree string="租赁合同审批">
<field name="contract_code"/>
<field name="lessee_id"/>
<field name="name"/>
<field name="total_contract_receivables"/>
<field name="actual_receivable"/>
<field name="now_receivable"/>
<field name="percentage_liquidated_damages"/>
<field name="code"/>
<field name="lessee_id"/>
<field name="total_area"/>
<field name="deposit"/>
<field name="rent"/>
<field name="not_received"/>
<field name="percentage_damages"/>
<field name="total_receivable"/>
<field name="term_start_time"/>
<field name="term_end_time"/>
<field name="term_start_month_day"/>
<field name="term_end_month_day"/>
<field name="company_id" string="所属公司"/>
<field name="admin_id" string="负责人"/>
</tree>
</field>
</record>