1- from odoo import models ,fields
1+ from odoo import models , fields
2+ from dateutil .relativedelta import relativedelta
23
34class estateproperty (models .Model ):
45 _name = "estate.property"
56 _description = "Real Estate Property"
67
7- name = fields .Char (required = ' True' )
8+ name = fields .Char (required = True )
89 description = fields .Text (string = "Description" )
910 postcode = fields .Char (string = "Postcode" )
10- date_availability = fields .Date (string = "Available From" )
11+ date_availability = fields .Date (string = "Availability Date" , default = fields . Date . today () + relativedelta ( months = 3 ) )
1112 expected_price = fields .Float (string = "Expected Price" , required = True )
1213 selling_price = fields .Float (string = "Selling Price" , readonly = True )
1314 bedrooms = fields .Integer (string = "Bedrooms" , default = 2 )
@@ -17,7 +18,25 @@ class estateproperty(models.Model):
1718 garden = fields .Boolean (string = "Garden" )
1819 garden_area = fields .Integer (string = "Garden Area (sqm)" )
1920 garden_orientation = fields .Selection (
20- selection = [('north' , 'North' ),('south' , 'South' ),('east' , 'East' ),('west' , 'West' )],
21- string = "Garden Orientation"
21+ selection = [
22+ ("north" , "North" ),
23+ ("south" , "South" ),
24+ ("east" , "East" ),
25+ ("west" , "West" ),
26+ ],
27+ string = "Garden Orientation" ,
2228 )
23- active = fields .Boolean (string = "Active" , default = True )
29+ state = fields .Selection (
30+ [
31+ ("new" , "New" ),
32+ ("offer_received" , "Offer Received" ),
33+ ("offer_accepted" , "Offer Accepted" ),
34+ ("sold" , "Sold" ),
35+ ("cancelled" , "Cancelled" ),
36+ ],
37+ string = "Status" ,
38+ required = True ,
39+ copy = False ,
40+ default = "new" ,
41+ )
42+ active = fields .Boolean (string = "Active" , default = True )
0 commit comments