Merge pull request #2465 from expsa/manar_dev_realstate_20_2

UPDATE property_management
This commit is contained in:
Manar416 2025-02-20 14:21:59 +02:00 committed by GitHub
commit 132387c8a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -471,6 +471,12 @@ class RentalContract(models.Model):
def action_draft(self):
self.write({'state': 'draft'})
if self.unit_ids:
self.unit_ids.write({'state': 'available'})
elif self.property_id:
if self.property_id.state in ['reserve', 'rent']:
self.property_id.write({'state': 'approve'})
self.property_id.unit_ids.write({'state': 'available'})
def action_cancel(self):
if self.rent_payment_ids: