From 748a2b7c39760ae44f2bf5bd4c62170de1d0cad7 Mon Sep 17 00:00:00 2001 From: tskv Date: Tue, 18 Nov 2025 14:05:20 +0100 Subject: [PATCH 01/29] [ADD] estate:taskv --- estate/__init__.py | 0 estate/__manifest__.py | 14 ++++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 estate/__init__.py create mode 100644 estate/__manifest__.py diff --git a/estate/__init__.py b/estate/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/estate/__manifest__.py b/estate/__manifest__.py new file mode 100644 index 00000000000..6fb5b82d9fe --- /dev/null +++ b/estate/__manifest__.py @@ -0,0 +1,14 @@ +{ + 'name': "Real Estate", + 'version': '1.0', + 'depends': ['base'], + 'author': "taskv", + 'category': 'Category', + 'description': """ + Description text + """, + 'data': [ + ], + 'demo': [ + ], +} \ No newline at end of file From 07ee005b359ab41012116f8c78f72920e438fcb3 Mon Sep 17 00:00:00 2001 From: tskv Date: Tue, 18 Nov 2025 14:06:46 +0100 Subject: [PATCH 02/29] [ADD] estate: init --- estate/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 6fb5b82d9fe..5660bb5c774 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -5,7 +5,7 @@ 'author': "taskv", 'category': 'Category', 'description': """ - Description text + Description """, 'data': [ ], From 0db978f363b912e8a444c9ffb1afa6c57aba9769 Mon Sep 17 00:00:00 2001 From: tskv Date: Tue, 18 Nov 2025 14:25:46 +0100 Subject: [PATCH 03/29] [IMP] new model: estate_property --- estate/__init__.py | 4 ++++ estate/__manifest__.py | 3 +++ estate/models/__init__.py | 4 ++++ estate/models/estate_property.py | 11 +++++++++++ 4 files changed, 22 insertions(+) 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 index e69de29bb2d..e9917144f69 100644 --- a/estate/__init__.py +++ 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 \ No newline at end of file diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 5660bb5c774..090a184a7cd 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -11,4 +11,7 @@ ], 'demo': [ ], + 'installable': True, + 'application': True, + 'license': 'LGPL-3', } \ No newline at end of file diff --git a/estate/models/__init__.py b/estate/models/__init__.py new file mode 100644 index 00000000000..0c4a347c60d --- /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 \ No newline at end of file diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py new file mode 100644 index 00000000000..7a179bb239c --- /dev/null +++ b/estate/models/estate_property.py @@ -0,0 +1,11 @@ +# -*- 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' + + name = fields.Char('Estate Property', quired=True, translate='True') + active = fields.Boolean('Active', default=True) + price = fields.Float('Price', default=0) \ No newline at end of file From b78f9c1689bd7f760c43339a3d2893f1a1ad3b38 Mon Sep 17 00:00:00 2001 From: tskv Date: Tue, 18 Nov 2025 14:41:07 +0100 Subject: [PATCH 04/29] [IMP] estate_property:new fields --- estate/__manifest__.py | 2 +- estate/models/estate_property.py | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 090a184a7cd..f1741a8de6a 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -5,7 +5,7 @@ 'author': "taskv", 'category': 'Category', 'description': """ - Description + Tutorial Project """, 'data': [ ], diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 7a179bb239c..8061c6cf264 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -5,7 +5,26 @@ class EstateProperty(models.Model): _name = 'estate.property' + _description = 'Estate Property' - name = fields.Char('Estate Property', quired=True, translate='True') + name = fields.Char('Estate Property', required=True, translate='True') active = fields.Boolean('Active', default=True) - price = fields.Float('Price', default=0) \ No newline at end of file + description = fields.Text('Description') + postcode = fields.Char('Postcode') + date_availability = fields.Date('Date Availability') + expected_price = fields.Float('Expected Price', required=True) + selling_price = fields.Float('Selling Price') + bedrooms = fields.Integer('Bedrooms') + living_area = fields.Integer('Living Area') + facades = fields.Integer('Facades') + garage = fields.Boolean('Garage') + garden = fields.Boolean('Garden') + garden_area = fields.Integer('Garden Area') + garden_orientation = fields.Selection(string='Garden orientation', + selection=[('north', 'North'), + ('south', 'South'), + ('east', 'East'), + ('west', 'West')] + ) + + From c66d2ad57a20ef29157612cdbda77111f2fb04ad Mon Sep 17 00:00:00 2001 From: tskv Date: Tue, 18 Nov 2025 14:51:54 +0100 Subject: [PATCH 05/29] [IMP] estate: access rights --- estate/__init__.py | 3 +-- estate/__manifest__.py | 7 +++++- estate/models/__init__.py | 3 +-- estate/models/estate_property.py | 8 +++---- estate/security/ir.model.access.csv | 2 ++ estate/views/estate_menus.xml | 19 +++++++++++++++ estate/views/estate_property_views.xml | 32 ++++++++++++++++++++++++++ 7 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 estate/security/ir.model.access.csv create mode 100644 estate/views/estate_menus.xml create mode 100644 estate/views/estate_property_views.xml diff --git a/estate/__init__.py b/estate/__init__.py index e9917144f69..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 \ No newline at end of file +from . import models diff --git a/estate/__manifest__.py b/estate/__manifest__.py index f1741a8de6a..e132f8bd045 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -8,10 +8,15 @@ Tutorial Project """, 'data': [ + 'security/ir.model.access.csv', + + + 'views/estate_property_views.xml', + 'views/estate_menus.xml', ], 'demo': [ ], 'installable': True, 'application': True, 'license': 'LGPL-3', -} \ No newline at end of file +} diff --git a/estate/models/__init__.py b/estate/models/__init__.py index 0c4a347c60d..09b94f90f8d 100644 --- a/estate/models/__init__.py +++ b/estate/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import estate_property \ No newline at end of file +from . import estate_property diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 8061c6cf264..a4d74e976c3 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -1,18 +1,18 @@ -# -*- 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 = 'Estate Property' - name = fields.Char('Estate Property', required=True, translate='True') + name = fields.Char('Estate Property', translate='True') active = fields.Boolean('Active', default=True) description = fields.Text('Description') postcode = fields.Char('Postcode') date_availability = fields.Date('Date Availability') - expected_price = fields.Float('Expected Price', required=True) + expected_price = fields.Float('Expected Price') selling_price = fields.Float('Selling Price') bedrooms = fields.Integer('Bedrooms') living_area = fields.Integer('Living Area') @@ -26,5 +26,3 @@ class EstateProperty(models.Model): ('east', 'East'), ('west', 'West')] ) - - diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv new file mode 100644 index 00000000000..d9d6ba57cc5 --- /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 +access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1 diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml new file mode 100644 index 00000000000..9b6f1ae4075 --- /dev/null +++ b/estate/views/estate_menus.xml @@ -0,0 +1,19 @@ + + + + + + + + \ No newline at end of file diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml new file mode 100644 index 00000000000..6ddba1aa607 --- /dev/null +++ b/estate/views/estate_property_views.xml @@ -0,0 +1,32 @@ + + + + estate.property.view.form + estate.property + +
+ + + +
+
+
+ + + estate.property.view.list + estate.property + + + + + + + + + + Estate Property + estate.property + list,form + + +
\ No newline at end of file From 821328f1c78c4002c9c7fd720267bc9d75327438 Mon Sep 17 00:00:00 2001 From: tskv Date: Tue, 18 Nov 2025 17:09:23 +0100 Subject: [PATCH 06/29] [IMP] estate: menu + view form --- estate/__manifest__.py | 1 - estate/models/estate_property.py | 18 ++++++++++++----- estate/views/estate_menus.xml | 2 +- estate/views/estate_property_views.xml | 27 +++++++++++++++++++++++--- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/estate/__manifest__.py b/estate/__manifest__.py index e132f8bd045..548c729ac60 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -10,7 +10,6 @@ '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 a4d74e976c3..291daf83a41 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -1,20 +1,21 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models +from datetime import timedelta class EstateProperty(models.Model): _name = 'estate.property' _description = 'Estate Property' - name = fields.Char('Estate Property', translate='True') + name = fields.Char('Estate Property', required=True, default='Unknown', translate='True') active = fields.Boolean('Active', default=True) description = fields.Text('Description') postcode = fields.Char('Postcode') - date_availability = fields.Date('Date Availability') - expected_price = fields.Float('Expected Price') - selling_price = fields.Float('Selling Price') - bedrooms = fields.Integer('Bedrooms') + date_availability = fields.Date('Date Availability', copy=False, default=fields.Datetime.now() + timedelta(days=90)) + 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') facades = fields.Integer('Facades') garage = fields.Boolean('Garage') @@ -26,3 +27,10 @@ class EstateProperty(models.Model): ('east', 'East'), ('west', 'West')] ) + state = fields.Selection(string='State', + selection=[('new', 'New'), + ('offer_received', 'Offer Received'), + ('offer_accepted', 'Offer Accepted'), + ('sold', 'Sold'), + ('cancelled', 'Cancelled')], + default='new', required=True, copy=False) diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml index 9b6f1ae4075..df87fa407b3 100644 --- a/estate/views/estate_menus.xml +++ b/estate/views/estate_menus.xml @@ -16,4 +16,4 @@ action="estate.estate_property_action" sequence="1"/> - \ No newline at end of file + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index 6ddba1aa607..1de456c498d 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -6,7 +6,28 @@
- + + + + + + + + + + + + + + + + + + + + + +
@@ -16,7 +37,7 @@ estate.property.view.list estate.property - + @@ -29,4 +50,4 @@ list,form - \ No newline at end of file + From afec0e3fda7ee7f452634458df6bb2141f3ea82e Mon Sep 17 00:00:00 2001 From: tskv Date: Wed, 19 Nov 2025 10:20:40 +0100 Subject: [PATCH 07/29] [IMP] estate: chapter 6 (views) --- estate/models/estate_property.py | 8 ++-- estate/views/estate_property_views.xml | 66 ++++++++++++++++++++------ 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 291daf83a41..81cf54c0528 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -8,19 +8,19 @@ class EstateProperty(models.Model): _name = 'estate.property' _description = 'Estate Property' - name = fields.Char('Estate Property', required=True, default='Unknown', translate='True') + name = fields.Char('Title', required=True, default='Unknown', translate='True') active = fields.Boolean('Active', default=True) description = fields.Text('Description') postcode = fields.Char('Postcode') - date_availability = fields.Date('Date Availability', copy=False, default=fields.Datetime.now() + timedelta(days=90)) + date_availability = fields.Date('Available From', copy=False, default=fields.Datetime.now() + timedelta(days=90)) 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') + 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') + garden_area = fields.Integer('Garden Area (sqm)') garden_orientation = fields.Selection(string='Garden orientation', selection=[('north', 'North'), ('south', 'South'), diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index 1de456c498d..5d60cad84e6 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -1,33 +1,63 @@ + + estate.property.search + estate.property + + + + + + + + + + + + + + + + + + + + estate.property.view.form estate.property
- - - - +
+

+ +

+
- - - - - + - + - - - - + + + + + + + + + + + + + +
@@ -38,8 +68,13 @@ estate.property - + + + + + +
@@ -48,6 +83,7 @@ Estate Property estate.property list,form +
From b87b0a4da91160cc56c23f9ee76dae93733f02d1 Mon Sep 17 00:00:00 2001 From: tskv Date: Wed, 19 Nov 2025 12:53:21 +0100 Subject: [PATCH 08/29] [IMP] estate: chapter 7 (relational fields) --- estate/__manifest__.py | 2 ++ estate/models/__init__.py | 3 ++ estate/models/estate_property.py | 7 +++++ estate/models/estate_property_offer.py | 15 +++++++++ estate/models/estate_property_tag.py | 10 ++++++ estate/models/estate_property_type.py | 10 ++++++ estate/security/ir.model.access.csv | 3 ++ estate/views/estate_menus.xml | 22 +++++++++---- estate/views/estate_property_tag_views.xml | 33 +++++++++++++++++++ estate/views/estate_property_type_views.xml | 35 +++++++++++++++++++++ estate/views/estate_property_views.xml | 27 ++++++++++++++-- 11 files changed, 158 insertions(+), 9 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 create mode 100644 estate/views/estate_property_tag_views.xml create mode 100644 estate/views/estate_property_type_views.xml diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 548c729ac60..49887de0548 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -11,6 +11,8 @@ 'security/ir.model.access.csv', 'views/estate_property_views.xml', + 'views/estate_property_type_views.xml', + 'views/estate_property_tag_views.xml', 'views/estate_menus.xml', ], 'demo': [ diff --git a/estate/models/__init__.py b/estate/models/__init__.py index 09b94f90f8d..7b28f0f82ad 100644 --- a/estate/models/__init__.py +++ b/estate/models/__init__.py @@ -1,3 +1,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import estate_property +from . import estate_property_type +from . import estate_property_tag +from . import estate_property_offer diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 81cf54c0528..5f25c472db7 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -34,3 +34,10 @@ class EstateProperty(models.Model): ('sold', 'Sold'), ('cancelled', 'Cancelled')], default='new', required=True, copy=False) + property_type_id = fields.Many2one('estate.property.type', string='Property Type') + property_tag_ids = fields.Many2many('estate.property.tag', string='Property Tag') + buyer_id = fields.Many2one('res.partner', string='Buyer', copy=False, + domain=[('is_company', '=', False)]) + salesperson_id = fields.Many2one('res.users', string='Salesperson', + default=lambda self: self.env.user) + offer_ids = fields.Many2many('estate.property.offer', 'property_id', string='Offers') diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py new file mode 100644 index 00000000000..0d27b000eeb --- /dev/null +++ b/estate/models/estate_property_offer.py @@ -0,0 +1,15 @@ +# 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 = 'Estate Property Offer' + + + price = fields.Float(string='Price') + status = fields.Selection(string='Status', copy=False, + selection=[('accepted', 'Accepted'), ('refused', 'Refused')]) + partner_id = fields.Many2one('res.partner', string='Customer', required=True) + property_id = fields.Many2one('estate.property', string='Property', required=True) diff --git a/estate/models/estate_property_tag.py b/estate/models/estate_property_tag.py new file mode 100644 index 00000000000..12586dcd3c3 --- /dev/null +++ b/estate/models/estate_property_tag.py @@ -0,0 +1,10 @@ +# 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 = 'Estate Property Tag' + + name = fields.Char(string='Property Tag', required=True) diff --git a/estate/models/estate_property_type.py b/estate/models/estate_property_type.py new file mode 100644 index 00000000000..c157e02370a --- /dev/null +++ b/estate/models/estate_property_type.py @@ -0,0 +1,10 @@ +# 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 = 'Estate Property Type' + + name = fields.Char(string='Property Type', required=True) diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv index d9d6ba57cc5..49bca99cac8 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 access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1 +access_estate_property_type,access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1 +access_estate_property_tag,access_estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1 +access_estate_property_offer,access_estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1 diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml index df87fa407b3..f619f1ce708 100644 --- a/estate/views/estate_menus.xml +++ b/estate/views/estate_menus.xml @@ -1,6 +1,5 @@ - @@ -8,12 +7,23 @@ id="properties_menu" name="Properties" parent="estate_menu_root" + action="estate.estate_property_action" sequence="1"/> + - + diff --git a/estate/views/estate_property_tag_views.xml b/estate/views/estate_property_tag_views.xml new file mode 100644 index 00000000000..05750dca150 --- /dev/null +++ b/estate/views/estate_property_tag_views.xml @@ -0,0 +1,33 @@ + + + + estate.property.tag.view.form + estate.property.tag + +
+ + + + + +
+
+
+ + + estate.property.tag.view.list + estate.property.tag + + + + + + + + + Estate Property Tag + estate.property.tag + list,form + + +
diff --git a/estate/views/estate_property_type_views.xml b/estate/views/estate_property_type_views.xml new file mode 100644 index 00000000000..d38ee04d82a --- /dev/null +++ b/estate/views/estate_property_type_views.xml @@ -0,0 +1,35 @@ + + + + estate.property.type.view.form + estate.property.type + +
+ +
+

+ +

+
+
+
+
+
+ + + estate.property.type.view.list + estate.property.type + + + + + + + + + Estate Property Type + estate.property.type + list,form + + +
diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index 5d60cad84e6..9deea421839 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -10,10 +10,13 @@ + + - + @@ -30,12 +33,14 @@
-

- +

+

+

+ @@ -57,6 +62,21 @@ + + + + + + + + + + + + + + +
@@ -70,6 +90,7 @@ + From ae446452ac1361f760794af8ff7820c8a92902bf Mon Sep 17 00:00:00 2001 From: tskv Date: Wed, 19 Nov 2025 14:14:48 +0100 Subject: [PATCH 09/29] [IMP] estate: chapter 8 (compute and onchange) --- estate/models/estate_property.py | 26 +++++++++++++++++++++++++- estate/models/estate_property_offer.py | 15 +++++++++++++-- estate/views/estate_property_views.xml | 10 +++++++--- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 5f25c472db7..62637107e78 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -1,6 +1,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models +from odoo import fields, models, api from datetime import timedelta @@ -41,3 +41,27 @@ class EstateProperty(models.Model): salesperson_id = fields.Many2one('res.users', string='Salesperson', default=lambda self: self.env.user) offer_ids = fields.Many2many('estate.property.offer', 'property_id', string='Offers') + total_area = fields.Integer('Total Area (sqm)', compute='_compute_total_area') + best_offer = fields.Float('Best Offer', compute='_compute_best_offer') + + @api.depends('garden_area', 'living_area') + def _compute_total_area(self): + for record in self: + record.total_area = record.garden_area + record.living_area + + @api.depends('offer_ids.price') + def _compute_best_offer(self): + for record in self: + if record.offer_ids: + record.best_offer = max(record.offer_ids.mapped('price')) + else: + record.best_offer = 0 + + @api.onchange('garden') + def _onchange_garden(self): + if self.garden: + self.garden_area = 10 + self.garden_orientation = 'north' + else: + self.garden_area = 0 + self.garden_orientation = '' diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py index 0d27b000eeb..49f9aa2e07e 100644 --- a/estate/models/estate_property_offer.py +++ b/estate/models/estate_property_offer.py @@ -1,15 +1,26 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models +from odoo import fields, models, api +from datetime import date, timedelta class EstatePropertyOffer(models.Model): _name = 'estate.property.offer' _description = 'Estate Property Offer' - price = fields.Float(string='Price') status = fields.Selection(string='Status', copy=False, selection=[('accepted', 'Accepted'), ('refused', 'Refused')]) partner_id = fields.Many2one('res.partner', string='Customer', required=True) property_id = fields.Many2one('estate.property', string='Property', required=True) + validity = fields.Integer(string='Validity (days)', default=7) + date_deadline = fields.Date(string='Deadline', compute='_compute_deadline', inverse='_inverse_deadline') + + @api.depends('validity') + def _compute_deadline(self): + for record in self: + record.date_deadline = (record.create_date if record.create_date else date.today()) + timedelta(days=record.validity) + + def _inverse_deadline(self): + for record in self: + record.validity = (record.date_deadline - (record.create_date.date() if record.create_date else date.today())).days diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index 9deea421839..c78594e1070 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -46,6 +46,7 @@
+ @@ -60,6 +61,7 @@ + @@ -67,6 +69,8 @@ + + @@ -89,9 +93,9 @@ - - - + + + From 898c085478703eb98f3effb72b92437ac540e578 Mon Sep 17 00:00:00 2001 From: tskv Date: Wed, 19 Nov 2025 15:21:58 +0100 Subject: [PATCH 10/29] [IMP] estate: chapter 9 (actions) --- estate/__manifest__.py | 1 - estate/models/estate_property.py | 31 +++++++++++++++++++++++--- estate/models/estate_property_offer.py | 20 +++++++++++++++++ estate/models/estate_property_tag.py | 5 +++++ estate/models/estate_property_type.py | 5 +++++ estate/views/estate_menus.xml | 6 ++--- estate/views/estate_property_views.xml | 7 ++++++ 7 files changed, 68 insertions(+), 7 deletions(-) diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 49887de0548..a9c9f5a15e1 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -9,7 +9,6 @@ """, 'data': [ 'security/ir.model.access.csv', - 'views/estate_property_views.xml', 'views/estate_property_type_views.xml', 'views/estate_property_tag_views.xml', diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 62637107e78..1028f8ee7fa 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -1,7 +1,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models, api -from datetime import timedelta +from odoo import fields, models, api, exceptions class EstateProperty(models.Model): @@ -12,7 +11,7 @@ class EstateProperty(models.Model): active = fields.Boolean('Active', default=True) description = fields.Text('Description') postcode = fields.Char('Postcode') - date_availability = fields.Date('Available From', copy=False, default=fields.Datetime.now() + timedelta(days=90)) + date_availability = fields.Date('Available From', copy=False, default=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) @@ -44,6 +43,16 @@ class EstateProperty(models.Model): total_area = fields.Integer('Total Area (sqm)', compute='_compute_total_area') best_offer = fields.Float('Best Offer', compute='_compute_best_offer') + _check_expected_price = models.Constraint( + 'CHECK(expected_price > 0)', + 'The expected price must be strictly positive', + ) + + _check_selling_price = models.Constraint( + 'CHECK(selling_price >= 0)', + 'The selling price must be positive', + ) + @api.depends('garden_area', 'living_area') def _compute_total_area(self): for record in self: @@ -65,3 +74,19 @@ def _onchange_garden(self): else: self.garden_area = 0 self.garden_orientation = '' + + def property_sold(self): + for record in self: + if record.state != 'cancelled': + record.state = 'sold' + else: + raise exceptions.UserError("Sold properties cannot be cancelled.") + return True + + def property_cancelled(self): + for record in self: + if record.state != 'sold': + record.state = 'cancelled' + else: + raise exceptions.UserError("Cancelled properties cannot be sold.") + return True diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py index 49f9aa2e07e..51583350544 100644 --- a/estate/models/estate_property_offer.py +++ b/estate/models/estate_property_offer.py @@ -16,6 +16,11 @@ class EstatePropertyOffer(models.Model): validity = fields.Integer(string='Validity (days)', default=7) date_deadline = fields.Date(string='Deadline', compute='_compute_deadline', inverse='_inverse_deadline') + _check_price = models.Constraint( + 'CHECK(price > 0)', + 'The offer price must be strictly positive', + ) + @api.depends('validity') def _compute_deadline(self): for record in self: @@ -24,3 +29,18 @@ def _compute_deadline(self): def _inverse_deadline(self): for record in self: record.validity = (record.date_deadline - (record.create_date.date() if record.create_date else date.today())).days + + def action_accept(self): + for record in self: + if record.property_id.state in ('new', 'offer_received'): + record.property_id.state = 'offer_accepted' + record.status = 'accepted' + record.property_id.selling_price = record.price + record.property_id.buyer_id = record.partner_id + return True + + def action_refuse(self): + for record in self: + if not record.status: + record.status = 'refused' + return True diff --git a/estate/models/estate_property_tag.py b/estate/models/estate_property_tag.py index 12586dcd3c3..125c59ac8b7 100644 --- a/estate/models/estate_property_tag.py +++ b/estate/models/estate_property_tag.py @@ -8,3 +8,8 @@ class EstatePropertyTag(models.Model): _description = 'Estate Property Tag' name = fields.Char(string='Property Tag', required=True) + + _tag_name_uniq = models.Constraint( + 'unique(name)', + "The property tag name must be unique", + ) diff --git a/estate/models/estate_property_type.py b/estate/models/estate_property_type.py index c157e02370a..7789de50e06 100644 --- a/estate/models/estate_property_type.py +++ b/estate/models/estate_property_type.py @@ -8,3 +8,8 @@ class EstatePropertyType(models.Model): _description = 'Estate Property Type' name = fields.Char(string='Property Type', required=True) + + _type_name_uniq = models.Constraint( + 'unique(name)', + "The property type name must be unique", + ) diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml index f619f1ce708..18b79afccf6 100644 --- a/estate/views/estate_menus.xml +++ b/estate/views/estate_menus.xml @@ -7,7 +7,7 @@ id="properties_menu" name="Properties" parent="estate_menu_root" - action="estate.estate_property_action" + action="estate_property_action" sequence="1"/> diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index c78594e1070..2ede2aa522e 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -31,6 +31,10 @@ estate.property
+
+

@@ -40,6 +44,7 @@

+ @@ -72,6 +77,8 @@ + +

+ + + + + + + + + + +
@@ -21,6 +40,7 @@ estate.property.type + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index 9c32cae552c..aa0c4255fd1 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -8,11 +8,11 @@ - + - +
-

- +
- - + @@ -64,13 +66,13 @@ - - + + - + @@ -88,7 +90,11 @@ estate.property.view.list estate.property - + @@ -96,7 +102,7 @@ - + @@ -106,6 +112,7 @@ estate.property list,form + {'search_default_filter_available':1} From 220923dc8a8e518ce41dbe4bacafc14807c9154b Mon Sep 17 00:00:00 2001 From: tskv Date: Thu, 20 Nov 2025 15:14:47 +0100 Subject: [PATCH 13/29] [IMP] estate: chapter 12 (inheritance) --- estate/__manifest__.py | 1 + estate/models/__init__.py | 1 + estate/models/estate_property.py | 6 ++++++ estate/models/estate_property_offer.py | 13 ++++++++++++- estate/models/res_users.py | 10 ++++++++++ estate/views/res_users_views.xml | 19 +++++++++++++++++++ 6 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 estate/models/res_users.py create mode 100644 estate/views/res_users_views.xml diff --git a/estate/__manifest__.py b/estate/__manifest__.py index bf69561325a..a8843cea817 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -14,6 +14,7 @@ 'views/estate_property_type_views.xml', 'views/estate_property_tag_views.xml', 'views/estate_menus.xml', + 'views/res_users_views.xml', ], 'demo': [ ], diff --git a/estate/models/__init__.py b/estate/models/__init__.py index 7b28f0f82ad..f7e4cc6f3dd 100644 --- a/estate/models/__init__.py +++ b/estate/models/__init__.py @@ -4,3 +4,4 @@ from . import estate_property_type from . import estate_property_tag from . import estate_property_offer +from . import res_users diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 3048919d048..439b69b8c72 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -83,6 +83,12 @@ def _onchange_garden(self): self.garden_area = 0 self.garden_orientation = '' + @api.ondelete(at_uninstall=False) + def _unlink_check_state(self): + for record in self: + if record.state not in ('new', 'cancelled'): + raise exceptions.UserError("Only new and cancelled properties can be deleted.") + def property_sold(self): for record in self: if record.state != 'cancelled': diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py index 38bfab06491..9507cff2133 100644 --- a/estate/models/estate_property_offer.py +++ b/estate/models/estate_property_offer.py @@ -1,6 +1,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models, api +from odoo import fields, models, api, exceptions from datetime import date, timedelta @@ -23,6 +23,17 @@ class EstatePropertyOffer(models.Model): 'The offer price must be strictly positive', ) + @api.model + def create(self, vals_list): + for vals in vals_list: + if 'property_id' in vals and vals.get('property_id'): + current_property = self.env['estate.property'].browse(vals['property_id']) + if 'price' in vals and current_property.best_offer > vals.get('price', 0): + raise exceptions.ValidationError(f'The offer must be higher than {current_property.best_offer}') + if current_property.state == 'new': + current_property.state = 'offer_received' + return super().create(vals_list) + @api.depends('validity') def _compute_deadline(self): for record in self: diff --git a/estate/models/res_users.py b/estate/models/res_users.py new file mode 100644 index 00000000000..bd1f23c6ac7 --- /dev/null +++ b/estate/models/res_users.py @@ -0,0 +1,10 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class Users(models.Model): + _inherit = 'res.users' + + property_ids = fields.One2many('estate.property', 'salesperson_id', string='Estate Property', + domain=[('date_availability', '<=', fields.Date.today())]) diff --git a/estate/views/res_users_views.xml b/estate/views/res_users_views.xml new file mode 100644 index 00000000000..6dc864c5665 --- /dev/null +++ b/estate/views/res_users_views.xml @@ -0,0 +1,19 @@ + + + + + + res.users.view.form.inherit.real.estate + res.users + + + + + + + + + + + + From b722b3e849fbd81f304f2b9a40a0e6aad8192936 Mon Sep 17 00:00:00 2001 From: tskv Date: Thu, 20 Nov 2025 16:59:38 +0100 Subject: [PATCH 14/29] [ADD] estate: invoicing (chapter 13) --- estate/__manifest__.py | 2 +- estate/models/estate_property.py | 4 +-- estate_account/__init__.py | 3 +++ estate_account/__manifest__.py | 18 ++++++++++++++ estate_account/models/__init__.py | 3 +++ estate_account/models/estate_property.py | 31 ++++++++++++++++++++++++ 6 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 estate_account/__init__.py create mode 100644 estate_account/__manifest__.py create mode 100644 estate_account/models/__init__.py create mode 100644 estate_account/models/estate_property.py diff --git a/estate/__manifest__.py b/estate/__manifest__.py index a8843cea817..e45dd9af1fc 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -3,7 +3,7 @@ 'version': '1.0', 'depends': ['base'], 'author': "taskv", - 'category': 'Category', + 'category': 'Tutorials', 'description': """ Tutorial Project """, diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 439b69b8c72..3bebf34eff7 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -94,7 +94,7 @@ def property_sold(self): if record.state != 'cancelled': record.state = 'sold' else: - raise exceptions.UserError("Sold properties cannot be cancelled.") + raise exceptions.UserError("Cancelled properties cannot be sold.") return True def property_cancelled(self): @@ -102,5 +102,5 @@ def property_cancelled(self): if record.state != 'sold': record.state = 'cancelled' else: - raise exceptions.UserError("Cancelled properties cannot be sold.") + raise exceptions.UserError("Sold properties cannot be cancelled.") return True diff --git a/estate_account/__init__.py b/estate_account/__init__.py new file mode 100644 index 00000000000..d6210b1285d --- /dev/null +++ b/estate_account/__init__.py @@ -0,0 +1,3 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import models diff --git a/estate_account/__manifest__.py b/estate_account/__manifest__.py new file mode 100644 index 00000000000..5d132fb958c --- /dev/null +++ b/estate_account/__manifest__.py @@ -0,0 +1,18 @@ + +{ + 'name': "Real Estate Invoicing", + 'version': '1.0', + 'depends': ['estate', 'account'], + 'author': "taskv", + 'category': 'Tutorials', + 'description': """ + Tutorial Project + """, + 'data': [ + ], + 'demo': [ + ], + 'installable': True, + 'application': True, + 'license': 'LGPL-3', +} diff --git a/estate_account/models/__init__.py b/estate_account/models/__init__.py new file mode 100644 index 00000000000..09b94f90f8d --- /dev/null +++ b/estate_account/models/__init__.py @@ -0,0 +1,3 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import estate_property diff --git a/estate_account/models/estate_property.py b/estate_account/models/estate_property.py new file mode 100644 index 00000000000..1ed1b57fe27 --- /dev/null +++ b/estate_account/models/estate_property.py @@ -0,0 +1,31 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models, Command + + +class EstateProperty(models.Model): + _inherit = 'estate.property' + + def property_sold(self): + invoice_vals_list = [] + for record in self: + if record.state == 'offer_accepted' and record.buyer_id: + invoice_vals = { + 'move_type': 'out_invoice', + 'partner_id': record.buyer_id.id, + 'invoice_line_ids': [ + Command.create({ + "name": "Commission 6%", + "quantity": 1, + "price_unit": record.selling_price * 0.06, + }), + Command.create({ + "name": "Administrative fees", + "quantity": 1, + "price_unit": 100., + }), + ], + } + invoice_vals_list.append(invoice_vals) + self.env['account.move'].sudo().create(invoice_vals_list) + return super().property_sold() From 64e100c442a30c822f447fca001b75e2ce24ca4d Mon Sep 17 00:00:00 2001 From: tskv Date: Fri, 21 Nov 2025 10:01:11 +0100 Subject: [PATCH 15/29] [ADD] estate: kanban view (chapter 14) --- estate/views/estate_property_views.xml | 32 +++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index aa0c4255fd1..e4728228487 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -107,10 +107,40 @@ + + estate.property.view.kanban + estate.property + + + + + +
+ +
+ Expected price: + +
+
+ Best offer: + +
+
+ Selling price: + +
+ +
+
+
+
+
+
+ Estate Property estate.property - list,form + list,form,kanban {'search_default_filter_available':1} From 03cee0d8afacf873b173ff3e2bc3dda553668f6a Mon Sep 17 00:00:00 2001 From: tskv Date: Fri, 21 Nov 2025 10:34:08 +0100 Subject: [PATCH 16/29] [IMP] estate: chapter 15 --- estate/models/estate_property.py | 37 ++++++++++++------------ estate/models/estate_property_offer.py | 36 +++++++++++------------ estate/views/estate_property_views.xml | 4 +-- estate_account/models/estate_property.py | 4 +-- 4 files changed, 41 insertions(+), 40 deletions(-) diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 3bebf34eff7..775621559d7 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -55,12 +55,6 @@ class EstateProperty(models.Model): 'The selling price must be positive', ) - @api.constrains('selling_price', 'expected_price') - def _check_selling_price(self): - for record in self: - if not float_is_zero(record.selling_price, 4) and float_compare(record.selling_price, record.expected_price * 0.9, 4) < 0: - raise exceptions.ValidationError("The selling price must be at least 90% of the expected price.") - @api.depends('garden_area', 'living_area') def _compute_total_area(self): for record in self: @@ -74,6 +68,13 @@ def _compute_best_offer(self): else: record.best_offer = 0 + @api.constrains('selling_price', 'expected_price') + def _check_selling_price(self): + for record in self: + if not float_is_zero(record.selling_price, 4) and float_compare(record.selling_price, + record.expected_price * 0.9, 4) < 0: + raise exceptions.ValidationError("The selling price must be at least 90% of the expected price.") + @api.onchange('garden') def _onchange_garden(self): if self.garden: @@ -89,18 +90,18 @@ def _unlink_check_state(self): if record.state not in ('new', 'cancelled'): raise exceptions.UserError("Only new and cancelled properties can be deleted.") - def property_sold(self): - for record in self: - if record.state != 'cancelled': - record.state = 'sold' - else: - raise exceptions.UserError("Cancelled properties cannot be sold.") + def action_property_sold(self): + self.ensure_one() + if self.state != 'cancelled': + self.state = 'sold' + else: + raise exceptions.UserError("Cancelled properties cannot be sold.") return True - def property_cancelled(self): - for record in self: - if record.state != 'sold': - record.state = 'cancelled' - else: - raise exceptions.UserError("Sold properties cannot be cancelled.") + def action_property_cancelled(self): + self.ensure_one() + if self.state != 'sold': + self.state = 'cancelled' + else: + raise exceptions.UserError("Sold properties cannot be cancelled.") return True diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py index 9507cff2133..7a66c2e72e8 100644 --- a/estate/models/estate_property_offer.py +++ b/estate/models/estate_property_offer.py @@ -23,6 +23,15 @@ class EstatePropertyOffer(models.Model): 'The offer price must be strictly positive', ) + @api.depends('validity') + def _compute_deadline(self): + for record in self: + record.date_deadline = (record.create_date if record.create_date else date.today()) + timedelta(days=record.validity) + + def _inverse_deadline(self): + for record in self: + record.validity = (record.date_deadline - (record.create_date.date() if record.create_date else date.today())).days + @api.model def create(self, vals_list): for vals in vals_list: @@ -34,26 +43,17 @@ def create(self, vals_list): current_property.state = 'offer_received' return super().create(vals_list) - @api.depends('validity') - def _compute_deadline(self): - for record in self: - record.date_deadline = (record.create_date if record.create_date else date.today()) + timedelta(days=record.validity) - - def _inverse_deadline(self): - for record in self: - record.validity = (record.date_deadline - (record.create_date.date() if record.create_date else date.today())).days - def action_accept(self): - for record in self: - if record.property_id.state in ('new', 'offer_received'): - record.property_id.state = 'offer_accepted' - record.status = 'accepted' - record.property_id.selling_price = record.price - record.property_id.buyer_id = record.partner_id + self.ensure_one() + if self.property_id.state in ('new', 'offer_received'): + self.property_id.state = 'offer_accepted' + self.status = 'accepted' + self.property_id.selling_price = self.price + self.property_id.buyer_id = self.partner_id return True def action_refuse(self): - for record in self: - if not record.status: - record.status = 'refused' + self.ensure_one() + if not self.status: + self.status = 'refused' return True diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index e4728228487..54fd0d5f05b 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -32,8 +32,8 @@
-
diff --git a/estate_account/models/estate_property.py b/estate_account/models/estate_property.py index 1ed1b57fe27..6ad9adb496b 100644 --- a/estate_account/models/estate_property.py +++ b/estate_account/models/estate_property.py @@ -6,7 +6,7 @@ class EstateProperty(models.Model): _inherit = 'estate.property' - def property_sold(self): + def action_property_sold(self): invoice_vals_list = [] for record in self: if record.state == 'offer_accepted' and record.buyer_id: @@ -28,4 +28,4 @@ def property_sold(self): } invoice_vals_list.append(invoice_vals) self.env['account.move'].sudo().create(invoice_vals_list) - return super().property_sold() + return super().action_property_sold() From 61dd212bf3814b3d8aaf30ceaa0e8b2d659c32f1 Mon Sep 17 00:00:00 2001 From: tskv Date: Mon, 24 Nov 2025 09:50:19 +0100 Subject: [PATCH 17/29] [ADD] awsome_owl: task 1 + 2 --- awesome_owl/__manifest__.py | 1 + awesome_owl/static/src/counter/counter.js | 14 ++++++++++++++ awesome_owl/static/src/counter/counter.xml | 9 +++++++++ awesome_owl/static/src/playground.js | 10 ++++++++-- awesome_owl/static/src/playground.xml | 6 +++++- 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 awesome_owl/static/src/counter/counter.js create mode 100644 awesome_owl/static/src/counter/counter.xml diff --git a/awesome_owl/__manifest__.py b/awesome_owl/__manifest__.py index e8ac1cda552..82e05404a7e 100644 --- a/awesome_owl/__manifest__.py +++ b/awesome_owl/__manifest__.py @@ -29,6 +29,7 @@ 'assets': { 'awesome_owl.assets_playground': [ ('include', 'web._assets_helpers'), + ('include', 'web._assets_backend_helpers'), 'web/static/src/scss/pre_variables.scss', 'web/static/lib/bootstrap/scss/_variables.scss', ('include', 'web._assets_bootstrap'), diff --git a/awesome_owl/static/src/counter/counter.js b/awesome_owl/static/src/counter/counter.js new file mode 100644 index 00000000000..742b20d898c --- /dev/null +++ b/awesome_owl/static/src/counter/counter.js @@ -0,0 +1,14 @@ +import { useState, Component } from "@odoo/owl"; + +export class Counter extends Component { + static template = "awesome_owl.Counter"; + + setup() { + this.state = useState({ value: 0 }); + } + + increment() { + this.state.value++; + } + +} \ 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..ea985e04b64 --- /dev/null +++ b/awesome_owl/static/src/counter/counter.xml @@ -0,0 +1,9 @@ + + + + +

Counter:

+ +
+ +
\ No newline at end of file diff --git a/awesome_owl/static/src/playground.js b/awesome_owl/static/src/playground.js index 4ac769b0aa5..0ce3436d697 100644 --- a/awesome_owl/static/src/playground.js +++ b/awesome_owl/static/src/playground.js @@ -1,5 +1,11 @@ -import { Component } from "@odoo/owl"; +import { Component, useState } from "@odoo/owl"; +import { Counter } from "./counter/counter" export class Playground extends Component { - static template = "awesome_owl.playground"; + static template = "awesome_owl.Playground"; + static components = {Counter}; + + setup() { + } + } diff --git a/awesome_owl/static/src/playground.xml b/awesome_owl/static/src/playground.xml index 4fb905d59f9..c8bea12faba 100644 --- a/awesome_owl/static/src/playground.xml +++ b/awesome_owl/static/src/playground.xml @@ -1,10 +1,14 @@ - +
hello world
+
+ + +
From 527af1fbeadc8df21741f727f5f4ab38e2249177 Mon Sep 17 00:00:00 2001 From: tskv Date: Mon, 24 Nov 2025 10:10:25 +0100 Subject: [PATCH 18/29] [ADD] awsome_owl: task 3 (card) --- awesome_owl/static/src/card/card.js | 11 +++++++++++ awesome_owl/static/src/card/card.xml | 17 +++++++++++++++++ awesome_owl/static/src/playground.js | 3 ++- awesome_owl/static/src/playground.xml | 4 ++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 awesome_owl/static/src/card/card.js create mode 100644 awesome_owl/static/src/card/card.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..2179a6bc161 --- /dev/null +++ b/awesome_owl/static/src/card/card.js @@ -0,0 +1,11 @@ +import { useState, Component } from "@odoo/owl"; + +export class Card extends Component { + static template = "awesome_owl.Card"; + + static props = { + title : {type: String}, + content : {type: String} + } + +} \ No newline at end of file diff --git a/awesome_owl/static/src/card/card.xml b/awesome_owl/static/src/card/card.xml new file mode 100644 index 00000000000..f6c562566e3 --- /dev/null +++ b/awesome_owl/static/src/card/card.xml @@ -0,0 +1,17 @@ + + + + +
+
+
+ +
+

+ +

+
+
+
+ +
\ No newline at end of file diff --git a/awesome_owl/static/src/playground.js b/awesome_owl/static/src/playground.js index 0ce3436d697..ad6762f0d41 100644 --- a/awesome_owl/static/src/playground.js +++ b/awesome_owl/static/src/playground.js @@ -1,9 +1,10 @@ import { Component, useState } from "@odoo/owl"; import { Counter } from "./counter/counter" +import { Card } from "./card/card"; export class Playground extends Component { static template = "awesome_owl.Playground"; - static components = {Counter}; + static components = { Counter, Card }; setup() { } diff --git a/awesome_owl/static/src/playground.xml b/awesome_owl/static/src/playground.xml index c8bea12faba..bbbac5f68e3 100644 --- a/awesome_owl/static/src/playground.xml +++ b/awesome_owl/static/src/playground.xml @@ -9,6 +9,10 @@ +
+ + +
From fceec125d2892e49892f123e6329128bac8afacf Mon Sep 17 00:00:00 2001 From: tskv Date: Mon, 24 Nov 2025 10:40:48 +0100 Subject: [PATCH 19/29] [IMP] awsome_owl: task 4 (markup) --- awesome_owl/static/src/playground.js | 5 ++++- awesome_owl/static/src/playground.xml | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/awesome_owl/static/src/playground.js b/awesome_owl/static/src/playground.js index ad6762f0d41..bc6d3998c25 100644 --- a/awesome_owl/static/src/playground.js +++ b/awesome_owl/static/src/playground.js @@ -1,4 +1,4 @@ -import { Component, useState } from "@odoo/owl"; +import { Component, useState, markup } from "@odoo/owl"; import { Counter } from "./counter/counter" import { Card } from "./card/card"; @@ -6,6 +6,9 @@ export class Playground extends Component { static template = "awesome_owl.Playground"; static components = { Counter, Card }; + value1 = "
test
"; + value2 = markup("test2"); + setup() { } diff --git a/awesome_owl/static/src/playground.xml b/awesome_owl/static/src/playground.xml index bbbac5f68e3..fc5812fb8a3 100644 --- a/awesome_owl/static/src/playground.xml +++ b/awesome_owl/static/src/playground.xml @@ -10,8 +10,8 @@
- - + +
From 013523366118ec2e41ac0bd2017b84828affcc38 Mon Sep 17 00:00:00 2001 From: tskv Date: Mon, 24 Nov 2025 14:24:38 +0100 Subject: [PATCH 20/29] [IMP] estate: corretions after code review --- awesome_owl/__manifest__.py | 1 + awesome_owl/static/src/counter/counter.js | 6 +++ awesome_owl/static/src/playground.js | 13 ++++-- awesome_owl/static/src/playground.xml | 11 ++++- awesome_owl/static/src/todo_list/todo_item.js | 14 +++++++ .../static/src/todo_list/todo_item.xml | 11 +++++ awesome_owl/static/src/todo_list/todo_list.js | 15 +++++++ .../static/src/todo_list/todo_list.xml | 11 +++++ estate/__init__.py | 2 - estate/__manifest__.py | 2 - estate/models/__init__.py | 6 +-- estate/models/estate_property.py | 40 +++++++++++-------- estate/models/estate_property_offer.py | 17 ++++---- estate/models/estate_property_tag.py | 6 +-- estate/models/estate_property_type.py | 2 - estate/models/res_users.py | 2 - estate/views/estate_property_offer_views.xml | 2 +- estate/views/estate_property_views.xml | 2 +- estate_account/__init__.py | 2 - estate_account/__manifest__.py | 4 -- estate_account/models/__init__.py | 2 - estate_account/models/estate_property.py | 15 +++---- 22 files changed, 120 insertions(+), 66 deletions(-) create mode 100644 awesome_owl/static/src/todo_list/todo_item.js create mode 100644 awesome_owl/static/src/todo_list/todo_item.xml create mode 100644 awesome_owl/static/src/todo_list/todo_list.js create mode 100644 awesome_owl/static/src/todo_list/todo_list.xml diff --git a/awesome_owl/__manifest__.py b/awesome_owl/__manifest__.py index 82e05404a7e..55002ab81de 100644 --- a/awesome_owl/__manifest__.py +++ b/awesome_owl/__manifest__.py @@ -32,6 +32,7 @@ ('include', 'web._assets_backend_helpers'), 'web/static/src/scss/pre_variables.scss', 'web/static/lib/bootstrap/scss/_variables.scss', + 'web/static/lib/bootstrap/scss/_maps.scss', ('include', 'web._assets_bootstrap'), ('include', 'web._assets_core'), 'web/static/src/libs/fontawesome/css/font-awesome.css', diff --git a/awesome_owl/static/src/counter/counter.js b/awesome_owl/static/src/counter/counter.js index 742b20d898c..36aa4c24384 100644 --- a/awesome_owl/static/src/counter/counter.js +++ b/awesome_owl/static/src/counter/counter.js @@ -2,6 +2,9 @@ import { useState, Component } 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 }); @@ -9,6 +12,9 @@ export class Counter extends Component { increment() { this.state.value++; + if (this.props.onChange) { + this.props.onChange(); + } } } \ No newline at end of file diff --git a/awesome_owl/static/src/playground.js b/awesome_owl/static/src/playground.js index bc6d3998c25..af8c760e24c 100644 --- a/awesome_owl/static/src/playground.js +++ b/awesome_owl/static/src/playground.js @@ -1,15 +1,20 @@ import { Component, useState, markup } from "@odoo/owl"; import { Counter } from "./counter/counter" import { Card } from "./card/card"; +import { TodoList } from "./todo_list/todo_list"; export class Playground extends Component { static template = "awesome_owl.Playground"; - static components = { Counter, Card }; - - value1 = "
test
"; - value2 = markup("test2"); + static components = { Counter, Card, TodoList }; setup() { + this.value1 = "
test
"; + this.value2 = markup("test2"); + this.state = useState({ sum : 0 }); + } + + implementSum() { + this.state.sum++; } } diff --git a/awesome_owl/static/src/playground.xml b/awesome_owl/static/src/playground.xml index fc5812fb8a3..2a2b8cc6d27 100644 --- a/awesome_owl/static/src/playground.xml +++ b/awesome_owl/static/src/playground.xml @@ -6,13 +6,20 @@ hello world
- - + +
+
+ The sum is: +
+

+
+ +
diff --git a/awesome_owl/static/src/todo_list/todo_item.js b/awesome_owl/static/src/todo_list/todo_item.js new file mode 100644 index 00000000000..10e06c95848 --- /dev/null +++ b/awesome_owl/static/src/todo_list/todo_item.js @@ -0,0 +1,14 @@ +import { Component, useState } from "@odoo/owl" + +export class TodoItem extends Component { + static template = "awesome_owl.TodoItem"; + static props = { + todo : { + type: Object, + shape: { + id: Number, + description: String, + isCompleted: Boolean } + } + } +} \ No newline at end of file diff --git a/awesome_owl/static/src/todo_list/todo_item.xml b/awesome_owl/static/src/todo_list/todo_item.xml new file mode 100644 index 00000000000..6c3589a187e --- /dev/null +++ b/awesome_owl/static/src/todo_list/todo_item.xml @@ -0,0 +1,11 @@ + + + + +
+

Id:

+

Description:

+
+
+ +
\ No newline at end of file diff --git a/awesome_owl/static/src/todo_list/todo_list.js b/awesome_owl/static/src/todo_list/todo_list.js new file mode 100644 index 00000000000..584ad9a6c5b --- /dev/null +++ b/awesome_owl/static/src/todo_list/todo_list.js @@ -0,0 +1,15 @@ +import { Component, useState } from "@odoo/owl" +import { TodoItem } from "./todo_item" + +export class TodoList extends Component { + static template = "awesome_owl.TodoList"; + static components = { TodoItem }; + + setup() { + this.todos = useState([ + { id:1, description: "buy bread", isCompleted: false }, + { id:2, description: "buy milk", isCompleted: false }, + ]) + } +} + diff --git a/awesome_owl/static/src/todo_list/todo_list.xml b/awesome_owl/static/src/todo_list/todo_list.xml new file mode 100644 index 00000000000..5e691e49c96 --- /dev/null +++ b/awesome_owl/static/src/todo_list/todo_list.xml @@ -0,0 +1,11 @@ + + + + +

Todo List:

+ +

.

+
+
+ +
\ No newline at end of file diff --git a/estate/__init__.py b/estate/__init__.py index d6210b1285d..0650744f6bc 100644 --- a/estate/__init__.py +++ b/estate/__init__.py @@ -1,3 +1 @@ -# 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 index e45dd9af1fc..0eb88f79265 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -16,8 +16,6 @@ 'views/estate_menus.xml', 'views/res_users_views.xml', ], - 'demo': [ - ], 'installable': True, 'application': True, 'license': 'LGPL-3', diff --git a/estate/models/__init__.py b/estate/models/__init__.py index f7e4cc6f3dd..fea9f441d6d 100644 --- a/estate/models/__init__.py +++ b/estate/models/__init__.py @@ -1,7 +1,5 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. - from . import estate_property -from . import estate_property_type -from . import estate_property_tag from . import estate_property_offer +from . import estate_property_tag +from . import estate_property_type from . import res_users diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index 775621559d7..d28108c27d9 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -22,19 +22,28 @@ class EstateProperty(models.Model): 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')] - ) - state = fields.Selection(string='State', - selection=[('new', 'New'), - ('offer_received', 'Offer Received'), - ('offer_accepted', 'Offer Accepted'), - ('sold', 'Sold'), - ('cancelled', 'Cancelled')], - default='new', required=True, copy=False) + garden_orientation = fields.Selection( + string='Garden orientation', + selection=[ + ('north', 'North'), + ('south', 'South'), + ('east', 'East'), + ('west', 'West'), + ], + ) + state = fields.Selection( + string='State', + selection=[ + ('new', 'New'), + ('offer_received', 'Offer Received'), + ('offer_accepted', 'Offer Accepted'), + ('sold', 'Sold'), + ('cancelled', 'Cancelled'), + ], + default='new', + required=True, + copy=False, + ) property_type_id = fields.Many2one('estate.property.type', string='Property Type') property_tag_ids = fields.Many2many('estate.property.tag', string='Property Tag') buyer_id = fields.Many2one('res.partner', string='Buyer', copy=False, @@ -63,10 +72,7 @@ def _compute_total_area(self): @api.depends('offer_ids.price') def _compute_best_offer(self): for record in self: - if record.offer_ids: - record.best_offer = max(record.offer_ids.mapped('price')) - else: - record.best_offer = 0 + record.best_offer = max(record.offer_ids.mapped('price'), default=0.0) @api.constrains('selling_price', 'expected_price') def _check_selling_price(self): diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py index 7a66c2e72e8..9a907c5b895 100644 --- a/estate/models/estate_property_offer.py +++ b/estate/models/estate_property_offer.py @@ -1,6 +1,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models, api, exceptions +from odoo import fields, models, api, exceptions, _ from datetime import date, timedelta @@ -10,8 +10,11 @@ class EstatePropertyOffer(models.Model): _order = "price desc" price = fields.Float(string='Price') - status = fields.Selection(string='Status', copy=False, - selection=[('accepted', 'Accepted'), ('refused', 'Refused')]) + status = fields.Selection( + string='Status', + copy=False, + selection=[('accepted', 'Accepted'), ('refused', 'Refused')] + ) partner_id = fields.Many2one('res.partner', string='Customer', required=True) property_id = fields.Many2one('estate.property', string='Property', required=True) validity = fields.Integer(string='Validity (days)', default=7) @@ -32,13 +35,13 @@ def _inverse_deadline(self): for record in self: record.validity = (record.date_deadline - (record.create_date.date() if record.create_date else date.today())).days - @api.model + @api.model_create_multi def create(self, vals_list): for vals in vals_list: - if 'property_id' in vals and vals.get('property_id'): + if vals.get('property_id'): current_property = self.env['estate.property'].browse(vals['property_id']) - if 'price' in vals and current_property.best_offer > vals.get('price', 0): - raise exceptions.ValidationError(f'The offer must be higher than {current_property.best_offer}') + if current_property.best_offer > vals.get('price', 0): + raise exceptions.ValidationError(_("The offer must be higher than %(best_offer)s", best_offer=current_property.best_offer)) if current_property.state == 'new': current_property.state = 'offer_received' return super().create(vals_list) diff --git a/estate/models/estate_property_tag.py b/estate/models/estate_property_tag.py index 648b9ff7da0..f6ee0c34844 100644 --- a/estate/models/estate_property_tag.py +++ b/estate/models/estate_property_tag.py @@ -1,12 +1,10 @@ -# 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 = 'Estate Property Tag' - _order = "name" + _description = "Estate Property Tag" + _order = 'name' name = fields.Char(string='Property Tag', required=True) color = fields.Integer() diff --git a/estate/models/estate_property_type.py b/estate/models/estate_property_type.py index aef98daa0d2..9f95a4d3f32 100644 --- a/estate/models/estate_property_type.py +++ b/estate/models/estate_property_type.py @@ -1,5 +1,3 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. - from odoo import fields, models, api diff --git a/estate/models/res_users.py b/estate/models/res_users.py index bd1f23c6ac7..adc876d247e 100644 --- a/estate/models/res_users.py +++ b/estate/models/res_users.py @@ -1,5 +1,3 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. - from odoo import fields, models diff --git a/estate/views/estate_property_offer_views.xml b/estate/views/estate_property_offer_views.xml index 61c83bbc7a4..0d2d0f12888 100644 --- a/estate/views/estate_property_offer_views.xml +++ b/estate/views/estate_property_offer_views.xml @@ -43,7 +43,7 @@ Offers estate.property.offer list,form - [('property_type_id','=',active_id)] + [('property_type_id', '=', active_id)] diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index 54fd0d5f05b..ec5abcb52a9 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -142,7 +142,7 @@ estate.property list,form,kanban - {'search_default_filter_available':1} + {'search_default_filter_available': 1} diff --git a/estate_account/__init__.py b/estate_account/__init__.py index d6210b1285d..0650744f6bc 100644 --- a/estate_account/__init__.py +++ b/estate_account/__init__.py @@ -1,3 +1 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. - from . import models diff --git a/estate_account/__manifest__.py b/estate_account/__manifest__.py index 5d132fb958c..7dd0c2c26e4 100644 --- a/estate_account/__manifest__.py +++ b/estate_account/__manifest__.py @@ -8,10 +8,6 @@ 'description': """ Tutorial Project """, - 'data': [ - ], - 'demo': [ - ], 'installable': True, 'application': True, 'license': 'LGPL-3', diff --git a/estate_account/models/__init__.py b/estate_account/models/__init__.py index 09b94f90f8d..5e1963c9d2f 100644 --- a/estate_account/models/__init__.py +++ b/estate_account/models/__init__.py @@ -1,3 +1 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. - from . import estate_property diff --git a/estate_account/models/estate_property.py b/estate_account/models/estate_property.py index 6ad9adb496b..7058428ef5e 100644 --- a/estate_account/models/estate_property.py +++ b/estate_account/models/estate_property.py @@ -1,5 +1,3 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. - from odoo import models, Command @@ -7,17 +5,15 @@ class EstateProperty(models.Model): _inherit = 'estate.property' def action_property_sold(self): - invoice_vals_list = [] - for record in self: - if record.state == 'offer_accepted' and record.buyer_id: - invoice_vals = { + if self.state == 'offer_accepted' and self.buyer_id: + invoice_vals = { 'move_type': 'out_invoice', - 'partner_id': record.buyer_id.id, + 'partner_id': self.buyer_id.id, 'invoice_line_ids': [ Command.create({ "name": "Commission 6%", "quantity": 1, - "price_unit": record.selling_price * 0.06, + "price_unit": self.selling_price * 0.06, }), Command.create({ "name": "Administrative fees", @@ -26,6 +22,5 @@ def action_property_sold(self): }), ], } - invoice_vals_list.append(invoice_vals) - self.env['account.move'].sudo().create(invoice_vals_list) + self.env['account.move'].sudo().create(invoice_vals) return super().action_property_sold() From 09aff263113e2b47df6c52e86294c0d93ca784e9 Mon Sep 17 00:00:00 2001 From: tskv Date: Mon, 24 Nov 2025 15:21:38 +0100 Subject: [PATCH 21/29] [IMP] awesome_owl: task 7 (todo list v1) --- awesome_owl/static/src/todo_list/todo_item.js | 13 ++++++------- awesome_owl/static/src/todo_list/todo_item.xml | 4 ++-- awesome_owl/static/src/todo_list/todo_list.js | 3 ++- awesome_owl/static/src/todo_list/todo_list.xml | 8 +++++--- estate/views/estate_property_views.xml | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/awesome_owl/static/src/todo_list/todo_item.js b/awesome_owl/static/src/todo_list/todo_item.js index 10e06c95848..1a2dcaa7ba9 100644 --- a/awesome_owl/static/src/todo_list/todo_item.js +++ b/awesome_owl/static/src/todo_list/todo_item.js @@ -2,13 +2,12 @@ import { Component, useState } from "@odoo/owl" export class TodoItem extends Component { static template = "awesome_owl.TodoItem"; + static props = { todo : { - type: Object, - shape: { - id: Number, - description: String, - isCompleted: Boolean } - } - } + id: Number, + description: String, + isCompleted: Boolean } + + }; } \ No newline at end of file diff --git a/awesome_owl/static/src/todo_list/todo_item.xml b/awesome_owl/static/src/todo_list/todo_item.xml index 6c3589a187e..93874f71891 100644 --- a/awesome_owl/static/src/todo_list/todo_item.xml +++ b/awesome_owl/static/src/todo_list/todo_item.xml @@ -3,8 +3,8 @@
-

Id:

-

Description:

+ . +
diff --git a/awesome_owl/static/src/todo_list/todo_list.js b/awesome_owl/static/src/todo_list/todo_list.js index 584ad9a6c5b..b75159329a7 100644 --- a/awesome_owl/static/src/todo_list/todo_list.js +++ b/awesome_owl/static/src/todo_list/todo_list.js @@ -9,7 +9,8 @@ export class TodoList extends Component { this.todos = useState([ { id:1, description: "buy bread", isCompleted: false }, { id:2, description: "buy milk", isCompleted: false }, - ]) + { id:3, description: "have lunch", isCompleted: true }, + ]); } } diff --git a/awesome_owl/static/src/todo_list/todo_list.xml b/awesome_owl/static/src/todo_list/todo_list.xml index 5e691e49c96..f9f279719a7 100644 --- a/awesome_owl/static/src/todo_list/todo_list.xml +++ b/awesome_owl/static/src/todo_list/todo_list.xml @@ -2,10 +2,12 @@ +

Todo List:

- -

.

-
+

+ +

+
\ No newline at end of file diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index ec5abcb52a9..9616a293375 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -121,7 +121,7 @@ Expected price: -
+
Best offer:
From 16065f86d12f8e7688aef2e6812ab6749f783574 Mon Sep 17 00:00:00 2001 From: tskv Date: Tue, 25 Nov 2025 09:43:02 +0100 Subject: [PATCH 22/29] [IMP] awesome_owl: tasks 8-12 (todo list) --- awesome_owl/static/src/todo_list/todo_item.js | 12 ++++++-- .../static/src/todo_list/todo_item.xml | 8 ++++-- awesome_owl/static/src/todo_list/todo_list.js | 28 ++++++++++++++++--- .../static/src/todo_list/todo_list.xml | 3 +- 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/awesome_owl/static/src/todo_list/todo_item.js b/awesome_owl/static/src/todo_list/todo_item.js index 1a2dcaa7ba9..1fadc6905e9 100644 --- a/awesome_owl/static/src/todo_list/todo_item.js +++ b/awesome_owl/static/src/todo_list/todo_item.js @@ -7,7 +7,15 @@ export class TodoItem extends Component { todo : { id: Number, description: String, - isCompleted: Boolean } - + isCompleted: Boolean }, + onClick : { Type: Function, optional : true } }; + + toggleState() { + this.props.todo.isCompleted = !this.props.todo.isCompleted; + } + + removeTodo() { + this.props.onClick(this.props.todo.id); + } } \ No newline at end of file diff --git a/awesome_owl/static/src/todo_list/todo_item.xml b/awesome_owl/static/src/todo_list/todo_item.xml index 93874f71891..57dff9e3b43 100644 --- a/awesome_owl/static/src/todo_list/todo_item.xml +++ b/awesome_owl/static/src/todo_list/todo_item.xml @@ -3,8 +3,12 @@
- . - +

+ + . + + +

diff --git a/awesome_owl/static/src/todo_list/todo_list.js b/awesome_owl/static/src/todo_list/todo_list.js index b75159329a7..a94c6bfe747 100644 --- a/awesome_owl/static/src/todo_list/todo_list.js +++ b/awesome_owl/static/src/todo_list/todo_list.js @@ -1,4 +1,4 @@ -import { Component, useState } from "@odoo/owl" +import { Component, useState, useRef } from "@odoo/owl" import { TodoItem } from "./todo_item" export class TodoList extends Component { @@ -7,10 +7,30 @@ export class TodoList extends Component { setup() { this.todos = useState([ - { id:1, description: "buy bread", isCompleted: false }, - { id:2, description: "buy milk", isCompleted: false }, - { id:3, description: "have lunch", isCompleted: true }, + {id: 1, description: "buy bread", isCompleted: false}, + {id: 2, description: "buy milk", isCompleted: false}, + {id: 3, description: "have lunch", isCompleted: true}, ]); + this.todoCounter = this.todos.length; + this.inputRef = useRef("todo_input") + } + + addTodo(ev) { + if (ev.keyCode === 13) { + const input_text = this.inputRef.el.value.trim(); + if (input_text) { + this.todoCounter++; + this.todos.push({id: this.todoCounter, description: input_text, isCompleted: false}); + this.inputRef.el.value = ""; + } + } + } + + removeTodo(id) { + const index = this.todos.findIndex(todo => todo.id === id); + if (index >= 0) { + this.todos.splice(index, 1); + } } } diff --git a/awesome_owl/static/src/todo_list/todo_list.xml b/awesome_owl/static/src/todo_list/todo_list.xml index f9f279719a7..71874e7757d 100644 --- a/awesome_owl/static/src/todo_list/todo_list.xml +++ b/awesome_owl/static/src/todo_list/todo_list.xml @@ -4,8 +4,9 @@

Todo List:

+

- +

From 5f3af82621a9c2668ac52a7f8e50c063fc8e39de Mon Sep 17 00:00:00 2001 From: tskv Date: Tue, 25 Nov 2025 10:14:22 +0100 Subject: [PATCH 23/29] [IMP] awesome_owl: task 13-14 (slots and toggle in cards) --- awesome_owl/static/src/card/card.js | 12 ++++++++++-- awesome_owl/static/src/card/card.xml | 5 +++-- awesome_owl/static/src/playground.js | 2 +- awesome_owl/static/src/playground.xml | 13 +++++++++++-- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/awesome_owl/static/src/card/card.js b/awesome_owl/static/src/card/card.js index 2179a6bc161..085f730b602 100644 --- a/awesome_owl/static/src/card/card.js +++ b/awesome_owl/static/src/card/card.js @@ -4,8 +4,16 @@ export class Card extends Component { static template = "awesome_owl.Card"; static props = { - title : {type: String}, - content : {type: String} + title : { type: String }, + slots : { type: Object, optional: true } + } + + setup() { + this.state = useState({ isOpen: true }) + } + + toggle() { + this.state.isOpen = !this.state.isOpen; } } \ No newline at end of file diff --git a/awesome_owl/static/src/card/card.xml b/awesome_owl/static/src/card/card.xml index f6c562566e3..a1514f6e26d 100644 --- a/awesome_owl/static/src/card/card.xml +++ b/awesome_owl/static/src/card/card.xml @@ -6,9 +6,10 @@
+
-

- +

+

diff --git a/awesome_owl/static/src/playground.js b/awesome_owl/static/src/playground.js index af8c760e24c..ee85129c2ea 100644 --- a/awesome_owl/static/src/playground.js +++ b/awesome_owl/static/src/playground.js @@ -9,7 +9,7 @@ export class Playground extends Component { setup() { this.value1 = "
test
"; - this.value2 = markup("test2"); + this.value2 = markup("test2"); this.state = useState({ sum : 0 }); } diff --git a/awesome_owl/static/src/playground.xml b/awesome_owl/static/src/playground.xml index 2a2b8cc6d27..0d08ceb5606 100644 --- a/awesome_owl/static/src/playground.xml +++ b/awesome_owl/static/src/playground.xml @@ -10,8 +10,17 @@
- - + + + + + + +
+
+ + +
The sum is: From 647c006f7b3cb10f58e489bb0b3d1327fcd25c13 Mon Sep 17 00:00:00 2001 From: tskv Date: Tue, 25 Nov 2025 13:20:34 +0100 Subject: [PATCH 24/29] [ADD] awesome_dashboard: tasks 1-3 --- awesome_dashboard/static/src/dashboard.js | 24 +++++++++++++++++++ awesome_dashboard/static/src/dashboard.scss | 3 +++ awesome_dashboard/static/src/dashboard.xml | 12 +++++++++- .../static/src/dashboard_item.js | 18 ++++++++++++++ .../static/src/dashboard_item.xml | 12 ++++++++++ 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 awesome_dashboard/static/src/dashboard.scss create mode 100644 awesome_dashboard/static/src/dashboard_item.js create mode 100644 awesome_dashboard/static/src/dashboard_item.xml diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js index c4fb245621b..50871269bdc 100644 --- a/awesome_dashboard/static/src/dashboard.js +++ b/awesome_dashboard/static/src/dashboard.js @@ -1,8 +1,32 @@ import { Component } from "@odoo/owl"; import { registry } from "@web/core/registry"; +import { Layout } from "@web/search/layout"; +import { useService } from "@web/core/utils/hooks" +import { _t } from "@web/core/l10n/translation"; +import { DashboardItem } from "./dashboard_item"; class AwesomeDashboard extends Component { static template = "awesome_dashboard.AwesomeDashboard"; + static components = { Layout, DashboardItem }; + + setup() { + this.action = useService("action"); + } + + openCustomers() { + this.action.doAction("base.action_partner_form") + } + + openLeads() { + this.action.doAction({ + type: 'ir.actions.act_window', + name: _t('CRM Leads'), + target: 'current', + res_model: 'crm.lead', + views: [[false, 'list'],[false, 'form']], + }) + } + } registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboard); diff --git a/awesome_dashboard/static/src/dashboard.scss b/awesome_dashboard/static/src/dashboard.scss new file mode 100644 index 00000000000..b62d31952a1 --- /dev/null +++ b/awesome_dashboard/static/src/dashboard.scss @@ -0,0 +1,3 @@ +.o_dashboard { + background-color: slategrey; +} \ No newline at end of file diff --git a/awesome_dashboard/static/src/dashboard.xml b/awesome_dashboard/static/src/dashboard.xml index 1a2ac9a2fed..1e50c635059 100644 --- a/awesome_dashboard/static/src/dashboard.xml +++ b/awesome_dashboard/static/src/dashboard.xml @@ -2,7 +2,17 @@ - hello dashboard + + + + +

content 1

+
+ +

content 2

+
+
+
diff --git a/awesome_dashboard/static/src/dashboard_item.js b/awesome_dashboard/static/src/dashboard_item.js new file mode 100644 index 00000000000..a6ca17abf1e --- /dev/null +++ b/awesome_dashboard/static/src/dashboard_item.js @@ -0,0 +1,18 @@ +import { Component } from "@odoo/owl"; + +export class DashboardItem extends Component { + static template = "awesome_dashboard.DashboardItem"; + static props = { + slots : { + type: Object, + optional: true + }, + size : { + type: Number, + optional: true, + }, + }; + static defaultProps = { + size: 1, + }; +} diff --git a/awesome_dashboard/static/src/dashboard_item.xml b/awesome_dashboard/static/src/dashboard_item.xml new file mode 100644 index 00000000000..ff254a7358c --- /dev/null +++ b/awesome_dashboard/static/src/dashboard_item.xml @@ -0,0 +1,12 @@ + + + + +
+
+ +
+
+
+ +
\ No newline at end of file From 67e8dc28c20e2ed62cbe481a73008ccf8d631a56 Mon Sep 17 00:00:00 2001 From: tskv Date: Tue, 25 Nov 2025 16:43:02 +0100 Subject: [PATCH 25/29] [ADD] estate: master_data and demo_data --- awesome_dashboard/static/src/dashboard.js | 7 +- estate/__manifest__.py | 4 + estate/data/master_data.xml | 28 +++++++ estate/demo/demo_data.xml | 97 +++++++++++++++++++++++ 4 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 estate/data/master_data.xml create mode 100644 estate/demo/demo_data.xml diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js index 50871269bdc..b455b79129e 100644 --- a/awesome_dashboard/static/src/dashboard.js +++ b/awesome_dashboard/static/src/dashboard.js @@ -1,9 +1,10 @@ -import { Component } from "@odoo/owl"; +import { Component, useState, onWillStart } from "@odoo/owl"; import { registry } from "@web/core/registry"; import { Layout } from "@web/search/layout"; import { useService } from "@web/core/utils/hooks" import { _t } from "@web/core/l10n/translation"; import { DashboardItem } from "./dashboard_item"; +import { rpc } from "@web/core/network/rpc"; class AwesomeDashboard extends Component { static template = "awesome_dashboard.AwesomeDashboard"; @@ -11,6 +12,10 @@ class AwesomeDashboard extends Component { setup() { this.action = useService("action"); + onWillStart(async () => { + const result = await rpc("/awesome_dashboard/statistics"); + }) + //this.statistics = useState(useService("awesome_dashboard.statistics")); } openCustomers() { diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 0eb88f79265..29830de4c0c 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -15,6 +15,10 @@ 'views/estate_property_tag_views.xml', 'views/estate_menus.xml', 'views/res_users_views.xml', + 'data/master_data.xml', + ], + 'demo': [ + 'demo/demo_data.xml', ], 'installable': True, 'application': True, diff --git a/estate/data/master_data.xml b/estate/data/master_data.xml new file mode 100644 index 00000000000..2c5ec77e03c --- /dev/null +++ b/estate/data/master_data.xml @@ -0,0 +1,28 @@ + + + + + + John Johnson + False + + + Steve Stevenson + False + + + + + Residential + + + Commercial + + + Industrial + + + Land + + + \ No newline at end of file diff --git a/estate/demo/demo_data.xml b/estate/demo/demo_data.xml new file mode 100644 index 00000000000..0f73c425b2c --- /dev/null +++ b/estate/demo/demo_data.xml @@ -0,0 +1,97 @@ + + + + + + + Big Villa + new + A nice and big villa + + 12345 + + 1600000 + 6 + 100 + 4 + True + True + 100000 + south + + + + Trailer home + cancelled + Home in a trailer park + + 54321 + + 100000 + 120000 + 1 + 10 + 4 + False + + + + Small apartment + offer_received + Cosy apartment + + 54321 + + 100000 + 1 + 40 + 0 + False + + + + + + 10000 + + + 14 + + + + 1500000 + + + 14 + + + + 1500001 + + + 14 + + + + + + + + + + + + + + \ No newline at end of file From ddd9e283d392120d19f92dd639842cd5dd84551f Mon Sep 17 00:00:00 2001 From: tskv Date: Wed, 26 Nov 2025 10:49:44 +0100 Subject: [PATCH 26/29] [ADD] awesome_dashboard: task 4 (statistics) --- awesome_dashboard/static/src/dashboard.js | 19 ++++++----- awesome_dashboard/static/src/dashboard.xml | 34 ++++++++++++++++--- .../static/src/dashboard_item.xml | 9 +++-- 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js index b455b79129e..ad6ff45ad1b 100644 --- a/awesome_dashboard/static/src/dashboard.js +++ b/awesome_dashboard/static/src/dashboard.js @@ -1,10 +1,10 @@ -import { Component, useState, onWillStart } from "@odoo/owl"; -import { registry } from "@web/core/registry"; -import { Layout } from "@web/search/layout"; -import { useService } from "@web/core/utils/hooks" -import { _t } from "@web/core/l10n/translation"; -import { DashboardItem } from "./dashboard_item"; -import { rpc } from "@web/core/network/rpc"; +import {Component, onWillStart, useState} from "@odoo/owl"; +import {registry} from "@web/core/registry"; +import {Layout} from "@web/search/layout"; +import {useService} from "@web/core/utils/hooks" +import {_t} from "@web/core/l10n/translation"; +import {DashboardItem} from "./dashboard_item"; +import {rpc} from "@web/core/network/rpc"; class AwesomeDashboard extends Component { static template = "awesome_dashboard.AwesomeDashboard"; @@ -13,9 +13,10 @@ class AwesomeDashboard extends Component { setup() { this.action = useService("action"); onWillStart(async () => { - const result = await rpc("/awesome_dashboard/statistics"); + const result = await rpc("/awesome_dashboard/statistics", {}); + this.statistics = result + console.log(this.statistics); }) - //this.statistics = useState(useService("awesome_dashboard.statistics")); } openCustomers() { diff --git a/awesome_dashboard/static/src/dashboard.xml b/awesome_dashboard/static/src/dashboard.xml index 1e50c635059..4f349e24d10 100644 --- a/awesome_dashboard/static/src/dashboard.xml +++ b/awesome_dashboard/static/src/dashboard.xml @@ -3,14 +3,38 @@ - - + + + + + + -

content 1

+ + New orders + + + +
- -

content 2

+ + + Total amount + + + + + + + Average time + + + + + + +
diff --git a/awesome_dashboard/static/src/dashboard_item.xml b/awesome_dashboard/static/src/dashboard_item.xml index ff254a7358c..6d68d8e62b0 100644 --- a/awesome_dashboard/static/src/dashboard_item.xml +++ b/awesome_dashboard/static/src/dashboard_item.xml @@ -2,9 +2,12 @@ -
-
- +
+
+ +
+
+
From f233d5c15c9465f796de45ea8a76f98540cba800 Mon Sep 17 00:00:00 2001 From: tskv Date: Wed, 26 Nov 2025 16:07:02 +0100 Subject: [PATCH 27/29] [IMP] awesome_dashboard: task 5 --- awesome_dashboard/static/src/dashboard.js | 14 +++++++------- .../src/{ => dashboard_item}/dashboard_item.js | 0 .../{ => dashboard_item}/dashboard_item.xml | 0 .../static/src/statistics_service.js | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 7 deletions(-) rename awesome_dashboard/static/src/{ => dashboard_item}/dashboard_item.js (100%) rename awesome_dashboard/static/src/{ => dashboard_item}/dashboard_item.xml (100%) create mode 100644 awesome_dashboard/static/src/statistics_service.js diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js index ad6ff45ad1b..4d4f47e958a 100644 --- a/awesome_dashboard/static/src/dashboard.js +++ b/awesome_dashboard/static/src/dashboard.js @@ -3,8 +3,7 @@ import {registry} from "@web/core/registry"; import {Layout} from "@web/search/layout"; import {useService} from "@web/core/utils/hooks" import {_t} from "@web/core/l10n/translation"; -import {DashboardItem} from "./dashboard_item"; -import {rpc} from "@web/core/network/rpc"; +import {DashboardItem} from "./dashboard_item/dashboard_item"; class AwesomeDashboard extends Component { static template = "awesome_dashboard.AwesomeDashboard"; @@ -12,11 +11,12 @@ class AwesomeDashboard extends Component { setup() { this.action = useService("action"); - onWillStart(async () => { - const result = await rpc("/awesome_dashboard/statistics", {}); - this.statistics = result - console.log(this.statistics); - }) + this.statsService = useService("awesome_dashboard.statistics"); + + onWillStart(async () => { + this.statistics = await this.statsService.loadStatistics(); + }); + console.log(this.statistics); } openCustomers() { diff --git a/awesome_dashboard/static/src/dashboard_item.js b/awesome_dashboard/static/src/dashboard_item/dashboard_item.js similarity index 100% rename from awesome_dashboard/static/src/dashboard_item.js rename to awesome_dashboard/static/src/dashboard_item/dashboard_item.js diff --git a/awesome_dashboard/static/src/dashboard_item.xml b/awesome_dashboard/static/src/dashboard_item/dashboard_item.xml similarity index 100% rename from awesome_dashboard/static/src/dashboard_item.xml rename to awesome_dashboard/static/src/dashboard_item/dashboard_item.xml diff --git a/awesome_dashboard/static/src/statistics_service.js b/awesome_dashboard/static/src/statistics_service.js new file mode 100644 index 00000000000..7c838ebcce8 --- /dev/null +++ b/awesome_dashboard/static/src/statistics_service.js @@ -0,0 +1,18 @@ +import { registry } from "@web/core/registry"; +import { rpc } from "@web/core/network/rpc"; +import { memoize } from "@web/core/utils/functions"; +// import { reactive } from "@odoo/owl"; + +const statisticsService = { + + start() { + + const loadStatistics = memoize(async() => { + return await rpc("/awesome_dashboard/statistics", {}); + }); + + return { loadStatistics }; + } +} + +registry.category("services").add("awesome_dashboard.statistics", statisticsService); \ No newline at end of file From 66c4d7bf5e97211b5c7eb6bb329d67dec870ecfa Mon Sep 17 00:00:00 2001 From: tskv Date: Thu, 27 Nov 2025 13:24:25 +0100 Subject: [PATCH 28/29] [IMP] awesome_dashboard: task 6 (pie chart) --- awesome_dashboard/controllers/controllers.py | 1 - awesome_dashboard/static/src/dashboard.js | 5 +- awesome_dashboard/static/src/dashboard.xml | 58 +++++++++++-------- .../src/dashboard_item/dashboard_item.xml | 3 +- .../static/src/pie_chart/pie_chart.js | 32 ++++++++++ .../static/src/pie_chart/pie_chart.xml | 8 +++ 6 files changed, 79 insertions(+), 28 deletions(-) create mode 100644 awesome_dashboard/static/src/pie_chart/pie_chart.js create mode 100644 awesome_dashboard/static/src/pie_chart/pie_chart.xml diff --git a/awesome_dashboard/controllers/controllers.py b/awesome_dashboard/controllers/controllers.py index 56d4a051287..eafba6ffbd0 100644 --- a/awesome_dashboard/controllers/controllers.py +++ b/awesome_dashboard/controllers/controllers.py @@ -33,4 +33,3 @@ def get_statistics(self): }, 'total_amount': random.randint(100, 1000) } - diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js index 4d4f47e958a..8704c0d81a8 100644 --- a/awesome_dashboard/static/src/dashboard.js +++ b/awesome_dashboard/static/src/dashboard.js @@ -4,10 +4,11 @@ import {Layout} from "@web/search/layout"; import {useService} from "@web/core/utils/hooks" import {_t} from "@web/core/l10n/translation"; import {DashboardItem} from "./dashboard_item/dashboard_item"; +import {PieChart} from "./pie_chart/pie_chart"; class AwesomeDashboard extends Component { static template = "awesome_dashboard.AwesomeDashboard"; - static components = { Layout, DashboardItem }; + static components = { Layout, DashboardItem, PieChart }; setup() { this.action = useService("action"); @@ -15,8 +16,8 @@ class AwesomeDashboard extends Component { onWillStart(async () => { this.statistics = await this.statsService.loadStatistics(); + this.stat_data = this.statistics['orders_by_size']; }); - console.log(this.statistics); } openCustomers() { diff --git a/awesome_dashboard/static/src/dashboard.xml b/awesome_dashboard/static/src/dashboard.xml index 4f349e24d10..91c48f88050 100644 --- a/awesome_dashboard/static/src/dashboard.xml +++ b/awesome_dashboard/static/src/dashboard.xml @@ -9,34 +9,44 @@ - - - New orders - - - - - - - - Total amount - - - - - - - - Average time - - - +
+ + + New orders + + + + + + + + + Total amount + + + - + + + + Average time + + + + + - + + + Test PieChart + + + +
+ +
diff --git a/awesome_dashboard/static/src/dashboard_item/dashboard_item.xml b/awesome_dashboard/static/src/dashboard_item/dashboard_item.xml index 6d68d8e62b0..112fda4d588 100644 --- a/awesome_dashboard/static/src/dashboard_item/dashboard_item.xml +++ b/awesome_dashboard/static/src/dashboard_item/dashboard_item.xml @@ -9,7 +9,8 @@
+
- \ No newline at end of file + diff --git a/awesome_dashboard/static/src/pie_chart/pie_chart.js b/awesome_dashboard/static/src/pie_chart/pie_chart.js new file mode 100644 index 00000000000..607d408ea37 --- /dev/null +++ b/awesome_dashboard/static/src/pie_chart/pie_chart.js @@ -0,0 +1,32 @@ +import { Component, onWillStart, useRef, onMounted } from "@odoo/owl"; +import { loadJS } from "@web/core/assets"; + +export class PieChart extends Component { + static template = "awesome_dashboard.PieChart"; + static props = { + pieChartData: Object, + } + + setup() { + this.canva = useRef("canva"); + onWillStart(() => loadJS(["/web/static/lib/Chart/Chart.js"])); + onMounted( () => this.renderChart() ); + } + + renderChart() { + const labels = Object.keys(this.props.pieChartData); + const values = Object.values(this.props.pieChartData); + this.myPieChart = new Chart(this.canva.el, { + type: 'pie', + data: { + labels, + datasets: [ + { + data: values, + } + ] + }, + }) + } + +} diff --git a/awesome_dashboard/static/src/pie_chart/pie_chart.xml b/awesome_dashboard/static/src/pie_chart/pie_chart.xml new file mode 100644 index 00000000000..7b73cb45b7a --- /dev/null +++ b/awesome_dashboard/static/src/pie_chart/pie_chart.xml @@ -0,0 +1,8 @@ + + + + + + + + From cd24f1369504b00b7762f94801e18c6dd9f67e01 Mon Sep 17 00:00:00 2001 From: tskv Date: Thu, 27 Nov 2025 16:40:11 +0100 Subject: [PATCH 29/29] [IMP] awesome_dashboard: task 7 --- awesome_dashboard/static/src/dashboard.js | 8 ++------ awesome_dashboard/static/src/dashboard.xml | 2 +- .../static/src/statistics_service.js | 16 ++++++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js index 8704c0d81a8..07eda57d0aa 100644 --- a/awesome_dashboard/static/src/dashboard.js +++ b/awesome_dashboard/static/src/dashboard.js @@ -12,12 +12,8 @@ class AwesomeDashboard extends Component { setup() { this.action = useService("action"); - this.statsService = useService("awesome_dashboard.statistics"); - - onWillStart(async () => { - this.statistics = await this.statsService.loadStatistics(); - this.stat_data = this.statistics['orders_by_size']; - }); + this.statistics = useState(useService("awesome_dashboard.statistics")); + this.stat_data = this.statistics['orders_by_size']; } openCustomers() { diff --git a/awesome_dashboard/static/src/dashboard.xml b/awesome_dashboard/static/src/dashboard.xml index 91c48f88050..ba15a05c567 100644 --- a/awesome_dashboard/static/src/dashboard.xml +++ b/awesome_dashboard/static/src/dashboard.xml @@ -39,7 +39,7 @@ - Test PieChart + Orders by size diff --git a/awesome_dashboard/static/src/statistics_service.js b/awesome_dashboard/static/src/statistics_service.js index 7c838ebcce8..c4a937bb10a 100644 --- a/awesome_dashboard/static/src/statistics_service.js +++ b/awesome_dashboard/static/src/statistics_service.js @@ -1,17 +1,21 @@ import { registry } from "@web/core/registry"; import { rpc } from "@web/core/network/rpc"; -import { memoize } from "@web/core/utils/functions"; -// import { reactive } from "@odoo/owl"; +import { reactive } from "@odoo/owl"; const statisticsService = { start() { + const statistics = reactive ( { changed: false } ); - const loadStatistics = memoize(async() => { - return await rpc("/awesome_dashboard/statistics", {}); - }); + async function loadStatistics () { + const updates = await rpc("/awesome_dashboard/statistics", {}); + Object.assign(statistics, updates, {changed: true} ); + } - return { loadStatistics }; + setInterval(loadStatistics, 1*60*1000); + loadStatistics(); + + return statistics; } }