From ebc694647f985b32fac089d0567e6b6323ef3b12 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelaziz Date: Fri, 20 Dec 2024 10:17:15 +0100 Subject: [PATCH] [IMP] estate: Resolve Warnings & Issues --- .gitignore | 3 +++ estate/__manifest__.py | 3 ++- estate/models/estate_property.py | 10 ++++------ estate/models/estate_property_offer.py | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index b6e47617de..99d7a412a2 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ dmypy.json # Pyre type checker .pyre/ + +# vscode settings +.vscode/ diff --git a/estate/__manifest__.py b/estate/__manifest__.py index efab507eb8..92ffb00646 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -1,7 +1,7 @@ { "name": "Real Estate", "author": "Odoo", - "website": "https://www.odoo.com/", + "website": "https://www.odoo.com/page/realestate", "version": "0.1", "application": True, "installable": True, @@ -14,4 +14,5 @@ "views/estate_property_views.xml", "views/estate_menus.xml", ], + "license": "LGPL-3", } diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 1866a29d53..b694b2f1ee 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -22,7 +22,7 @@ class EstateProperty(models.Model): garden = fields.Boolean() garden_area = fields.Integer() garden_orientation = fields.Selection( - string="Type", + string="Garden Orientation", selection=[ ("north", "North"), ("south", "South"), @@ -32,7 +32,7 @@ class EstateProperty(models.Model): ) active = fields.Boolean(default=True) state = fields.Selection( - string="Type", + string="State", selection=[ ("new", "New"), ("offer received", "Offer Received"), @@ -41,9 +41,7 @@ class EstateProperty(models.Model): ("canceled", "Canceled"), ], ) - property_type_id = fields.Many2one( - "estate.property.type", string="Property Type", index=True - ) + property_type_id = fields.Many2one("estate.property.type", string="Property Type") buyer = fields.Many2one("res.partner", string="Buyer", copy=False) salesperson = fields.Many2one( "res.users", string="Salesperson", default=lambda self: self.env.user @@ -62,7 +60,7 @@ def _compute_total_area(self): def _compute_best_price(self): for record in self: prices = record.offer_ids.mapped("price") - record.best_price = max(prices) if prices else 0 + record.best_price = max(prices, default=0) @api.onchange("garden") def _onchange_garden(self): diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py index b65e99b359..7e095f3f02 100644 --- a/estate/models/estate_property_offer.py +++ b/estate/models/estate_property_offer.py @@ -18,7 +18,7 @@ class EstatePropertyOffer(models.Model): compute="_compute_date_deadline", inverse="_inverse_date_deadline" ) - @api.depends("validity") + @api.depends("validity", "create_date") def _compute_date_deadline(self): for record in self: if not record.create_date: