11from odoo import models , fields
2+ import datetime
3+ from dateutil .relativedelta import relativedelta
24
35class EstateProperty (models .Model ):
46 _name = "estate.property"
57 _description = "Create a new table"
68
7- name = fields .Char (string = 'Name' , required = True )
9+ # FIELDS DECLARATION #
10+ name = fields .Char (
11+ string = 'Name' ,
12+ required = True
13+ )
814 description = fields .Text (string = 'Description' )
915 postcode = fields .Char (string = 'Post code' )
10- date_availability = fields .Date (string = 'Availability date' )
16+ date_availability = fields .Date (
17+ string = 'Availability date' ,
18+ default = datetime .date .today () + relativedelta (months = 3 ),
19+ copy = False
20+ )
1121 expected_price = fields .Float (string = 'Expected price' , required = True )
12- selling_price = fields .Float (string = 'Selling price' )
13- bedrooms = fields .Integer (string = 'Bedrooms' )
22+ selling_price = fields .Float (
23+ string = 'Selling price' ,
24+ readonly = True ,
25+ copy = False
26+ )
27+ bedrooms = fields .Integer (
28+ string = 'Bedrooms' ,
29+ default = 2
30+ )
1431 living_area = fields .Integer (string = 'Living area' )
1532 facades = fields .Integer (string = 'Facades' )
1633 garage = fields .Boolean (string = 'Garage' )
@@ -20,3 +37,11 @@ class EstateProperty(models.Model):
2037 string = 'Garden orientation' ,
2138 selection = [('north' , 'North' ), ('south' , 'South' ), ('east' , 'East' ), ('west' , 'West' )]
2239 )
40+ active = fields .Boolean (
41+ string = 'Active' ,
42+ default = True
43+ )
44+ state = fields .Selection (
45+ string = 'State' ,
46+ selection = [('new' , 'New' ), ('offer_received' , 'Offer Received' ), ('offer_accepted' , 'Offer Accepted' ), ('sold' , 'Sold' ), ('cancelled' , 'Cancelled' )]
47+ )
0 commit comments