From 34e5c4f6e12c3f7ac998feb4c6ab2b39fe31c883 Mon Sep 17 00:00:00 2001 From: coder-odoo Date: Mon, 16 Feb 2026 14:38:34 +0100 Subject: [PATCH 01/18] [ADD] estate: fix errors in the previous commit --- estate/__init__.py | 4 ++++ estate/__manifest__.py | 11 +++++++++++ estate/models/__init__.py | 4 ++++ estate/models/estate_property.py | 26 ++++++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 estate/__init__.py create mode 100644 estate/__manifest__.py create mode 100644 estate/models/__init__.py create mode 100644 estate/models/estate_property.py diff --git a/estate/__init__.py b/estate/__init__.py new file mode 100644 index 00000000000..dc5e6b693d1 --- /dev/null +++ b/estate/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import models diff --git a/estate/__manifest__.py b/estate/__manifest__.py new file mode 100644 index 00000000000..bd817eac2fa --- /dev/null +++ b/estate/__manifest__.py @@ -0,0 +1,11 @@ +{ + 'name': "Real Estate", + 'depends': ['base'], + 'author': "Odoo", + 'category': 'Category', + 'license': 'LGPL-3', + 'application': True, + 'description': """ + A app for real estate + """ +} diff --git a/estate/models/__init__.py b/estate/models/__init__.py new file mode 100644 index 00000000000..ddcab4c3593 --- /dev/null +++ b/estate/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import estate_property diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py new file mode 100644 index 00000000000..cdce1e794a4 --- /dev/null +++ b/estate/models/estate_property.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class EstateProperty(models.Model): + _name = "estate.property" + _description = "A table for estate properties" + + name = fields.Char('Property Name', required=True) + description = fields.Text() + postcode = fields.Char('Post Code') + date_availability = fields.Date() + expected_price = fields.Float(required=True) + selling_price = fields.Float() + bedrooms = fields.Integer() + living_area = fields.Integer() + facades = fields.Integer() + garage = fields.Boolean() + garden = fields.Boolean() + garden_area = fields.Integer() + garden_orientation = fields.Selection( + string='Garden Orientation', + selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], + help="Type is used to choose the orientation") From f6b71c704cdd6301588e9522e50cb4a43d56ffc9 Mon Sep 17 00:00:00 2001 From: coder-odoo Date: Mon, 16 Feb 2026 16:30:11 +0100 Subject: [PATCH 02/18] [IMP] estate: Adding access rights for the group user --- estate/__manifest__.py | 5 ++++- estate/security/ir.model.access.csv | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 estate/security/ir.model.access.csv diff --git a/estate/__manifest__.py b/estate/__manifest__.py index bd817eac2fa..739a101a661 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -7,5 +7,8 @@ 'application': True, 'description': """ A app for real estate - """ + """, + 'data': [ + 'security/ir.model.access.csv', + ] } diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv new file mode 100644 index 00000000000..98f4671fb0d --- /dev/null +++ b/estate/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1 From ae8e6d94e563ee43c64fb8e8844354fdec6524fc Mon Sep 17 00:00:00 2001 From: coder-odoo Date: Tue, 17 Feb 2026 09:08:50 +0100 Subject: [PATCH 03/18] [IMP] estate: Adding default UI --- estate/__manifest__.py | 2 ++ estate/models/estate_property.py | 15 ++++++++++++--- estate/views/estate_menus.xml | 8 ++++++++ estate/views/estate_property_views.xml | 8 ++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 estate/views/estate_menus.xml create mode 100644 estate/views/estate_property_views.xml diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 739a101a661..4dff99718b1 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -10,5 +10,7 @@ """, 'data': [ 'security/ir.model.access.csv', + 'views/estate_property_views.xml', + 'views/estate_menus.xml' ] } diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index cdce1e794a4..04f201e2c94 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -2,6 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models +import datetime class EstateProperty(models.Model): @@ -11,10 +12,10 @@ class EstateProperty(models.Model): name = fields.Char('Property Name', required=True) description = fields.Text() postcode = fields.Char('Post Code') - date_availability = fields.Date() + date_availability = fields.Date(copy=False, default=fields.Datetime.add(fields.Datetime.now(), months=3)) expected_price = fields.Float(required=True) - selling_price = fields.Float() - bedrooms = fields.Integer() + selling_price = fields.Float(readonly=True, copy=False) + bedrooms = fields.Integer(default=2) living_area = fields.Integer() facades = fields.Integer() garage = fields.Boolean() @@ -24,3 +25,11 @@ class EstateProperty(models.Model): string='Garden Orientation', selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], help="Type is used to choose the orientation") + + active = fields.Boolean(default=True) + state = fields.Selection( + string='Status', + selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('canceled', 'Canceled')], + required=True, copy=False, default='new') + + diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml new file mode 100644 index 00000000000..cd4c77bc2d6 --- /dev/null +++ b/estate/views/estate_menus.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml new file mode 100644 index 00000000000..420bdc65197 --- /dev/null +++ b/estate/views/estate_property_views.xml @@ -0,0 +1,8 @@ + + + + Properties + estate.property + list,form + + From 04a947828cc4f013b94c4c6be64d846e14c094da Mon Sep 17 00:00:00 2001 From: coder-odoo Date: Tue, 17 Feb 2026 10:32:28 +0100 Subject: [PATCH 04/18] [IMP] estate: Adding custom form/list and a search engine --- estate/__manifest__.py | 5 +++- estate/models/estate_property.py | 25 ++++++++--------- estate/views/estate_form_views.xml | 42 ++++++++++++++++++++++++++++ estate/views/estate_list_views.xml | 18 ++++++++++++ estate/views/estate_search_views.xml | 24 ++++++++++++++++ 5 files changed, 100 insertions(+), 14 deletions(-) create mode 100644 estate/views/estate_form_views.xml create mode 100644 estate/views/estate_list_views.xml create mode 100644 estate/views/estate_search_views.xml diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 4dff99718b1..f724c8c6e2e 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -11,6 +11,9 @@ 'data': [ 'security/ir.model.access.csv', 'views/estate_property_views.xml', - 'views/estate_menus.xml' + 'views/estate_list_views.xml', + 'views/estate_form_views.xml', + 'views/estate_search_views.xml', + 'views/estate_menus.xml', ] } diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 04f201e2c94..48d24bfcfb9 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -10,17 +10,17 @@ class EstateProperty(models.Model): _description = "A table for estate properties" name = fields.Char('Property Name', required=True) - description = fields.Text() - postcode = fields.Char('Post Code') - date_availability = fields.Date(copy=False, default=fields.Datetime.add(fields.Datetime.now(), months=3)) - expected_price = fields.Float(required=True) - selling_price = fields.Float(readonly=True, copy=False) - bedrooms = fields.Integer(default=2) - living_area = fields.Integer() - facades = fields.Integer() - garage = fields.Boolean() - garden = fields.Boolean() - garden_area = fields.Integer() + description = fields.Text('Description') + postcode = fields.Char('Postcode') + date_availability = fields.Date('Available From', copy=False, default=lambda self: fields.Date.add(fields.Date.today(), months=3)) + expected_price = fields.Float('Expected Price', required=True) + selling_price = fields.Float('Selling Price', readonly=True, copy=False) + bedrooms = fields.Integer('Bedrooms', default=2) + living_area = fields.Integer('Living Area (sqm)') + facades = fields.Integer('Facades') + garage = fields.Boolean('Garage') + garden = fields.Boolean('Garden') + garden_area = fields.Integer('Garden Area (sqm)') garden_orientation = fields.Selection( string='Garden Orientation', selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], @@ -31,5 +31,4 @@ class EstateProperty(models.Model): string='Status', selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('canceled', 'Canceled')], required=True, copy=False, default='new') - - + \ No newline at end of file diff --git a/estate/views/estate_form_views.xml b/estate/views/estate_form_views.xml new file mode 100644 index 00000000000..a28c04c00fe --- /dev/null +++ b/estate/views/estate_form_views.xml @@ -0,0 +1,42 @@ + + + + estate.form + estate.property + +
+ + +

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
diff --git a/estate/views/estate_list_views.xml b/estate/views/estate_list_views.xml new file mode 100644 index 00000000000..5debb5d8c00 --- /dev/null +++ b/estate/views/estate_list_views.xml @@ -0,0 +1,18 @@ + + + + estate.property.list + estate.property + + + + + + + + + + + + + diff --git a/estate/views/estate_search_views.xml b/estate/views/estate_search_views.xml new file mode 100644 index 00000000000..9418955d803 --- /dev/null +++ b/estate/views/estate_search_views.xml @@ -0,0 +1,24 @@ + + + + estate.search + estate.property + + + + + + + + + + + + + + + + + + + From c2bb0ee80f431f5864bf3fa4169bf096b59789c2 Mon Sep 17 00:00:00 2001 From: coder-odoo Date: Tue, 17 Feb 2026 14:10:37 +0100 Subject: [PATCH 05/18] [IMP] estate: Adding Tags, offers, property type, salesman and buyer --- estate/__manifest__.py | 4 +- estate/models/__init__.py | 2 +- estate/models/estate_property.py | 10 +++- estate/models/estate_property_offer.py | 18 +++++++ estate/models/estate_property_tag.py | 12 +++++ estate/models/estate_property_type.py | 12 +++++ estate/security/ir.model.access.csv | 3 ++ estate/views/estate_form_views.xml | 65 +++++++++++++++++++++++++- estate/views/estate_list_views.xml | 33 +++++++++++++ estate/views/estate_menus.xml | 8 +++- estate/views/estate_property_views.xml | 8 ---- estate/views/estate_search_views.xml | 10 ++++ estate/views/estate_views.xml | 20 ++++++++ 13 files changed, 189 insertions(+), 16 deletions(-) create mode 100644 estate/models/estate_property_offer.py create mode 100644 estate/models/estate_property_tag.py create mode 100644 estate/models/estate_property_type.py delete mode 100644 estate/views/estate_property_views.xml create mode 100644 estate/views/estate_views.xml diff --git a/estate/__manifest__.py b/estate/__manifest__.py index f724c8c6e2e..c4c76bcf090 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -10,10 +10,10 @@ """, 'data': [ 'security/ir.model.access.csv', - 'views/estate_property_views.xml', + 'views/estate_views.xml', 'views/estate_list_views.xml', 'views/estate_form_views.xml', 'views/estate_search_views.xml', - 'views/estate_menus.xml', + 'views/estate_menus.xml' ] } diff --git a/estate/models/__init__.py b/estate/models/__init__.py index ddcab4c3593..ee6de63620b 100644 --- a/estate/models/__init__.py +++ b/estate/models/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import estate_property +from . import estate_property, estate_property_type, estate_property_tag, estate_property_offer diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 48d24bfcfb9..f22e7a70fca 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -2,8 +2,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models -import datetime - class EstateProperty(models.Model): _name = "estate.property" @@ -26,6 +24,14 @@ class EstateProperty(models.Model): selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], help="Type is used to choose the orientation") + property_type_id = fields.Many2one('estate.property.type', string='Property Types') + seller_id = fields.Many2one('res.users', string='Salesman', default=lambda self: self.env.user) + buyer_id = fields.Many2one('res.partner', string='Buyer', copy=False) + + tag_ids = fields.Many2many('estate.property.tag', string='Tags') + + offer_ids = fields.One2many('estate.property.offer', 'property_id') + active = fields.Boolean(default=True) state = fields.Selection( string='Status', diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py new file mode 100644 index 00000000000..e893e490d55 --- /dev/null +++ b/estate/models/estate_property_offer.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class EstatePropertyOffer(models.Model): + _name = "estate.property.offer" + _description = "A table for estate property offers" + + price = fields.Float('Price') + status = fields.Selection( + string='Status', + selection=[('accepted', 'Accepted'), ('refused', 'Refused')], + copy=False) + partner_id = fields.Many2one('res.partner', string='Partner', required=True) + property_id = fields.Many2one('estate.property', string='Property', required=True) + \ No newline at end of file diff --git a/estate/models/estate_property_tag.py b/estate/models/estate_property_tag.py new file mode 100644 index 00000000000..e29144ab468 --- /dev/null +++ b/estate/models/estate_property_tag.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class EstatePropertyTag(models.Model): + _name = "estate.property.tag" + _description = "A table for estate properties tags" + + name = fields.Char('Property Tags', required=True) + \ No newline at end of file diff --git a/estate/models/estate_property_type.py b/estate/models/estate_property_type.py new file mode 100644 index 00000000000..b8998536bf9 --- /dev/null +++ b/estate/models/estate_property_type.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class EstatePropertyType(models.Model): + _name = "estate.property.type" + _description = "A table for estate properties types" + + name = fields.Char('Property Types', required=True) + \ No newline at end of file diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv index 98f4671fb0d..31d3eb59dfd 100644 --- a/estate/security/ir.model.access.csv +++ b/estate/security/ir.model.access.csv @@ -1,2 +1,5 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1 +type.access_property_type,access_property_type,estate.model_estate_property_type,base.group_user,1,1,1,1 +tag.access_property_tag,access_property_tag,estate.model_estate_property_tag,base.group_user,1,1,1,1 +offer.access_property_offer,access_property_offer,estate.model_estate_property_offer,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/estate/views/estate_form_views.xml b/estate/views/estate_form_views.xml index a28c04c00fe..590e093acfb 100644 --- a/estate/views/estate_form_views.xml +++ b/estate/views/estate_form_views.xml @@ -4,15 +4,19 @@ estate.form estate.property -
+

+ + + + @@ -34,9 +38,68 @@ + + + + + + + + + + +
+ + + estate.type.form + estate.property.type + +
+ + +

+ +

+
+
+
+
+
+ + + estate.tag.form + estate.property.tag + +
+ + +

+ +

+
+
+
+
+
+ + + estate.offer.form + estate.property.offer + +
+ + + + + + + +
+
+
diff --git a/estate/views/estate_list_views.xml b/estate/views/estate_list_views.xml index 5debb5d8c00..0db6441ff77 100644 --- a/estate/views/estate_list_views.xml +++ b/estate/views/estate_list_views.xml @@ -6,6 +6,7 @@ + @@ -15,4 +16,36 @@ + + + estate.property.type.list + estate.property.type + + + + + + + + + estate.property.tag.list + estate.property.tag + + + + + + + + + estate.property.offer.list + estate.property.offer + + + + + + + + diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml index cd4c77bc2d6..1a1ed06b449 100644 --- a/estate/views/estate_menus.xml +++ b/estate/views/estate_menus.xml @@ -1,8 +1,12 @@ - - + + + + + + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml deleted file mode 100644 index 420bdc65197..00000000000 --- a/estate/views/estate_property_views.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - Properties - estate.property - list,form - - diff --git a/estate/views/estate_search_views.xml b/estate/views/estate_search_views.xml index 9418955d803..b5b5ed2aaa8 100644 --- a/estate/views/estate_search_views.xml +++ b/estate/views/estate_search_views.xml @@ -21,4 +21,14 @@ + + + estate.type.search + estate.property.type + + + + + + diff --git a/estate/views/estate_views.xml b/estate/views/estate_views.xml new file mode 100644 index 00000000000..80fbd1657a4 --- /dev/null +++ b/estate/views/estate_views.xml @@ -0,0 +1,20 @@ + + + + Properties + estate.property + list,form + + + + Property Types + estate.property.type + list,form + + + + Property Tags + estate.property.tag + list,form + + From 3d095b885ca6addcad1b66883907dabf6ef75ead Mon Sep 17 00:00:00 2001 From: coder-odoo Date: Tue, 17 Feb 2026 16:06:45 +0100 Subject: [PATCH 06/18] [IMP] estate: Adding computed/onchange fields to improve the user experience --- estate/models/estate_property.py | 31 +++++++++++++++++++++----- estate/models/estate_property_offer.py | 18 +++++++++++++-- estate/views/estate_form_views.xml | 8 ++++--- estate/views/estate_list_views.xml | 2 ++ 4 files changed, 49 insertions(+), 10 deletions(-) diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index f22e7a70fca..ce066c63f6f 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models +from odoo import fields, models, api class EstateProperty(models.Model): _name = "estate.property" @@ -23,18 +23,39 @@ class EstateProperty(models.Model): string='Garden Orientation', selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], help="Type is used to choose the orientation") - property_type_id = fields.Many2one('estate.property.type', string='Property Types') seller_id = fields.Many2one('res.users', string='Salesman', default=lambda self: self.env.user) buyer_id = fields.Many2one('res.partner', string='Buyer', copy=False) - tag_ids = fields.Many2many('estate.property.tag', string='Tags') - offer_ids = fields.One2many('estate.property.offer', 'property_id') - active = fields.Boolean(default=True) state = fields.Selection( string='Status', selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('canceled', 'Canceled')], required=True, copy=False, default='new') + total_area = fields.Integer('Total Area (sqm)', compute="_compute_total_area") + best_price = fields.Float('Best Offer', compute='_compute_best_price') + + + @api.depends('living_area', 'garden_area') + def _compute_total_area(self): + for line in self: + line.total_area = line.garden_area + line.living_area + + @api.depends('offer_ids') + def _compute_best_price(self): + for line in self: + if line.offer_ids: + line.best_price = max(line.offer_ids.mapped('price')) + else: + line.best_price = 0.0 + + @api.onchange("garden") + def _onchange_partner_id(self): + if self.garden: + self.garden_area = 10 + self.garden_orientation = 'north' + else: + self.garden_area = 0 + self.garden_orientation = False \ No newline at end of file diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py index e893e490d55..70a62f51c37 100644 --- a/estate/models/estate_property_offer.py +++ b/estate/models/estate_property_offer.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models +from datetime import timedelta +from odoo import fields, models, api class EstatePropertyOffer(models.Model): @@ -15,4 +16,17 @@ class EstatePropertyOffer(models.Model): copy=False) partner_id = fields.Many2one('res.partner', string='Partner', required=True) property_id = fields.Many2one('estate.property', string='Property', required=True) - \ No newline at end of file + validity = fields.Integer('Validity (days)', default=7) + date_deadline = fields.Date('Deadline', compute='_compute_date_deadline', inverse='_inverse_date_deadline') + + @api.depends('create_date', 'validity') + def _compute_date_deadline(self): + for offer in self: + if offer.create_date: + offer.date_deadline = offer.create_date + timedelta(days=offer.validity) + else: + offer.date_deadline = fields.Date.today() + timedelta(days=offer.validity) + + def _inverse_date_deadline(self): + for offer in self: + offer.validity = (offer.date_deadline - offer.create_date.date()).days diff --git a/estate/views/estate_form_views.xml b/estate/views/estate_form_views.xml index 590e093acfb..f1f240585c9 100644 --- a/estate/views/estate_form_views.xml +++ b/estate/views/estate_form_views.xml @@ -22,6 +22,7 @@ + @@ -36,12 +37,11 @@ + - - - + @@ -96,6 +96,8 @@ + + diff --git a/estate/views/estate_list_views.xml b/estate/views/estate_list_views.xml index 0db6441ff77..82c3e35bb90 100644 --- a/estate/views/estate_list_views.xml +++ b/estate/views/estate_list_views.xml @@ -44,6 +44,8 @@ + + From bca84cb79b37b56c5296efe71d4d1d59518e57e8 Mon Sep 17 00:00:00 2001 From: coder-odoo Date: Tue, 17 Feb 2026 17:00:49 +0100 Subject: [PATCH 07/18] [IMP] estate: Adding Sold/Cancel button and Accepted/Refused offer --- .gitignore | 3 +++ estate/__init__.py | 1 - estate/models/__init__.py | 8 ++++++-- estate/models/estate_property.py | 23 +++++++++++++++++++---- estate/models/estate_property_offer.py | 16 +++++++++++++--- estate/models/estate_property_tag.py | 2 -- estate/models/estate_property_type.py | 2 -- estate/views/estate_form_views.xml | 5 +++++ estate/views/estate_list_views.xml | 2 ++ 9 files changed, 48 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index b6e47617de1..cbb028e80c1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ __pycache__/ *.py[cod] *$py.class +# Ruff filter +*.toml + # C extensions *.so diff --git a/estate/__init__.py b/estate/__init__.py index dc5e6b693d1..d6210b1285d 100644 --- a/estate/__init__.py +++ b/estate/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import models diff --git a/estate/models/__init__.py b/estate/models/__init__.py index ee6de63620b..a4af1d4d945 100644 --- a/estate/models/__init__.py +++ b/estate/models/__init__.py @@ -1,4 +1,8 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import estate_property, estate_property_type, estate_property_tag, estate_property_offer +from . import ( + estate_property, + estate_property_offer, + estate_property_tag, + estate_property_type, +) diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index ce066c63f6f..4ca792775d1 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -1,7 +1,8 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models, api +from odoo import api, fields, models +from odoo.exceptions import UserError + class EstateProperty(models.Model): _name = "estate.property" @@ -36,7 +37,6 @@ class EstateProperty(models.Model): total_area = fields.Integer('Total Area (sqm)', compute="_compute_total_area") best_price = fields.Float('Best Offer', compute='_compute_best_price') - @api.depends('living_area', 'garden_area') def _compute_total_area(self): for line in self: @@ -58,4 +58,19 @@ def _onchange_partner_id(self): else: self.garden_area = 0 self.garden_orientation = False - \ No newline at end of file + + def action_sold(self): + for record in self: + if record.state != 'canceled': + record.state = 'sold' + else: + raise UserError("You cannot sell a canceled property.") + return True + + def action_cancel(self): + for record in self: + if record.state != 'sold': + record.state = 'canceled' + else: + raise UserError("You cannot cancel a sold property.") + return True diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py index 70a62f51c37..f9fbe69189b 100644 --- a/estate/models/estate_property_offer.py +++ b/estate/models/estate_property_offer.py @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from datetime import timedelta -from odoo import fields, models, api + +from odoo import api, fields, models class EstatePropertyOffer(models.Model): @@ -26,7 +26,17 @@ def _compute_date_deadline(self): offer.date_deadline = offer.create_date + timedelta(days=offer.validity) else: offer.date_deadline = fields.Date.today() + timedelta(days=offer.validity) - + def _inverse_date_deadline(self): for offer in self: offer.validity = (offer.date_deadline - offer.create_date.date()).days + + def action_accept_offer(self): + for record in self: + record.status = 'accepted' + record.property_id.selling_price = record.price + record.property_id.buyer_id = record.partner_id + + def action_refuse_offer(self): + for record in self: + record.status = 'refused' diff --git a/estate/models/estate_property_tag.py b/estate/models/estate_property_tag.py index e29144ab468..fe5afa545e8 100644 --- a/estate/models/estate_property_tag.py +++ b/estate/models/estate_property_tag.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models @@ -9,4 +8,3 @@ class EstatePropertyTag(models.Model): _description = "A table for estate properties tags" name = fields.Char('Property Tags', required=True) - \ No newline at end of file diff --git a/estate/models/estate_property_type.py b/estate/models/estate_property_type.py index b8998536bf9..24c67cf55b4 100644 --- a/estate/models/estate_property_type.py +++ b/estate/models/estate_property_type.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models @@ -9,4 +8,3 @@ class EstatePropertyType(models.Model): _description = "A table for estate properties types" name = fields.Char('Property Types', required=True) - \ No newline at end of file diff --git a/estate/views/estate_form_views.xml b/estate/views/estate_form_views.xml index f1f240585c9..7caece687b5 100644 --- a/estate/views/estate_form_views.xml +++ b/estate/views/estate_form_views.xml @@ -5,6 +5,10 @@ estate.property
+
+

@@ -16,6 +20,7 @@ + diff --git a/estate/views/estate_list_views.xml b/estate/views/estate_list_views.xml index 82c3e35bb90..c59c38ff89b 100644 --- a/estate/views/estate_list_views.xml +++ b/estate/views/estate_list_views.xml @@ -46,6 +46,8 @@ +

- + - - + @@ -40,13 +40,13 @@ - - + + - + @@ -66,11 +66,27 @@ +
+ +

+ + + + + + + + + + +
diff --git a/estate/views/estate_list_views.xml b/estate/views/estate_list_views.xml index ba0a9fba06f..73feb7245b9 100644 --- a/estate/views/estate_list_views.xml +++ b/estate/views/estate_list_views.xml @@ -4,15 +4,15 @@ estate.property.list estate.property - + - + - + @@ -22,6 +22,7 @@ estate.property.type + @@ -31,8 +32,8 @@ estate.property.tag.list estate.property.tag - - + + @@ -41,14 +42,13 @@ estate.property.offer.list estate.property.offer - + - + +
+
+ + From 2590d7335ce3b1667bd6b25556a1a7ce392c9ba8 Mon Sep 17 00:00:00 2001 From: coder-odoo Date: Fri, 20 Feb 2026 11:40:09 +0100 Subject: [PATCH 14/18] [ADD] awesome_owl: Js - All Part 1 --- awesome_owl/static/src/card/card.js | 16 ++++++++ awesome_owl/static/src/card/card.xml | 23 +++++++++++ awesome_owl/static/src/counter/counter.js | 19 +++++++++ awesome_owl/static/src/counter/counter.xml | 9 +++++ awesome_owl/static/src/playground.js | 15 +++++++- awesome_owl/static/src/playground.xml | 18 ++++++++- awesome_owl/static/src/todo/todo_item.js | 24 ++++++++++++ awesome_owl/static/src/todo/todo_item.xml | 12 ++++++ awesome_owl/static/src/todo/todo_list.js | 45 ++++++++++++++++++++++ awesome_owl/static/src/todo/todo_list.xml | 13 +++++++ 10 files changed, 191 insertions(+), 3 deletions(-) create mode 100644 awesome_owl/static/src/card/card.js create mode 100644 awesome_owl/static/src/card/card.xml create mode 100644 awesome_owl/static/src/counter/counter.js create mode 100644 awesome_owl/static/src/counter/counter.xml create mode 100644 awesome_owl/static/src/todo/todo_item.js create mode 100644 awesome_owl/static/src/todo/todo_item.xml create mode 100644 awesome_owl/static/src/todo/todo_list.js create mode 100644 awesome_owl/static/src/todo/todo_list.xml diff --git a/awesome_owl/static/src/card/card.js b/awesome_owl/static/src/card/card.js new file mode 100644 index 00000000000..6d73c9c4498 --- /dev/null +++ b/awesome_owl/static/src/card/card.js @@ -0,0 +1,16 @@ +import { Component, useState } from "@odoo/owl"; + +export class Card extends Component { + static template = "awesome_owl.card"; + static props = { + title: { type: String }, + slots: { type: Object, shape: { default: Object } } + }; + + setup() { + this.state = useState({ + open: false, + }); + } + +} diff --git a/awesome_owl/static/src/card/card.xml b/awesome_owl/static/src/card/card.xml new file mode 100644 index 00000000000..365cc1ecc60 --- /dev/null +++ b/awesome_owl/static/src/card/card.xml @@ -0,0 +1,23 @@ + + + + +
+
+
+
+ +
+ +
+ +
+
+
+
+
+ +
diff --git a/awesome_owl/static/src/counter/counter.js b/awesome_owl/static/src/counter/counter.js new file mode 100644 index 00000000000..c1f6e4cd1e9 --- /dev/null +++ b/awesome_owl/static/src/counter/counter.js @@ -0,0 +1,19 @@ +import { Component, useState } from "@odoo/owl"; + +export class Counter extends Component { + static template = "awesome_owl.counter"; + static props = { + onChange: { type: Function, optional: true }, + }; + + setup() { + this.state = useState({ value: 0 }); + } + + increment() { + this.state.value++; + if (this.props.onChange) { + this.props.onChange(); + } + } +} \ No newline at end of file diff --git a/awesome_owl/static/src/counter/counter.xml b/awesome_owl/static/src/counter/counter.xml new file mode 100644 index 00000000000..5e0ec2135c0 --- /dev/null +++ b/awesome_owl/static/src/counter/counter.xml @@ -0,0 +1,9 @@ + + + + +

Counter:

+ +
+ +
diff --git a/awesome_owl/static/src/playground.js b/awesome_owl/static/src/playground.js index 4ac769b0aa5..0eb9ba5560e 100644 --- a/awesome_owl/static/src/playground.js +++ b/awesome_owl/static/src/playground.js @@ -1,5 +1,18 @@ -import { Component } from "@odoo/owl"; +import { Component, markup, useState } from "@odoo/owl"; +import { Counter } from "./counter/counter"; +import { Card } from "./card/card"; +import { TodoList } from "./todo/todo_list"; export class Playground extends Component { static template = "awesome_owl.playground"; + + setup() { + this.sum = useState({ value: 0 }); + } + + incrementSum() { + this.sum.value++; + } + + static components = { Counter, Card, TodoList }; } diff --git a/awesome_owl/static/src/playground.xml b/awesome_owl/static/src/playground.xml index 4fb905d59f9..44e735e12c6 100644 --- a/awesome_owl/static/src/playground.xml +++ b/awesome_owl/static/src/playground.xml @@ -2,9 +2,23 @@ -
- hello world +

Playground

+ +
+ + +

Total:

+ + + + + + + + +

Todo List

+ diff --git a/awesome_owl/static/src/todo/todo_item.js b/awesome_owl/static/src/todo/todo_item.js new file mode 100644 index 00000000000..38caf5c9de2 --- /dev/null +++ b/awesome_owl/static/src/todo/todo_item.js @@ -0,0 +1,24 @@ +import { Component } from "@odoo/owl"; + +export class TodoItem extends Component { + static template = "awesome_owl.todo_item"; + static props = { + todo: { + shape: { + id: Number, + description: String, + isCompleted: Boolean, + }, + }, + toggleState: Function, + removeTodo: Function, + }; + + onToggle() { + this.props.toggleState(this.props.todo.id); + } + + onRemove() { + this.props.removeTodo(this.props.todo.id); + } +} diff --git a/awesome_owl/static/src/todo/todo_item.xml b/awesome_owl/static/src/todo/todo_item.xml new file mode 100644 index 00000000000..9a4ebb9d582 --- /dev/null +++ b/awesome_owl/static/src/todo/todo_item.xml @@ -0,0 +1,12 @@ + + + + +

+ + . + +

+
+ +
diff --git a/awesome_owl/static/src/todo/todo_list.js b/awesome_owl/static/src/todo/todo_list.js new file mode 100644 index 00000000000..c6b9f38d01c --- /dev/null +++ b/awesome_owl/static/src/todo/todo_list.js @@ -0,0 +1,45 @@ +import { Component, useState, useRef, onMounted } from "@odoo/owl"; +import { TodoItem } from "./todo_item"; + +export class TodoList extends Component { + static template = "awesome_owl.todo_list"; + + setup() { + this.state = useState({todos: []}); + this.counter = 0; + this.inputTodo = useRef("inputTodo"); + + onMounted(() => { + this.inputTodo.el.focus(); + }); + } + + addTodo(ev) { + if (ev.key === "Enter" && ev.target.value != "") { + this.state.todos.push({ + id: this.counter++, + description: ev.target.value, + isCompleted: false, + }); + ev.target.value = ""; + } + } + + toggleTodoState = (todoId) => { + const todo = this.state.todos.find((t) => t.id === todoId); + if (todo) { + if (todo.isCompleted) { + todo.isCompleted = false; + } else { + todo.isCompleted = true; + } + } + } + + removeTodo = (todoId) => { + const index = this.state.todos.findIndex((t) => t.id === todoId); + this.state.todos.splice(index, 1); + } + + static components = { TodoItem }; +} diff --git a/awesome_owl/static/src/todo/todo_list.xml b/awesome_owl/static/src/todo/todo_list.xml new file mode 100644 index 00000000000..511e80989fd --- /dev/null +++ b/awesome_owl/static/src/todo/todo_list.xml @@ -0,0 +1,13 @@ + + + + +
+ + + + +
+
+ +
From 08a98ed6a8dcb7697c7c354cb1119982cb6c24d2 Mon Sep 17 00:00:00 2001 From: coder-odoo Date: Mon, 23 Feb 2026 14:31:33 +0100 Subject: [PATCH 15/18] [ADD] awesome_dashboard: JS - All part 2 --- awesome_dashboard/__manifest__.py | 8 +- awesome_dashboard/static/src/dashboard.js | 8 -- awesome_dashboard/static/src/dashboard.xml | 8 -- .../src/dashboard/Dashboard/dashboard.js | 74 +++++++++++++++++++ .../src/dashboard/Dashboard/dashboard.scss | 20 +++++ .../src/dashboard/Dashboard/dashboard.xml | 23 ++++++ .../dashboard/DashboardItem/dashboarditem.js | 13 ++++ .../DashboardItem/dashboarditem.scss | 11 +++ .../dashboard/DashboardItem/dashboarditem.xml | 10 +++ .../DashboardSettings/dashboardsettings.js | 41 ++++++++++ .../DashboardSettings/dashboardsettings.scss | 15 ++++ .../DashboardSettings/dashboardsettings.xml | 18 +++++ .../src/dashboard/NumberCard/number_card.js | 9 +++ .../src/dashboard/NumberCard/number_card.xml | 9 +++ .../static/src/dashboard/PieChart/piechart.js | 46 ++++++++++++ .../src/dashboard/PieChart/piechart.xml | 10 +++ .../dashboard/PieChartCard/pie_chart_card.js | 12 +++ .../dashboard/PieChartCard/pie_chart_card.xml | 9 +++ .../static/src/dashboard/dashboard_items.js | 71 ++++++++++++++++++ .../dashboard/services/statistics_service.js | 46 ++++++++++++ .../static/src/dashboard_action.js | 12 +++ 21 files changed, 454 insertions(+), 19 deletions(-) delete mode 100644 awesome_dashboard/static/src/dashboard.js delete mode 100644 awesome_dashboard/static/src/dashboard.xml create mode 100644 awesome_dashboard/static/src/dashboard/Dashboard/dashboard.js create mode 100644 awesome_dashboard/static/src/dashboard/Dashboard/dashboard.scss create mode 100644 awesome_dashboard/static/src/dashboard/Dashboard/dashboard.xml create mode 100644 awesome_dashboard/static/src/dashboard/DashboardItem/dashboarditem.js create mode 100644 awesome_dashboard/static/src/dashboard/DashboardItem/dashboarditem.scss create mode 100644 awesome_dashboard/static/src/dashboard/DashboardItem/dashboarditem.xml create mode 100644 awesome_dashboard/static/src/dashboard/DashboardSettings/dashboardsettings.js create mode 100644 awesome_dashboard/static/src/dashboard/DashboardSettings/dashboardsettings.scss create mode 100644 awesome_dashboard/static/src/dashboard/DashboardSettings/dashboardsettings.xml create mode 100644 awesome_dashboard/static/src/dashboard/NumberCard/number_card.js create mode 100644 awesome_dashboard/static/src/dashboard/NumberCard/number_card.xml create mode 100644 awesome_dashboard/static/src/dashboard/PieChart/piechart.js create mode 100644 awesome_dashboard/static/src/dashboard/PieChart/piechart.xml create mode 100644 awesome_dashboard/static/src/dashboard/PieChartCard/pie_chart_card.js create mode 100644 awesome_dashboard/static/src/dashboard/PieChartCard/pie_chart_card.xml create mode 100644 awesome_dashboard/static/src/dashboard/dashboard_items.js create mode 100644 awesome_dashboard/static/src/dashboard/services/statistics_service.js create mode 100644 awesome_dashboard/static/src/dashboard_action.js diff --git a/awesome_dashboard/__manifest__.py b/awesome_dashboard/__manifest__.py index a1cd72893d7..e30cf9f72ef 100644 --- a/awesome_dashboard/__manifest__.py +++ b/awesome_dashboard/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- { 'name': "Awesome Dashboard", @@ -23,8 +22,11 @@ ], 'assets': { 'web.assets_backend': [ - 'awesome_dashboard/static/src/**/*', + 'awesome_dashboard/static/src/dashboard_action.js', + ], + 'awesome_dashboard.dashboard': [ + 'awesome_dashboard/static/src/dashboard/**/*', ], }, - 'license': 'AGPL-3' + 'license': 'AGPL-3', } diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js deleted file mode 100644 index c4fb245621b..00000000000 --- a/awesome_dashboard/static/src/dashboard.js +++ /dev/null @@ -1,8 +0,0 @@ -import { Component } from "@odoo/owl"; -import { registry } from "@web/core/registry"; - -class AwesomeDashboard extends Component { - static template = "awesome_dashboard.AwesomeDashboard"; -} - -registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboard); diff --git a/awesome_dashboard/static/src/dashboard.xml b/awesome_dashboard/static/src/dashboard.xml deleted file mode 100644 index 1a2ac9a2fed..00000000000 --- a/awesome_dashboard/static/src/dashboard.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - hello dashboard - - - diff --git a/awesome_dashboard/static/src/dashboard/Dashboard/dashboard.js b/awesome_dashboard/static/src/dashboard/Dashboard/dashboard.js new file mode 100644 index 00000000000..2111da8e629 --- /dev/null +++ b/awesome_dashboard/static/src/dashboard/Dashboard/dashboard.js @@ -0,0 +1,74 @@ +import { Component, useState } from "@odoo/owl"; +import { registry } from "@web/core/registry"; +import { Layout } from "@web/search/layout"; +import { useService } from "@web/core/utils/hooks"; +import { DashboardItem } from "../DashboardItem/dashboarditem"; +import { DashboardSettings } from "../DashboardSettings/dashboardsettings"; +import "../dashboard_items"; + +const STORAGE_KEY = "awesome_dashboard.removed_item_ids"; + +class AwesomeDashboard extends Component { + static template = "awesome_dashboard.AwesomeDashboard"; + static components = { Layout, DashboardItem }; + + setup() { + this.allItems = registry.category("awesome_dashboard").getAll(); + this.actionService = useService("action"); + this.dialogService = useService("dialog"); + this.statisticsService = useService("awesome_dashboard.statistics"); + this.statistics = useState(this.statisticsService.statistics); + this.state = useState({ + removedItemIds: this.loadRemovedItemIds(), + }); + } + + loadRemovedItemIds() { + try { + const value = localStorage.getItem(STORAGE_KEY); + const parsed = value ? JSON.parse(value) : []; + return Array.isArray(parsed) ? parsed : []; + } catch (error) { + console.error("Failed to load removed item ids from localStorage:", error); + return []; + } + } + + saveRemovedItemIds(removedItemIds) { + try { + localStorage.setItem(STORAGE_KEY, JSON.stringify(removedItemIds)); + this.state.removedItemIds = removedItemIds; + } catch (error) { + console.error("Failed to save removed item ids to localStorage:", error); + } + } + + get items() { + const removedIds = new Set(this.state.removedItemIds); + return this.allItems.filter((item) => !removedIds.has(item.id)); + } + + openCustomers() { + this.actionService.doAction("base.action_partner_form"); + } + + openLeads() { + this.actionService.doAction({ + type: "ir.actions.act_window", + name: "Leads", + res_model: "crm.lead", + views: [[false, "list"], [false, "form"]], + }); + } + + openSettings() { + this.dialogService.add(DashboardSettings, { + title: "Dashboard settings", + removedItemIds: this.state.removedItemIds, + applyConfiguration: (removedItemIds) => this.saveRemovedItemIds(removedItemIds), + }); + } + +} + +registry.category("lazy_components").add("AwesomeDashboard", AwesomeDashboard); diff --git a/awesome_dashboard/static/src/dashboard/Dashboard/dashboard.scss b/awesome_dashboard/static/src/dashboard/Dashboard/dashboard.scss new file mode 100644 index 00000000000..6be2c9267e6 --- /dev/null +++ b/awesome_dashboard/static/src/dashboard/Dashboard/dashboard.scss @@ -0,0 +1,20 @@ +.o_dashboard { + background: #2A7B9B; + background: linear-gradient(90deg,rgba(42, 123, 155, 1) 0%, rgba(87, 199, 133, 1) 50%, rgba(237, 221, 83, 1) 100%); + + .o_dashboard_row { + display: flex; + flex-wrap: wrap; + justify-content: center; + } + + .o_header_dashboard_item { + font-size: 1.5em; + } + + .o_average_quantity { + font-size: 2em; + color: #008528; + font-weight: bold; + } +} diff --git a/awesome_dashboard/static/src/dashboard/Dashboard/dashboard.xml b/awesome_dashboard/static/src/dashboard/Dashboard/dashboard.xml new file mode 100644 index 00000000000..595de5f1b89 --- /dev/null +++ b/awesome_dashboard/static/src/dashboard/Dashboard/dashboard.xml @@ -0,0 +1,23 @@ + + + + + + + +