|
1 | | -from odoo import models, fields |
2 | | -from dateutil.relativedelta import relativedelta |
| 1 | +from odoo import fields, models |
3 | 2 |
|
4 | 3 |
|
5 | 4 | class EstateProperty(models.Model): |
6 | 5 | _name = "estate.property" |
7 | 6 | _description = "Estate property model" |
8 | 7 |
|
9 | | - name = fields.Char('Property name', required=True, default="Unknown") |
10 | | - description = fields.Text('Property description') |
| 8 | + name = fields.Char("Property name", required=True, default="Unknown") |
| 9 | + description = fields.Text("Property description") |
11 | 10 | postcode = fields.Char() |
12 | | - expected_price = fields.Float('Property expected price', required=True) |
13 | | - date_availability = fields.Date(default=fields.Date.today() + relativedelta(months=3), copy=False) |
| 11 | + expected_price = fields.Float("Property expected price", required=True) |
| 12 | + date_availability = fields.Date( |
| 13 | + default=fields.Date.add(fields.Date.today(), months=3), copy=False |
| 14 | + ) |
14 | 15 | selling_price = fields.Float(readonly=True, copy=False) |
15 | 16 | bedrooms = fields.Integer(default=2) |
16 | 17 | living_area = fields.Integer() |
17 | 18 | facades = fields.Integer() |
18 | 19 | garage = fields.Boolean() |
19 | 20 | garden = fields.Boolean() |
20 | 21 | garden_area = fields.Integer() |
21 | | - garden_orientation = fields.Selection(string='Orientation', selection=[("north", "N"), ("south", "S"), ("east", "E"), ("west", "W")], help='Orientation of the garden') |
| 22 | + garden_orientation = fields.Selection( |
| 23 | + string="Orientation", |
| 24 | + selection=[ |
| 25 | + ("north", "N"), |
| 26 | + ("south", "S"), |
| 27 | + ("east", "E"), |
| 28 | + ("west", "W") |
| 29 | + ], |
| 30 | + help="Orientation of the garden", |
| 31 | + ) |
22 | 32 | last_seen = fields.Datetime("Last Seen", default=fields.Datetime.now) |
23 | 33 | active = fields.Boolean(default=True) |
24 | | - state = fields.Selection(string='State', selection=[("new", "New"), ("offer_received", "Offer Received"), ("offer_accepted", "Offer Accepted"), ("sold", "Sold"), ("cancelled", "Cancelled")], default='new') |
| 34 | + state = fields.Selection( |
| 35 | + string="State", |
| 36 | + selection=[ |
| 37 | + ("new", "New"), |
| 38 | + ("offer_received", "Offer Received"), |
| 39 | + ("offer_accepted", "Offer Accepted"), |
| 40 | + ("sold", "Sold"), |
| 41 | + ("cancelled", "Cancelled"), |
| 42 | + ], |
| 43 | + default="new", |
| 44 | + ) |
0 commit comments