From 6f4b6baebfb714da858b96f6b905675e6a73730e Mon Sep 17 00:00:00 2001 From: SurryaT10 Date: Mon, 15 Dec 2025 16:07:13 +0100 Subject: [PATCH 01/10] [ADD] estate: Add initial module structure with property model and manifest. Created 'estate_property' model and fields. --- estate/__init__.py | 1 + estate/__manifest__.py | 27 +++++++++++++++++++++++++++ estate/models/__init__.py | 1 + estate/models/estate.py | 23 +++++++++++++++++++++++ 4 files changed, 52 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.py diff --git a/estate/__init__.py b/estate/__init__.py new file mode 100644 index 00000000000..9a7e03eded3 --- /dev/null +++ b/estate/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/estate/__manifest__.py b/estate/__manifest__.py new file mode 100644 index 00000000000..5ea6247dafd --- /dev/null +++ b/estate/__manifest__.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +{ + 'name': "Estate", + + 'summary': """ + Starting module for "Estate" + """, + + 'description': """ + Starting module for "Estate" + """, + + 'author': "Odoo", + 'website': "https://www.odoo.com", + + # Categories can be used to filter modules in modules listing + # Check https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/data/ir_module_category_data.xml + # for the full list + 'category': 'Tutorials', + 'version': '0.1', + + # any module necessary for this one to work correctly + 'depends': ['base', 'web'], + 'application': True, + 'installable': True, + 'license': 'AGPL-3' +} diff --git a/estate/models/__init__.py b/estate/models/__init__.py new file mode 100644 index 00000000000..912e8d6a61f --- /dev/null +++ b/estate/models/__init__.py @@ -0,0 +1 @@ +from . import estate \ No newline at end of file diff --git a/estate/models/estate.py b/estate/models/estate.py new file mode 100644 index 00000000000..cf4e13990f4 --- /dev/null +++ b/estate/models/estate.py @@ -0,0 +1,23 @@ +from odoo import fields, models + +class Estate(models.Model): + _name = 'estate.property' + _description = 'Estate Property' + + name = fields.Char('Property Name', required=True) + description = fields.Text('Description') + postcode = fields.Char('Postcode') + date_availability = fields.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', default=True) + garden = fields.Boolean('Garden', default=True) + garden_area = fields.Integer('Garden Area') + garden_orientation = fields.Selection( + string='Type', + selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], + required=True) + From c955e4c8ee83643abb5a45026edac1167eb03d7f Mon Sep 17 00:00:00 2001 From: SurryaT10 Date: Tue, 16 Dec 2025 14:57:37 +0100 Subject: [PATCH 02/10] [FIX] Fixed CI test issues --- estate/__init__.py | 2 +- estate/__manifest__.py | 1 - estate/models/__init__.py | 2 +- estate/models/estate.py | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/estate/__init__.py b/estate/__init__.py index 9a7e03eded3..0650744f6bc 100644 --- a/estate/__init__.py +++ b/estate/__init__.py @@ -1 +1 @@ -from . import models \ No newline at end of file +from . import models diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 5ea6247dafd..0cd63f5d032 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- { 'name': "Estate", diff --git a/estate/models/__init__.py b/estate/models/__init__.py index 912e8d6a61f..e4f59229d23 100644 --- a/estate/models/__init__.py +++ b/estate/models/__init__.py @@ -1 +1 @@ -from . import estate \ No newline at end of file +from . import estate diff --git a/estate/models/estate.py b/estate/models/estate.py index cf4e13990f4..a51f3e3dd92 100644 --- a/estate/models/estate.py +++ b/estate/models/estate.py @@ -20,4 +20,3 @@ class Estate(models.Model): string='Type', selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], required=True) - From 70d8adfd6a580daf17ad25bd6b502de23dc74950 Mon Sep 17 00:00:00 2001 From: SurryaT10 Date: Tue, 16 Dec 2025 15:09:56 +0100 Subject: [PATCH 03/10] [Add] Added Estate menu and Properties action for estate.property model Also added access rights for estate.property model --- estate/security/ir.model.access.csv | 2 ++ estate/views/estate_menus.xml | 8 ++++++++ estate/views/estate_property_views.xml | 8 ++++++++ 3 files changed, 18 insertions(+) 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/security/ir.model.access.csv b/estate/security/ir.model.access.csv new file mode 100644 index 00000000000..a77c46fd162 --- /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_model,access_estate_model,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..d2e39b0a8ea --- /dev/null +++ b/estate/views/estate_menus.xml @@ -0,0 +1,8 @@ + + + + + + + + \ 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..3cda53e417f --- /dev/null +++ b/estate/views/estate_property_views.xml @@ -0,0 +1,8 @@ + + + + View Records + estate.property + list,form + + \ No newline at end of file From 6591727a7e57fb7e8c51cef089f13be4ab213f89 Mon Sep 17 00:00:00 2001 From: SurryaT10 Date: Tue, 16 Dec 2025 15:17:30 +0100 Subject: [PATCH 04/10] [FIX] Added missed imports for views and security in manifest file --- estate/__manifest__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 0cd63f5d032..9b3114c5c89 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -20,6 +20,11 @@ # any module necessary for this one to work correctly 'depends': ['base', 'web'], + 'data': [ + 'views/estate_property_views.xml', + 'views/estate_menus.xml', + 'security/ir.model.access.csv', + ], 'application': True, 'installable': True, 'license': 'AGPL-3' From 2e143d9f74d44127dd7ca1b77bf2ccbead5c1532 Mon Sep 17 00:00:00 2001 From: SurryaT10 Date: Wed, 17 Dec 2025 11:25:28 +0100 Subject: [PATCH 05/10] [ADD] Chapter 6: Build Views Added estate_property_views.xml which contains list and form views Added a separate estate_property_search_view.xml for search with filters for active and availability as well as group by based on postcode. Also addressed code review comments. --- estate/__manifest__.py | 13 +---- estate/models/estate.py | 34 +++++++----- estate/views/estate_menus.xml | 2 +- estate/views/estate_property_search_view.xml | 21 +++++++ estate/views/estate_property_views.xml | 58 +++++++++++++++++++- 5 files changed, 100 insertions(+), 28 deletions(-) create mode 100644 estate/views/estate_property_search_view.xml diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 9b3114c5c89..ebb03eef659 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -1,26 +1,15 @@ { 'name': "Estate", - 'summary': """ - Starting module for "Estate" - """, - - 'description': """ - Starting module for "Estate" - """, - 'author': "Odoo", 'website': "https://www.odoo.com", - # Categories can be used to filter modules in modules listing - # Check https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/data/ir_module_category_data.xml - # for the full list 'category': 'Tutorials', 'version': '0.1', - # any module necessary for this one to work correctly 'depends': ['base', 'web'], 'data': [ + 'views/estate_property_search_view.xml', 'views/estate_property_views.xml', 'views/estate_menus.xml', 'security/ir.model.access.csv', diff --git a/estate/models/estate.py b/estate/models/estate.py index a51f3e3dd92..8404be72376 100644 --- a/estate/models/estate.py +++ b/estate/models/estate.py @@ -4,19 +4,25 @@ class Estate(models.Model): _name = 'estate.property' _description = 'Estate Property' - name = fields.Char('Property Name', required=True) - description = fields.Text('Description') - postcode = fields.Char('Postcode') - date_availability = fields.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', default=True) - garden = fields.Boolean('Garden', default=True) - garden_area = fields.Integer('Garden Area') + name = fields.Char("Property Name", required=True) + description = fields.Text("Description") + postcode = fields.Char("Postcode") + date_availability = fields.Date("Available From", 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) + living_area = fields.Integer("Living Area (sqm)") + facades = fields.Integer("Facades") + garage = fields.Boolean("Garage", default=True) + garden = fields.Boolean("Garden", default=True) + garden_area = fields.Integer("Garden Area (sqm)") garden_orientation = fields.Selection( - string='Type', - selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], + string="Garden Orientation", + selection=[('north', "North"), ('south', "South"), ('east', "East"), ('west', "West")], required=True) + status = fields.Selection( + string="Status", + selection=[('new', "New"), ('offer_received', "Offer Received"), ('offer_accepted', "Offer Accepted"), ('sold', "Sold"), ('canceled', "Canceled")], + default='new', + required=True) + active = fields.Boolean("Active", default=True) diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml index d2e39b0a8ea..d42579a45f8 100644 --- a/estate/views/estate_menus.xml +++ b/estate/views/estate_menus.xml @@ -5,4 +5,4 @@ - \ No newline at end of file + diff --git a/estate/views/estate_property_search_view.xml b/estate/views/estate_property_search_view.xml new file mode 100644 index 00000000000..b165ca8c74f --- /dev/null +++ b/estate/views/estate_property_search_view.xml @@ -0,0 +1,21 @@ + + + estate.property.search + estate.property + + + + + + + + + + + + + + + + + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index 3cda53e417f..d184368f78e 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -5,4 +5,60 @@ estate.property list,form - \ No newline at end of file + + + estate.property.tree + estate.property + + + + + + + + + + + + + + + estate.property.form + estate.property + +
+ + +

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ From f11fc504d1c63435327c07d6b4593cc162cdfb83 Mon Sep 17 00:00:00 2001 From: SurryaT10 Date: Thu, 18 Dec 2025 09:45:10 +0100 Subject: [PATCH 06/10] [ADD] Chapter 7: Relations Between Models Added estate.property.type model which specifies the type of property. Eg: House/Apartment Added estate.property.tag model to indicate the tags(cozy, renovated) for each property Added estate.property.offer model which indicates the offers for each property. Also added views for each model mentioned above. --- estate/__manifest__.py | 2 ++ estate/models/__init__.py | 3 +++ estate/models/estate.py | 6 ++++++ estate/models/offer.py | 14 ++++++++++++++ estate/models/property_tag.py | 8 ++++++++ estate/models/property_type.py | 8 ++++++++ estate/security/ir.model.access.csv | 3 +++ estate/views/estate_menus.xml | 4 ++++ estate/views/estate_property_tag_views.xml | 8 ++++++++ estate/views/estate_property_type_views.xml | 8 ++++++++ estate/views/estate_property_views.xml | 19 +++++++++++++++++++ 11 files changed, 83 insertions(+) create mode 100644 estate/models/offer.py create mode 100644 estate/models/property_tag.py create mode 100644 estate/models/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 ebb03eef659..d7bc26e9e7e 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -9,6 +9,8 @@ 'depends': ['base', 'web'], 'data': [ + 'views/estate_property_tag_views.xml', + 'views/estate_property_type_views.xml', 'views/estate_property_search_view.xml', 'views/estate_property_views.xml', 'views/estate_menus.xml', diff --git a/estate/models/__init__.py b/estate/models/__init__.py index e4f59229d23..ef0cd554275 100644 --- a/estate/models/__init__.py +++ b/estate/models/__init__.py @@ -1 +1,4 @@ from . import estate +from . import property_type +from . import property_tag +from . import offer diff --git a/estate/models/estate.py b/estate/models/estate.py index 8404be72376..a1b500860b0 100644 --- a/estate/models/estate.py +++ b/estate/models/estate.py @@ -1,5 +1,6 @@ from odoo import fields, models + class Estate(models.Model): _name = 'estate.property' _description = 'Estate Property' @@ -26,3 +27,8 @@ class Estate(models.Model): default='new', required=True) active = fields.Boolean("Active", default=True) + property_type_id = fields.Many2one('estate.property.type', string="Property Type") + buyer_id = fields.Many2one('res.partner', string="Buyer", copy=False) + salesperson_id = fields.Many2one('res.users', string="Salesperson", default=lambda self: self.env.user) + tag_ids = fields.Many2many('estate.property.tag', string="Tags") + offer_ids = fields.One2many('estate.property.offer', 'property_id', string="Offers") diff --git a/estate/models/offer.py b/estate/models/offer.py new file mode 100644 index 00000000000..ff732079c5e --- /dev/null +++ b/estate/models/offer.py @@ -0,0 +1,14 @@ +from odoo import fields, models + + +class Offer(models.Model): + _name = 'estate.property.offer' + _description = 'Estate Property Offer' + + price = fields.Float("Offer 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) diff --git a/estate/models/property_tag.py b/estate/models/property_tag.py new file mode 100644 index 00000000000..1674b94e13d --- /dev/null +++ b/estate/models/property_tag.py @@ -0,0 +1,8 @@ +from odoo import fields, models + + +class PropertyTag(models.Model): + _name = 'estate.property.tag' + _description = 'Estate Property Tag' + + name = fields.Char("Tag Name", required=True) diff --git a/estate/models/property_type.py b/estate/models/property_type.py new file mode 100644 index 00000000000..99e5923dee6 --- /dev/null +++ b/estate/models/property_type.py @@ -0,0 +1,8 @@ +from odoo import fields, models + + +class PropertyType(models.Model): + _name = 'estate.property.type' + _description = 'Estate Property Type' + + name = fields.Char("Property Type", required=True) diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv index a77c46fd162..839f297bb3c 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_model,access_estate_model,model_estate_property,base.group_user,1,1,1,1 +access_property_type_model,access_property_type_model,model_estate_property_type,base.group_user,1,1,1,1 +access_property_tag_model,access_property_tag_model,model_estate_property_tag,base.group_user,1,1,1,1 +access_property_offer_model,access_property_offer_model,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 d42579a45f8..e0a8ba1b98a 100644 --- a/estate/views/estate_menus.xml +++ b/estate/views/estate_menus.xml @@ -4,5 +4,9 @@ + + + + diff --git a/estate/views/estate_property_tag_views.xml b/estate/views/estate_property_tag_views.xml new file mode 100644 index 00000000000..0ec3dc550e0 --- /dev/null +++ b/estate/views/estate_property_tag_views.xml @@ -0,0 +1,8 @@ + + + + Property Tags + 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..6384061b8ee --- /dev/null +++ b/estate/views/estate_property_type_views.xml @@ -0,0 +1,8 @@ + + + + Property Types + estate.property.type + list,form + + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index d184368f78e..17dc5257bf3 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -33,8 +33,12 @@ + + + + @@ -56,6 +60,21 @@ + + + + + + + + + + + + + + + From f337b3009bafd1405582be8b4e912f4d61ac845b Mon Sep 17 00:00:00 2001 From: Logan Staelens Date: Thu, 18 Dec 2025 10:39:28 +0100 Subject: [PATCH 07/10] DO NOT REMOVE THIS COMMIT --- DO_NOT_REMOVE_THIS.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 DO_NOT_REMOVE_THIS.txt diff --git a/DO_NOT_REMOVE_THIS.txt b/DO_NOT_REMOVE_THIS.txt new file mode 100644 index 00000000000..e69de29bb2d From e5124588c58a27a91c812f66b8fb9ac30a192bc7 Mon Sep 17 00:00:00 2001 From: SurryaT10 Date: Thu, 18 Dec 2025 13:37:57 +0100 Subject: [PATCH 08/10] [IMP] Added computed fields - total_area and best_offer total_area field is based on the size of both garden_area and living_area best_offer field is based on the max price among the list of offers Also added validity and deadline for the offers as a computed and inverse function impacting each other. --- estate/models/estate.py | 23 ++++++++++++++++++++++- estate/models/offer.py | 15 ++++++++++++++- estate/views/estate_property_views.xml | 6 +++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/estate/models/estate.py b/estate/models/estate.py index a1b500860b0..fdfdadc9888 100644 --- a/estate/models/estate.py +++ b/estate/models/estate.py @@ -1,4 +1,4 @@ -from odoo import fields, models +from odoo import api, fields, models class Estate(models.Model): @@ -32,3 +32,24 @@ class Estate(models.Model): salesperson_id = fields.Many2one('res.users', string="Salesperson", default=lambda self: self.env.user) tag_ids = fields.Many2many('estate.property.tag', string="Tags") offer_ids = fields.One2many('estate.property.offer', 'property_id', string="Offers") + 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 record in self: + record.total_area = record.living_area + record.garden_area + + @api.depends('offer_ids.price') + def _compute_best_price(self): + for record in self: + record.best_price = max(record.offer_ids.mapped('price')) + + @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 = False diff --git a/estate/models/offer.py b/estate/models/offer.py index ff732079c5e..e1f3a91bea5 100644 --- a/estate/models/offer.py +++ b/estate/models/offer.py @@ -1,4 +1,4 @@ -from odoo import fields, models +from odoo import api, fields, models class Offer(models.Model): @@ -12,3 +12,16 @@ class Offer(models.Model): copy=False) partner_id = fields.Many2one('res.partner', string="Partner", required=True) property_id = fields.Many2one('estate.property', string="Property", required=True) + validity = fields.Integer('Validity (days)', default=7) + date_deadline = fields.Date("Deadline", compute='_compute_date_deadline', inverse="_inverse_date_deadline") + + @api.depends('validity', 'create_date') + def _compute_date_deadline(self): + for record in self: + create_date = record.create_date if record.create_date else fields.Date.today() + record.date_deadline = fields.Date.add(create_date, days=record.validity) + + def _inverse_date_deadline(self): + for record in self: + create_date = record.create_date if record.create_date else fields.Date.today() + record.validity = (record.date_deadline - create_date.date()).days diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index 17dc5257bf3..160da8de0ca 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -44,6 +44,7 @@ + @@ -58,14 +59,17 @@ + - + + + From 073a19daa7af40274871008cc05bb05cf62358fc Mon Sep 17 00:00:00 2001 From: SurryaT10 Date: Fri, 19 Dec 2025 09:19:28 +0100 Subject: [PATCH 09/10] [IMP] Chapter 9: Ready for Some Action Added Sold and Cancel buttons: When a property is sold it cannot be canceled When a property is canceled it cannot be sold Added offer accept and rejected icon button: When an offer is accepted: 1. The selling price is automatically updated by button actions 2. Status changes to 'Offer Accepted' 3. Rejects all other offers Added an onchange, which updates the status to 'Offer Received' when there is an offer. --- estate/models/estate.py | 23 +++++++++++++++++++- estate/models/offer.py | 20 +++++++++++++++++ estate/views/estate_property_search_view.xml | 1 + estate/views/estate_property_views.xml | 7 ++++++ 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/estate/models/estate.py b/estate/models/estate.py index fdfdadc9888..edd4fb7826a 100644 --- a/estate/models/estate.py +++ b/estate/models/estate.py @@ -1,4 +1,5 @@ from odoo import api, fields, models +from odoo.exceptions import UserError class Estate(models.Model): @@ -43,7 +44,15 @@ def _compute_total_area(self): @api.depends('offer_ids.price') def _compute_best_price(self): for record in self: - record.best_price = max(record.offer_ids.mapped('price')) + record.best_price = max(record.offer_ids.mapped('price')) if record.offer_ids else 0.0 + + @api.onchange('offer_ids') + def _onchange_property_status(self): + for record in self: + if record.status == 'new' and len(record.offer_ids) > 0: + record.status = 'offer_received' + else: + record.status = record.status @api.onchange("garden") def _onchange_garden(self): @@ -53,3 +62,15 @@ def _onchange_garden(self): else: self.garden_area = 0 self.garden_orientation = False + + def action_mark_sold(self): + for record in self: + if record.status == 'canceled': + raise UserError("Canceled properties cannot be sold.") + record.status = 'sold' + + def action_mark_cancel(self): + for record in self: + if record.status == 'sold': + raise UserError("Sold properties cannot be canceled.") + record.status = 'canceled' diff --git a/estate/models/offer.py b/estate/models/offer.py index e1f3a91bea5..be9bb3ec447 100644 --- a/estate/models/offer.py +++ b/estate/models/offer.py @@ -25,3 +25,23 @@ def _inverse_date_deadline(self): for record in self: create_date = record.create_date if record.create_date else fields.Date.today() record.validity = (record.date_deadline - 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 + record.property_id.status = 'offer_accepted' + + # Reject other offers + other_offers = record.property_id.offer_ids.filtered(lambda o: o.id != record.id) + other_offers.action_reject_offer() + + def action_reject_offer(self): + for record in self: + record.status = 'refused' + if record.property_id.status == 'offer_accepted' and record.property_id.buyer_id == record.partner_id: + record.property_id.selling_price = 0.0 + record.property_id.buyer_id = False + record.property_id.status = 'offer_received' + diff --git a/estate/views/estate_property_search_view.xml b/estate/views/estate_property_search_view.xml index b165ca8c74f..c9b909a1460 100644 --- a/estate/views/estate_property_search_view.xml +++ b/estate/views/estate_property_search_view.xml @@ -10,6 +10,7 @@ + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml index 160da8de0ca..49628b0757a 100644 --- a/estate/views/estate_property_views.xml +++ b/estate/views/estate_property_views.xml @@ -27,6 +27,10 @@ estate.property
+
+

@@ -38,6 +42,7 @@ + @@ -69,6 +74,8 @@ +