Skip to content

Commit 3f82fdb

Browse files
committed
[FIX] estate: fix comments
1 parent dd14df9 commit 3f82fdb

File tree

7 files changed

+39
-19
lines changed

7 files changed

+39
-19
lines changed

estate/models/estate_property.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class EstateProperty(models.Model):
77
_name = "estate.property"
88
_description = "Estate properties"
9-
9+
_order = "id desc"
1010
name = fields.Char('Name', required=True, translate=True)
1111
description = fields.Text('Description', required=True)
1212
postcode = fields.Char('Postcode')
@@ -22,13 +22,24 @@ class EstateProperty(models.Model):
2222
garden_area = fields.Float('Garden Area (sqm)')
2323
garden_orientation = fields.Selection(
2424
string='Garden Orientation',
25-
selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')])
25+
selection=[
26+
('north', 'North'),
27+
('south', 'South'),
28+
('east', 'East'),
29+
('west', 'West')
30+
])
2631
state = fields.Selection(
2732
string='State',
2833
required=True,
2934
default='new',
3035
copy=False,
31-
selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')])
36+
selection=[
37+
('new', 'New'),
38+
('offer_received','Offer Received'),
39+
('offer_accepted', 'Offer Accepted'),
40+
('sold', 'Sold'),
41+
('cancelled', 'Cancelled')
42+
])
3243
property_type_id = fields.Many2one("estate.property.type", "Type")
3344
property_tags_ids = fields.Many2many("estate.property.tag", "Tags")
3445
sales_person_id = fields.Many2one('res.users', string='Salesperson', default=lambda self: self.env.user)
@@ -54,9 +65,7 @@ def _compute_total_area(self):
5465
@api.depends('offer_ids.price')
5566
def _compute_best_price(self):
5667
for record in self:
57-
if len(record.offer_ids)>0:
58-
record.best_price = max(record.offer_ids, key=lambda p: p.price).price
59-
68+
record.best_price = max(record.offer_ids.mapped('price'), default=0.0)
6069
@api.onchange('garden')
6170
def _onchange_garden(self):
6271
if not self.garden:

estate/models/estate_property_offer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class EstatePropertyOffer(models.Model):
55
_name = "estate.property.offer"
66
_description = "Estate properties Offers"
7-
7+
_order = "price desc"
88
price = fields.Float('Price')
99
status = fields.Selection(
1010
string='Status',

estate/models/estate_property_tag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class EstatePropertyTag(models.Model):
55
_name = "estate.property.tag"
66
_description = "Estate properties Tags"
7-
7+
_order = "name"
88
name = fields.Char('Name', required=True, translate=True)
99

1010
_tags_uniq = models.Constraint(

estate/models/estate_property_type.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
class EstatePropertyType(models.Model):
55
_name = "estate.property.type"
66
_description = "Estate properties Types"
7-
7+
_order = "name"
88
name = fields.Char('Name', required=True, translate=True)
99
properties_ids = fields.One2many("estate.property", "property_type_id", "Properties")
10-
10+
sequence = fields.Integer('Sequence', default=1, help="Used to order stages. Lower is better.")
1111
_types_uniq = models.Constraint(
1212
'unique(name)',
1313
"The type name already exists",

estate/views/estate_property_offer_views.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
<field name="name">estate.property.offer.list</field>
2121
<field name="model">estate.property.offer</field>
2222
<field name="arch" type="xml">
23-
<list string="Channel">
23+
<list string="Offers">
2424
<field name="price" />
2525
<field name="partner_id" />
2626
<field name="validity" />
2727
<field name="date_deadline" />
28-
<button name="action_accept_offer" string="Accept" type="object" icon="fa-check"/>
29-
<button name="action_refuse_offer" string="Refuse" type="object" icon="fa-times"/>
28+
<button name="action_accept_offer" string="Accept" type="object" icon="fa-check" />
29+
<button name="action_refuse_offer" string="Refuse" type="object" icon="fa-times" />
3030
<field name="status" />
3131
</list>
3232
</field>
3333
</record>
34-
</odoo>
34+
</odoo>

estate/views/estate_property_type_views.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@
2727
</field>
2828
</record>
2929

30+
<record id="estate_property_view_list" model="ir.ui.view">
31+
<field name="name">estate.property.type.list</field>
32+
<field name="model">estate.property.type</field>
33+
<field name="arch" type="xml">
34+
<list string="Types" multi_edit="1">
35+
<field name="name" />
36+
<field name="sequence" widget="handle" />
37+
</list>
38+
</field>
39+
</record>
40+
3041
<record id="estate_property_type_action" model="ir.actions.act_window">
3142
<field name="name">Estate Property Types</field>
3243
<field name="res_model">estate.property.type</field>
@@ -37,4 +48,4 @@
3748
</p>
3849
</field>
3950
</record>
40-
</odoo>
51+
</odoo>

estate/views/estate_property_views.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<field name="facades" />
1515
<separator />
1616
<filter string="Available properties" name="available_properties"
17-
domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]" />
17+
domain="[('state', 'in', ('new', 'offer_received'))]" />
1818
<filter string="Same Postcode" name="postcode_grpby"
1919
context="{'group_by':'postcode'}" />
2020
</search>
@@ -29,7 +29,7 @@
2929
<header>
3030
<button name="action_sold_property" type="object" string="Sold" />
3131
<button name="action_cancel_property" type="object" string="Cancel" />
32-
<field name="state" widget="statusbar"/>
32+
<field name="state" widget="statusbar" />
3333
</header>
3434
<sheet>
3535
<div class="oe_title">
@@ -85,7 +85,7 @@
8585
<field name="name">estate.property.list</field>
8686
<field name="model">estate.property</field>
8787
<field name="arch" type="xml">
88-
<list string="Channel">
88+
<list string="Properties">
8989
<field name="name" string="Title" />
9090
<field name="property_type_id" />
9191
<field name="postcode" />
@@ -114,4 +114,4 @@
114114
</p>
115115
</field>
116116
</record>
117-
</odoo>
117+
</odoo>

0 commit comments

Comments
 (0)