- hello world
+
+
+
+
+
+
Total Sum:
+
+
+
+
+ This paragraph is passed through the default slot.
+
+
+
+
+
+
+
+
-
-
+
\ No newline at end of file
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..80ab3808255
--- /dev/null
+++ b/awesome_owl/static/src/todo_list/todo_item.js
@@ -0,0 +1,16 @@
+import { Component } from "@odoo/owl";
+
+export class TodoItem extends Component {
+ static template = "awesome_owl.todoitem";
+ static props = {
+ todo: Object,
+ toggleState: Function,
+ removeTodo: Function,
+ };
+ onToggle(ev) {
+ this.props.toggleState(this.props.todo.id);
+ }
+ onRemove() {
+ this.props.removeTodo(this.props.todo.id);
+ }
+}
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..89340a9383b
--- /dev/null
+++ b/awesome_owl/static/src/todo_list/todo_item.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ :
+
+
+
+
+
+
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..acdb6597cf0
--- /dev/null
+++ b/awesome_owl/static/src/todo_list/todo_list.js
@@ -0,0 +1,44 @@
+import { Component, useState } from "@odoo/owl";
+import { TodoItem } from "@awesome_owl/todo_list/todo_item";
+import { useAutofocus } from "@awesome_owl/utils";
+
+export class TodoList extends Component {
+ static template = "awesome_owl.todolist";
+ static components = { TodoItem };
+
+ setup() {
+ this.state = useState({
+ newTaskDescription: "",
+ todos: [],
+ nextId: 1,
+ });
+ this.toggleTodo = this.toggleTodo.bind(this);
+ useAutofocus("input");
+ this.removeTodo = this.removeTodo.bind(this);
+ }
+
+ addTodo(ev) {
+ if (ev.keyCode === 13 && this.state.newTaskDescription.trim() !== "") {
+ this.state.todos.push({
+ id: this.state.nextId,
+ description: this.state.newTaskDescription.trim(),
+ isCompleted: false,
+ });
+ this.state.newTaskDescription = "";
+ this.state.nextId += 1;
+ }
+ }
+
+ toggleTodo(id) {
+ const todo = this.state.todos.find((t) => t.id === id);
+ if (todo) {
+ todo.isCompleted = !todo.isCompleted;
+ }
+ }
+ removeTodo(id) {
+ const index = this.state.todos.findIndex((t) => t.id === id);
+ if (index >= 0) {
+ this.state.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
new file mode 100644
index 00000000000..66e204a9371
--- /dev/null
+++ b/awesome_owl/static/src/todo_list/todo_list.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/awesome_owl/static/src/utils.js b/awesome_owl/static/src/utils.js
new file mode 100644
index 00000000000..a9b70206b9f
--- /dev/null
+++ b/awesome_owl/static/src/utils.js
@@ -0,0 +1,8 @@
+import { useRef, onMounted } from "@odoo/owl";
+
+export function useAutofocus(refName) {
+ const ref = useRef(refName);
+ onMounted(() => {
+ ref.el.focus();
+ });
+}
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..e2a45c00076
--- /dev/null
+++ b/estate_account/__manifest__.py
@@ -0,0 +1,10 @@
+{
+ 'name': "Account",
+ 'version': '1.0',
+ 'depends': ['real_estate', 'account'],
+ 'author': "gasa",
+ 'category': 'Category',
+ "license": "LGPL-3",
+ "application": True,
+ "sequence": 1
+}
diff --git a/estate_account/models/__init__.py b/estate_account/models/__init__.py
new file mode 100644
index 00000000000..ee0a6a651de
--- /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_account
diff --git a/estate_account/models/estate_account.py b/estate_account/models/estate_account.py
new file mode 100644
index 00000000000..00a6086fd4d
--- /dev/null
+++ b/estate_account/models/estate_account.py
@@ -0,0 +1,41 @@
+from odoo import models, Command
+from odoo.exceptions import ValidationError
+
+
+class EstateAccount(models.Model):
+ _inherit = 'estate.property'
+
+ def _raise_invoice_data_missing(self):
+ raise ValidationError("Please set a Buyer and Selling Price before generating an invoice.")
+
+ def action_mark_sold(self):
+ self.check_access('write')
+ res = super().action_mark_sold()
+
+ for record in self:
+ if not record.buyer or not record.selling_price:
+ record._raise_invoice_data_missing()
+
+ try:
+ invoice_vals = {
+ "partner_id": record.buyer.id,
+ "move_type": "out_invoice",
+ "invoice_line_ids": [
+ Command.create({
+ "name": "6% Commission",
+ "quantity": 1,
+ "price_unit": 0.06 * record.selling_price,
+ }),
+ Command.create({
+ "name": "Administrative Fees",
+ "quantity": 1,
+ "price_unit": 100.0,
+ }),
+ ]
+ }
+ self.env["account.move"].sudo().create(invoice_vals)
+
+ except Exception: # noqa: BLE001
+ raise ValidationError("An error occurred during invoice generation.")
+
+ return res
diff --git a/real_estate/__init__.py b/real_estate/__init__.py
new file mode 100644
index 00000000000..d6210b1285d
--- /dev/null
+++ b/real_estate/__init__.py
@@ -0,0 +1,3 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import models
diff --git a/real_estate/__manifest__.py b/real_estate/__manifest__.py
new file mode 100644
index 00000000000..aac360c32f0
--- /dev/null
+++ b/real_estate/__manifest__.py
@@ -0,0 +1,27 @@
+{
+ 'name': "estate",
+ 'version': '1.0',
+ 'depends': ['base'],
+ 'author': "gasa",
+ 'category': 'Real Estate/Brokerage',
+ "license": "LGPL-3",
+ "application": True,
+ "sequence": 1,
+ 'data': [
+ 'security/security.xml',
+ 'security/ir.model.access.csv',
+ 'security/estate_property_rules.xml',
+ 'data/estate.property.type.csv',
+ 'views/estate_property_views.xml',
+ 'views/estate_property_offer_views.xml',
+ 'views/estate_property_type_views.xml',
+ 'views/estate_tag_views.xml',
+ 'views/inherited_model.xml',
+ 'views/estate_menus.xml',
+ 'report/estate_property_offers_report_templates.xml',
+ 'report/estate_property_reports.xml'
+ ],
+ "demo": [
+ 'demo/estate_property_demo_data.xml',
+ ]
+}
diff --git a/real_estate/data/estate.property.type.csv b/real_estate/data/estate.property.type.csv
new file mode 100644
index 00000000000..23b45d983a3
--- /dev/null
+++ b/real_estate/data/estate.property.type.csv
@@ -0,0 +1,5 @@
+id,name
+estate_property_type_residential,Residential
+estate_property_type_commercial,Commercial
+estate_property_type_industrial,Industrial
+estate_property_type_land,Land
diff --git a/real_estate/demo/estate_property_demo_data.xml b/real_estate/demo/estate_property_demo_data.xml
new file mode 100644
index 00000000000..69260a1acdc
--- /dev/null
+++ b/real_estate/demo/estate_property_demo_data.xml
@@ -0,0 +1,98 @@
+
+
+
+ Big Villa
+ new
+ A nice and big villa
+ 12345
+ 2025-07-10
+ 97000
+ 97000
+ 6
+ 100
+ 4
+ True
+ True
+ 100
+ south
+
+
+
+
+ Trailer home
+ cancelled
+ Home in a trailer park
+ 54321
+ 2025-07-10
+ 1000
+ 1000
+ 2
+ 100
+ 4
+ True
+ True
+ south
+
+
+
+
+
+
+ 90000
+ 14
+
+
+
+
+
+
+ 1500000
+ 14
+
+
+
+
+
+
+ 1500001
+ 14
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Estate with Inline Offers
+ new
+ 44444
+ 120000
+ 2025-07-15
+ True
+ True
+ 3
+ 95
+
+
+
+
diff --git a/real_estate/models/__init__.py b/real_estate/models/__init__.py
new file mode 100644
index 00000000000..35928a71f7e
--- /dev/null
+++ b/real_estate/models/__init__.py
@@ -0,0 +1,7 @@
+# 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 inherited_model
diff --git a/real_estate/models/estate_property.py b/real_estate/models/estate_property.py
new file mode 100644
index 00000000000..4d84114a2a6
--- /dev/null
+++ b/real_estate/models/estate_property.py
@@ -0,0 +1,139 @@
+from odoo import api, fields, models
+from datetime import date, timedelta
+from odoo.exceptions import UserError
+from odoo.exceptions import ValidationError
+from odoo.tools.float_utils import float_compare, float_is_zero
+
+
+class EstateProperty(models.Model):
+ _name = "estate.property"
+ _description = "Estate Property"
+ _order = "id desc"
+
+ _sql_constraints = [
+ ('check_expected_price_positive', 'CHECK(expected_price > 0)', 'The expected price must be strictly positive.'),
+ ('check_selling_price_positive', 'CHECK(selling_price >= 0)', 'The selling price must be positive.'),
+ ]
+
+ name = fields.Char(required=True, string="Property name")
+ description = fields.Text(string="Description")
+ postcode = fields.Char(string="Postcode")
+ expected_price = fields.Float()
+ bedrooms = fields.Integer(default=2)
+ last_seen = fields.Datetime("Last Seen", default=fields.Date.today)
+ date_availability = fields.Date(default=lambda self: date.today() + timedelta(days=90), copy=False)
+ active = fields.Boolean(default=True)
+ living_area = fields.Integer(string="Living Area")
+ facades = fields.Integer(string="Facades")
+ garage = fields.Boolean(string="Garage")
+ garden = fields.Boolean(string="Garden")
+ garden_area = fields.Integer(string="Garden Area")
+ garden_orientation = fields.Selection(
+ [
+ ('north', 'North'),
+ ('south', 'South'),
+ ('east', 'East'),
+ ('west', 'West')
+ ],
+ string="Garden Orientation"
+ )
+ state = fields.Selection(
+ selection=[
+ ('new', 'New'),
+ ('offer_received', 'Offer Received'),
+ ('offer_accepted', 'Offer Accepted'),
+ ('sold', 'Sold'),
+ ('cancelled', 'Cancelled')
+ ],
+ default='new',
+ required=True,
+ copy=False
+ )
+ property_type = fields.Many2one("estate.property.type", string="Property Type")
+ buyer = fields.Many2one(
+ "res.partner",
+ string="Buyer",
+ copy=False
+ )
+ seller = 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(
+ string="Total Area",
+ compute="_compute_total_area",
+ store=True
+ )
+
+ best_price = fields.Float(
+ string="Best Offer",
+ compute="_compute_best_price"
+ )
+
+ selling_price = fields.Float(copy=False)
+ company_id = fields.Many2one(
+ 'res.company',
+ string='Company',
+ required=True,
+ default=lambda self: self.env.company
+ )
+
+ @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:
+ prices = record.offer_ids.mapped("price")
+ record.best_price = max(prices) if prices else 0.0
+
+ def action_mark_sold(self):
+ for record in self:
+ if not any(offer.status == 'accepted' for offer in record.offer_ids):
+ raise UserError("You cannot sell a property without an accepted offer.")
+ if record.state == 'cancelled':
+ raise UserError("Canceled properties cannot be sold.")
+ record.state = 'sold'
+
+ def action_mark_cancelled(self):
+ for record in self:
+ if record.state == 'sold':
+ raise UserError("Sold properties cannot be canceled.")
+ record.state = 'cancelled'
+
+ @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
+
+ @api.constrains('selling_price', 'expected_price')
+ def _check_selling_price_threshold(self):
+ for record in self:
+ if float_is_zero(record.selling_price, precision_digits=2):
+ continue
+
+ minimum_allowed = record.expected_price * 0.9
+
+ if float_compare(record.selling_price, minimum_allowed, precision_digits=2) < 0:
+ raise ValidationError(
+ ("The selling price cannot be lower than 90%% of the expected price.\n"
+ "Expected Price: %.2f, Selling Price: %.2f (Minimum allowed: %.2f)") %
+ (record.expected_price, record.selling_price, minimum_allowed)
+ )
+
+ @api.ondelete(at_uninstall=False)
+ def _check_property_state_before_delete(self):
+ for record in self:
+ if record.state not in ['new', 'cancelled']:
+ raise UserError("You can only delete properties that are in 'New' or 'Cancelled' state.")
diff --git a/real_estate/models/estate_property_offer.py b/real_estate/models/estate_property_offer.py
new file mode 100644
index 00000000000..0c53b2db5a2
--- /dev/null
+++ b/real_estate/models/estate_property_offer.py
@@ -0,0 +1,85 @@
+from odoo import api, models, fields
+from odoo.exceptions import UserError, ValidationError
+from datetime import timedelta
+
+
+class EstatePropertyOffer(models.Model):
+ _name = "estate.property.offer"
+ _description = "Property Offer"
+ _order = "price desc"
+
+ _sql_constraints = [
+ ('check_offer_price_positive', 'CHECK(price > 0)',
+ 'The offer price must be strictly positive.'),
+ ]
+
+ price = fields.Float()
+ status = fields.Selection([
+ ('accepted', 'Accepted'),
+ ('refused', 'Refused')
+ ],
+ copy=False
+ )
+
+ partner_id = fields.Many2one("res.partner", string="Customer", required=True)
+ property_id = fields.Many2one("estate.property", string="Property", required=True)
+
+ property_type_id = fields.Many2one(
+ related='property_id.property_type',
+ string="Property Type",
+ store=True
+ )
+
+ validity = fields.Integer(default=7)
+ date_deadline = fields.Date(
+ compute="_compute_date_deadline",
+ inverse="_inverse_date_deadline",
+ store=True
+ )
+
+ @api.depends("validity", "create_date")
+ def _compute_date_deadline(self):
+ for record in self:
+ create_date = record.create_date or fields.Datetime.now()
+ record.date_deadline = create_date.date() + timedelta(days=record.validity)
+
+ def _inverse_date_deadline(self):
+ for record in self:
+ create_date = record.create_date or fields.Datetime.now()
+ record.validity = (record.date_deadline - create_date.date()).days
+
+ def action_accept(self):
+ for offer in self:
+ if offer.property_id.state == 'sold':
+ raise UserError("Cannot accept an offer for a sold property.")
+ other_offers = offer.property_id.offer_ids.filtered(lambda o: o.id != offer.id)
+ other_offers.write({'status': 'refused'})
+
+ offer.status = 'accepted'
+ offer.property_id.selling_price = offer.price
+ offer.property_id.buyer = offer.partner_id
+ offer.property_id.state = 'offer_accepted'
+
+ def action_refuse(self):
+ for offer in self:
+ offer.status = 'refused'
+
+ @api.model_create_multi
+ def create(self, vals_list):
+ for vals in vals_list:
+ property_id = vals.get('property_id')
+ amount = vals.get('price')
+ property = self.env['estate.property'].browse(property_id)
+ existing_offers = property.offer_ids.filtered(lambda o: o.price is not None and amount is not None and o.price >= amount)
+
+ if property_id and amount:
+ if property.state == 'sold':
+ raise UserError("Cannot create offer for a sold property.")
+
+ if existing_offers:
+ raise ValidationError("An offer with a higher or equal price already exists.")
+
+ if property.state == 'new':
+ property.state = 'offer_received'
+
+ return super().create(vals_list)
diff --git a/real_estate/models/estate_property_tag.py b/real_estate/models/estate_property_tag.py
new file mode 100644
index 00000000000..711f2f7cd11
--- /dev/null
+++ b/real_estate/models/estate_property_tag.py
@@ -0,0 +1,16 @@
+from odoo import models, fields
+
+
+class EstatePropertyTag(models.Model):
+ _name = "estate.property.tag"
+ _description = "Real Estate Property Tag"
+ _order = "name"
+
+ _sql_constraints = [
+ ('unique_tag_name', 'UNIQUE(name)',
+ 'Tag name must be unique.'),
+ ]
+
+ name = fields.Char(required=True)
+ color = fields.Integer(string="Color")
+ sequence = fields.Integer(string="Sequence", default=10)
diff --git a/real_estate/models/estate_property_type.py b/real_estate/models/estate_property_type.py
new file mode 100644
index 00000000000..7e89767d737
--- /dev/null
+++ b/real_estate/models/estate_property_type.py
@@ -0,0 +1,23 @@
+from odoo import api, models, fields
+
+
+class EstatePropertyType(models.Model):
+ _name = "estate.property.type"
+ _description = "Property Type"
+ _order = "sequence, name"
+
+ _sql_constraints = [
+ ('unique_property_type_name', 'UNIQUE(name)',
+ 'Property type name must be unique.'),
+ ]
+
+ name = fields.Char(required=True)
+ sequence = fields.Integer(string="Sequence", default=10)
+ property_ids = fields.One2many("estate.property", "property_type", string="Properties")
+ offer_ids = fields.One2many('estate.property.offer', 'property_type_id', string="Offers")
+ offer_count = fields.Integer(compute='_compute_offer_count')
+
+ @api.depends('offer_ids')
+ def _compute_offer_count(self):
+ for rec in self:
+ rec.offer_count = len(rec.offer_ids)
diff --git a/real_estate/models/inherited_model.py b/real_estate/models/inherited_model.py
new file mode 100644
index 00000000000..01f6e9433e7
--- /dev/null
+++ b/real_estate/models/inherited_model.py
@@ -0,0 +1,12 @@
+from odoo import fields, models
+
+
+class InheritedModel(models.Model):
+ _inherit = "res.users"
+
+ property_ids = fields.One2many(
+ "estate.property",
+ "seller",
+ string="Properties",
+ domain=[('state', '!=', 'cancelled')]
+ )
diff --git a/real_estate/report/estate_property_offers_report_templates.xml b/real_estate/report/estate_property_offers_report_templates.xml
new file mode 100644
index 00000000000..49067bc0267
--- /dev/null
+++ b/real_estate/report/estate_property_offers_report_templates.xml
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+ Salesman:
+
+
+
+
+
+
+
+
+
+
+
+ No offers have been made yet
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Expected Price:
+
+
+
+ Status:
+
+
+
+
+
+ Price |
+ Partner |
+ Validity (days) |
+ Deadline |
+ State |
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Salesman:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No offers have been made yet
+
+
+
+
+
No properties found
+
+
+
+
+
+
+
+
+
+
+
+ Invoice Information:
This property has been sold.
An
+ invoice has been generated for the customer.
+
+
+
+
+
+
diff --git a/real_estate/report/estate_property_reports.xml b/real_estate/report/estate_property_reports.xml
new file mode 100644
index 00000000000..8654b13bc88
--- /dev/null
+++ b/real_estate/report/estate_property_reports.xml
@@ -0,0 +1,22 @@
+
+
+
+ Print Offers
+ estate.property
+ qweb-pdf
+ real_estate.report_estate_property_offers
+ real_estate.report_estate_property_offers
+ 'Property Offers - %s' % (object.name).replace('/','')
+
+
+
+
+ Print Properties
+ res.users
+ qweb-pdf
+ real_estate.report_salesman_properties
+ real_estate.report_salesman_properties
+ 'Properties - %s' % (object.name).replace('/','')
+
+
+
diff --git a/real_estate/security/estate_property_rules.xml b/real_estate/security/estate_property_rules.xml
new file mode 100644
index 00000000000..3a244109a09
--- /dev/null
+++ b/real_estate/security/estate_property_rules.xml
@@ -0,0 +1,35 @@
+
+
+ Agents: Own or Unassigned Properties Only
+
+
+ [
+ '|',
+ ('seller', '=', user.id),
+ ('seller', '=', False)
+ ]
+
+
+
+
+
+
+ Managers: Full Access to Properties
+
+
+ [(1, '=', 1)]
+
+
+
+
+
+
+ Estate Property Multi-company
+
+ [
+ ('company_id', 'in', company_ids)
+ ]
+
+
+
+
diff --git a/real_estate/security/ir.model.access.csv b/real_estate/security/ir.model.access.csv
new file mode 100644
index 00000000000..81140b8f75e
--- /dev/null
+++ b/real_estate/security/ir.model.access.csv
@@ -0,0 +1,9 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_estate_property_manager,access_estate_property_manager,model_estate_property,estate_group_manager,1,1,1,0
+access_estate_property_type_manager,access_estate_property_type_manager,model_estate_property_type,estate_group_manager,1,1,1,1
+access_estate_property_tag_manager,access_estate_property_tag_manager,model_estate_property_tag,estate_group_manager,1,1,1,1
+access_estate_offer_manager,access_estate_offer_manager,model_estate_property_offer,estate_group_manager,1,1,1,1
+
+access_estate_property_user,access_estate_property_user,model_estate_property,estate_group_user,1,1,1,0
+access_estate_property_type_user,access_estate_property_type_user,model_estate_property_type,estate_group_user,1,0,0,0
+access_estate_property_tag_user,access_estate_property_tag_user,model_estate_property_tag,estate_group_user,1,0,0,0
diff --git a/real_estate/security/security.xml b/real_estate/security/security.xml
new file mode 100644
index 00000000000..4ec7d9a4e01
--- /dev/null
+++ b/real_estate/security/security.xml
@@ -0,0 +1,13 @@
+
+
+
+ Agent
+
+
+
+
+ Manager
+
+
+
+
diff --git a/real_estate/tests/__init__.py b/real_estate/tests/__init__.py
new file mode 100644
index 00000000000..27788f94d44
--- /dev/null
+++ b/real_estate/tests/__init__.py
@@ -0,0 +1 @@
+from . import test_property_offer
diff --git a/real_estate/tests/test_property_offer.py b/real_estate/tests/test_property_offer.py
new file mode 100644
index 00000000000..f88aa223bba
--- /dev/null
+++ b/real_estate/tests/test_property_offer.py
@@ -0,0 +1,67 @@
+from odoo.tests.common import TransactionCase
+from odoo.tests import Form
+from odoo.exceptions import UserError
+from odoo.tests import tagged
+
+
+@tagged('post_install', '-at_install')
+class TestEstatePropertyLogic(TransactionCase):
+ def setUp(self):
+ super().setUp()
+ Property = self.env['estate.property']
+ Offer = self.env['estate.property.offer']
+
+ self.partner = self.env['res.partner'].create({
+ 'name': 'Test Buyer',
+ 'email': 'buyer@example.com'
+ })
+
+ self.property = Property.create({
+ 'name': 'Test Property',
+ 'state': 'new',
+ 'expected_price': 150000,
+ 'garden': True,
+ 'garden_area': 100,
+ 'garden_orientation': 'north',
+ })
+
+ self.offer = Offer.create({
+ 'property_id': self.property.id,
+ 'partner_id': self.partner.id,
+ 'price': 160000,
+ })
+
+ def test_cannot_create_offer_on_sold_property(self):
+ self.property.state = 'sold'
+ with self.assertRaises(UserError):
+ self.env['estate.property.offer'].create({
+ 'property_id': self.property.id,
+ 'partner_id': self.partner.id,
+ 'price': 170000
+ })
+
+ def test_cannot_sell_property_without_accepted_offer(self):
+ self.property.offer_ids.unlink()
+ with self.assertRaises(UserError):
+ self.property.action_mark_sold()
+
+ def test_can_sell_property_with_accepted_offer(self):
+ self.offer.action_accept()
+ self.property.action_mark_sold()
+ self.assertEqual(self.property.selling_price, self.offer.price)
+ self.assertEqual(self.property.buyer, self.partner)
+
+ def test_reset_garden_fields_when_unchecked(self):
+ form = Form(self.env['estate.property'])
+ form.name = 'Garden Test'
+ form.garden = True
+ form.expected_price = 15000
+ form.garden_area = 50
+ form.garden_orientation = 'east'
+ prop = form.save()
+
+ prop.garden = False
+ prop._onchange_garden()
+
+ self.assertEqual(prop.garden_area, 0)
+ self.assertFalse(prop.garden_orientation)
diff --git a/real_estate/views/estate_menus.xml b/real_estate/views/estate_menus.xml
new file mode 100644
index 00000000000..3ec765e4dc4
--- /dev/null
+++ b/real_estate/views/estate_menus.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/real_estate/views/estate_property_offer_views.xml b/real_estate/views/estate_property_offer_views.xml
new file mode 100644
index 00000000000..d19cb776387
--- /dev/null
+++ b/real_estate/views/estate_property_offer_views.xml
@@ -0,0 +1,38 @@
+
+
+ estate.property.offer.list
+ estate.property.offer
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.offer.form
+ estate.property.offer
+
+
+
+
+
+ Offers
+ estate.property.offer
+ list,form
+ [('property_type_id', '=', active_id)]
+
+
diff --git a/real_estate/views/estate_property_type_views.xml b/real_estate/views/estate_property_type_views.xml
new file mode 100644
index 00000000000..5dc67dd130b
--- /dev/null
+++ b/real_estate/views/estate_property_type_views.xml
@@ -0,0 +1,43 @@
+
+
+ estate.property.type.form
+ estate.property.type
+
+
+
+
+
+
+ Property Types
+ estate.property.type
+ list,form
+
+
+
diff --git a/real_estate/views/estate_property_views.xml b/real_estate/views/estate_property_views.xml
new file mode 100644
index 00000000000..f82b902a401
--- /dev/null
+++ b/real_estate/views/estate_property_views.xml
@@ -0,0 +1,147 @@
+
+
+
+ estate.property.form
+ estate.property
+
+
+
+
+
+
+ estate.property.lists
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.tree
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Real Estate
+ estate.property
+ list,form
+ {'search_default_filter_available': 1}
+
+
diff --git a/real_estate/views/estate_tag_views.xml b/real_estate/views/estate_tag_views.xml
new file mode 100644
index 00000000000..adf910e095a
--- /dev/null
+++ b/real_estate/views/estate_tag_views.xml
@@ -0,0 +1,21 @@
+
+
+
+ estate.property.tag.list
+ estate.property.tag
+
+
+
+
+
+
+
+
+
+
+ Property Tags
+ estate.property.tag
+ list,form
+
+
+
diff --git a/real_estate/views/inherited_model.xml b/real_estate/views/inherited_model.xml
new file mode 100644
index 00000000000..45e7ed817cb
--- /dev/null
+++ b/real_estate/views/inherited_model.xml
@@ -0,0 +1,21 @@
+
+
+
+ res.users.form.inherit.property
+ res.users
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+