Update rental_contract.py
This commit is contained in:
parent
6eab013a64
commit
04240c6c41
|
|
@ -5,6 +5,7 @@ import calendar
|
|||
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from datetime import date
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from odoo.tools import exception_to_unicode
|
||||
from odoo import models, fields, api, exceptions, tools, _
|
||||
|
|
@ -67,6 +68,11 @@ class RentalContract(models.Model):
|
|||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_order = "id desc"
|
||||
|
||||
@api.depends('contract_end_date')
|
||||
def _compute_is_today_end_date(self):
|
||||
for record in self:
|
||||
record.is_today_end_date = record.date_to == date.today()
|
||||
|
||||
@api.onchange('rent_method')
|
||||
def onchange_rent_method(self):
|
||||
"""
|
||||
|
|
@ -91,8 +97,10 @@ class RentalContract(models.Model):
|
|||
else:
|
||||
if not self.property_id:
|
||||
self.property_id = False
|
||||
|
||||
|
||||
active = fields.Boolean(default=True)
|
||||
is_today_end_date = fields.Boolean(string="Is Today End Date", compute="_compute_is_today_end_date",)
|
||||
name = fields.Char(string="Name")
|
||||
date = fields.Date(string="Contract Date")
|
||||
seq = fields.Char(string="Sequence", default="/", index=True)
|
||||
|
|
|
|||
Loading…
Reference in New Issue