Skip to content

Commit 52a72e8

Browse files
committed
[FIX] estate: code formatting and rename compute method
Improved code readability by applying consistent formatting. Renamed compute method for best_price to follow naming conventions. changed discription position after name in manifest file.
1 parent c855ffc commit 52a72e8

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

estate/__manifest__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/usr/bin/env python3
22
{
33
"name": "Real Estate",
4+
"description": """
5+
Real Estate Module to Buy and Sell Your Real Estate with Ease.
6+
""",
47
"version": "1.0",
58
"depends": ["base"],
69
"author": "danal",
710
"category": "Category",
811
"application": True,
912
"license": "LGPL-3",
10-
"description": """
11-
Real Estate Module to Buy and Sell Your Real Estate with Ease.
12-
""",
1313
"data": [
1414
"security/ir.model.access.csv",
1515
"views/estate_property_views.xml",

estate/models/estate_property.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class EstateProperty(models.Model):
1515
"CHECK(selling_price >= 0)", "A property selling price must be positive."
1616
)
1717

18-
name = fields.Char(required=True, default="Unknown")
18+
name = fields.Char(required=True)
1919
description = fields.Text()
2020
postcode = fields.Char()
2121
date_avaliability = fields.Date(
@@ -29,7 +29,6 @@ class EstateProperty(models.Model):
2929
garage = fields.Boolean()
3030
garden = fields.Boolean()
3131
garden_area = fields.Integer()
32-
last_seen = fields.Datetime("Last Seen", default=fields.Datetime.now)
3332
garden_orientation = fields.Selection(
3433
selection=[
3534
("north", "North"),
@@ -61,15 +60,15 @@ class EstateProperty(models.Model):
6160
tag_ids = fields.Many2many("estate.property.tag", string="Property Tags")
6261
offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offer")
6362
total_area = fields.Integer(compute="_compute_area")
64-
best_price = fields.Integer(compute="_compute_highest")
63+
best_price = fields.Integer(compute="_compute_best_price")
6564

6665
@api.depends("living_area", "garden_area")
6766
def _compute_area(self):
6867
for record in self:
6968
record.total_area = record.living_area + record.garden_area
7069

7170
@api.depends("offer_ids.price")
72-
def _compute_highest(self):
71+
def _compute_best_price(self):
7372
for record in self:
7473
if not record.mapped("offer_ids.price"):
7574
record.best_price = 0

estate/models/estate_property_offer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class EstatePropertyOffer(models.Model):
99
_check_offer_price = models.Constraint(
1010
"CHECK(price > 0)", "An offer price must be strictly positive"
1111
)
12-
12+
1313
price = fields.Float()
1414
status = fields.Selection(
1515
selection=[("accepted", "Accepted"), ("refused", "Refused")], copy=False
@@ -44,6 +44,5 @@ def action_accept(self):
4444
def action_refuse(self):
4545
for record in self:
4646
record.status = "refused"
47-
record.property_id.selling_price = 0.00
4847
record.property_id.customer = None
4948
return True

0 commit comments

Comments
 (0)