1+ from datetime import timedelta
2+
13from odoo import models , fields
24
35
@@ -8,10 +10,10 @@ class EstateProperty(models.Model):
810 name = fields .Char (string = "Title" , required = True )
911 description = fields .Text (string = "Description" )
1012 postcode = fields .Char (string = "Postcode" )
11- date_availability = fields .Date (string = "Available From" )
13+ date_availability = fields .Date (string = "Available From" , copy = False , default = lambda self : fields . Date . today () + timedelta ( days = 90 ) )
1214 expected_price = fields .Float (string = "Expected Price" , required = True )
13- selling_price = fields .Float (string = "Selling Price" )
14- bedrooms = fields .Integer (string = "Bedrooms" )
15+ selling_price = fields .Float (string = "Selling Price" , readonly = True , copy = False )
16+ bedrooms = fields .Integer (string = "Bedrooms" , default = 2 )
1517 living_area = fields .Integer (string = "Living Area (sqm)" )
1618 facades = fields .Integer (string = "Facades" )
1719 garage = fields .Boolean (string = "Garage" )
@@ -26,6 +28,16 @@ class EstateProperty(models.Model):
2628 ],
2729 string = "Garden Orientation"
2830 )
31+ active = fields .Boolean (string = "is Active" , default = True )
32+ state = fields .Selection (
33+ [
34+ ('new' , "New" ),
35+ ('offer_received' , "Offer Received" ),
36+ ('offer_accepted' , "Offer Accepted" ),
37+ ('sold' , "Sold" ),
38+ ('cancelled' , "Cancelled" )
39+ ],
40+ string = "Status" , required = True , copy = False , default = "new" )
2941 swimming_pool = fields .Boolean (string = "Swimming Pool" ) # extra fields
3042 property_type = fields .Selection (
3143 [
@@ -35,5 +47,6 @@ class EstateProperty(models.Model):
3547 ('land' , "Land" )
3648 ],
3749 string = "Property Type"
38- )
50+ )
3951 property_age = fields .Integer (string = "Property Age" )
52+
0 commit comments