- hello world
+
+
hello world
+
+
+
+
+
The sum is:
+
+
+ hello
+
+
+
+
+
+
+
-
diff --git a/awesome_owl/static/src/todo/todo_item.js b/awesome_owl/static/src/todo/todo_item.js
new file mode 100644
index 00000000000..0944866982c
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_item.js
@@ -0,0 +1,18 @@
+/** @odoo-module **/
+
+import { Component } from "@odoo/owl";
+
+export class TodoItem extends Component {
+ static props = {
+ todo: Object,
+ toggleState: Function,
+ removeTodo: Function,
+ };
+ toggleTodo(ev) {
+ this.props.toggleState(this.props.todo.id);
+ }
+ deleteTodo() {
+ this.props.removeTodo(this.props.todo.id);
+ }
+}
+TodoItem.template = "awesome_owl.TodoItem";
diff --git a/awesome_owl/static/src/todo/todo_item.xml b/awesome_owl/static/src/todo/todo_item.xml
new file mode 100644
index 00000000000..4cc59f45422
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_item.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+:
+
+
+
+
+
diff --git a/awesome_owl/static/src/todo/todo_list.js b/awesome_owl/static/src/todo/todo_list.js
new file mode 100644
index 00000000000..3160fafbfd5
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_list.js
@@ -0,0 +1,42 @@
+/** @odoo-module **/
+
+import { Component, useState } from "@odoo/owl";
+import { TodoItem } from "./todo_item.js";
+
+let nextId = 0;
+export class TodoList extends Component {
+ static template = "awesome_owl.TodoList";
+ static components = { TodoItem };
+
+ setup() {
+ this.todos = useState([]);
+ this.inputRef = useState({ value: "" });
+ }
+
+ toggleState = (id) => {
+ const todo = this.todos.find((t) => t.id === id);
+ if (todo) {
+ todo.isCompleted = !todo.isCompleted;
+ }
+ };
+ removeTodo = (id) => {
+ const index = this.todos.findIndex((t) => t.id === id);
+ if (index >= 0) {
+ this.todos.splice(index, 1);
+ }
+ };
+ addTodo(ev) {
+ if (ev.keyCode === 13) {
+ const desc = this.inputRef.value.trim();
+ if (!desc) return;
+
+ this.todos.push({
+ id: nextId++,
+ description: desc,
+ isCompleted: false,
+ });
+
+ this.inputRef.value = "";
+ }
+ }
+}
diff --git a/awesome_owl/static/src/todo/todo_list.xml b/awesome_owl/static/src/todo/todo_list.xml
new file mode 100644
index 00000000000..aff8489fa77
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_list.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
My Todo List
+
+
+
+
+
+
+
+
+
diff --git a/awesome_owl/utils.js b/awesome_owl/utils.js
new file mode 100644
index 00000000000..664e9bb3a9e
--- /dev/null
+++ b/awesome_owl/utils.js
@@ -0,0 +1,9 @@
+import { onMounted } from "@odoo/owl";
+
+export function useAutofocus(ref) {
+ onMounted(() => {
+ if (ref.el) {
+ ref.el.focus();
+ }
+ });
+}
diff --git a/estate_account/__init__.py b/estate_account/__init__.py
new file mode 100644
index 00000000000..0650744f6bc
--- /dev/null
+++ b/estate_account/__init__.py
@@ -0,0 +1 @@
+from . import models
diff --git a/estate_account/__manifest__.py b/estate_account/__manifest__.py
new file mode 100644
index 00000000000..8a9983d2198
--- /dev/null
+++ b/estate_account/__manifest__.py
@@ -0,0 +1,9 @@
+{
+ 'name': 'Estate Accounting',
+ 'version': '1.0',
+ 'depends': ['real_estate', 'account'],
+ 'category': 'Real Estate',
+ 'license': 'LGPL-3',
+ 'installable': True,
+ 'application': False,
+}
diff --git a/estate_account/models/__init__.py b/estate_account/models/__init__.py
new file mode 100644
index 00000000000..5e1963c9d2f
--- /dev/null
+++ b/estate_account/models/__init__.py
@@ -0,0 +1 @@
+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..aae8386df01
--- /dev/null
+++ b/estate_account/models/estate_property.py
@@ -0,0 +1,43 @@
+from odoo import Command, models
+from odoo.exceptions import UserError
+
+
+class EstateProperty(models.Model):
+ _inherit = 'estate.property'
+
+ def action_sold(self):
+ res = super().action_sold()
+ self.check_access('write')
+
+ journal = self.env['account.journal'].search([('type', '=', 'sale')], limit=1)
+ if not journal:
+ raise UserError("No sale journal found. Please configure at least one sale journal.")
+
+ for record in self:
+ if not record.buyer_id:
+ raise UserError("Please set a Buyer before generating an invoice.")
+ if not record.selling_price:
+ raise UserError("Please set a Selling Price before generating an invoice.")
+
+ journal = self.env['account.journal'].sudo().search([('type', '=', 'sale')], limit=1)
+ if not journal:
+ raise UserError("No sale journal found. Please configure at least one sale journal.")
+ invoice_vals = {
+ "partner_id": record.buyer_id.id,
+ "move_type": "out_invoice",
+ "journal_id": journal.id,
+ "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)
+ return res
diff --git a/real_estate/__init__.py b/real_estate/__init__.py
new file mode 100644
index 00000000000..0650744f6bc
--- /dev/null
+++ b/real_estate/__init__.py
@@ -0,0 +1 @@
+from . import models
diff --git a/real_estate/__manifest__.py b/real_estate/__manifest__.py
new file mode 100644
index 00000000000..1d8142d4a3d
--- /dev/null
+++ b/real_estate/__manifest__.py
@@ -0,0 +1,30 @@
+{
+ 'name': 'estate',
+ 'version': '1.0.0',
+ 'author': 'rodh',
+ 'summary': 'Manage real estate properties and transactions',
+ 'depends': [
+ 'base',
+ ],
+ 'application': True,
+ 'installable': True,
+ 'license': 'LGPL-3',
+ 'category': 'Real Estate/Brokerage',
+ 'data': [
+ 'security/security.xml',
+ 'security/ir.model.access.csv',
+ 'security/record_rules.xml',
+ 'view/estate_property_views.xml',
+ 'view/estate_property_offer_views.xml',
+ 'view/estate_property_type_views.xml',
+ 'view/estate_property_tag_views.xml',
+ 'view/estate_res_users_view.xml',
+ 'data/estate.property.type.csv',
+ 'view/estate_menu.xml',
+ 'report/estate_property_templates.xml',
+ 'report/estate_property_reports.xml',
+ ],
+ 'demo': [
+ 'demo/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/demo_data.xml b/real_estate/demo/demo_data.xml
new file mode 100644
index 00000000000..a5c7fea920b
--- /dev/null
+++ b/real_estate/demo/demo_data.xml
@@ -0,0 +1,85 @@
+
+
+
+ Big Villa
+ new
+ A nice and big villa
+ a
+ 2020-02-02
+ 16000.0
+ 15900.0
+ 6
+ 100.0
+ 4
+
+
+ 100000.0
+ south
+
+
+
+ Trailer home
+ new
+ Home in a trailer park
+ a
+ 1970-01-01
+ 10000.0
+ 15000.0
+ 2
+ 10.0
+ 4
+
+
+
+
+
+
+ 15800.00
+ 14
+
+
+
+
+
+ 16800.00
+ 14
+
+
+
+
+
+ 17800.00
+ 14
+
+
+
+
+
+
+
+
+
+
+ Modern Apartment
+ a
+ new
+ 900000.0
+ 920000.0
+ 85.0
+ 3
+
+
+
diff --git a/real_estate/models/__init__.py b/real_estate/models/__init__.py
new file mode 100644
index 00000000000..06001dca391
--- /dev/null
+++ b/real_estate/models/__init__.py
@@ -0,0 +1,5 @@
+from . import estate_property
+from . import estate_property_type
+from . import estate_property_tag
+from . import estate_property_offer
+from . import estate_res_users
diff --git a/real_estate/models/estate_property.py b/real_estate/models/estate_property.py
new file mode 100644
index 00000000000..977f4bd65d0
--- /dev/null
+++ b/real_estate/models/estate_property.py
@@ -0,0 +1,113 @@
+from datetime import date, timedelta
+from odoo import api, fields, models
+from odoo.exceptions import UserError, ValidationError
+from odoo.tools.float_utils import float_compare, float_is_zero
+
+
+class EstateProperty(models.Model):
+ _name = "estate.property"
+ _description = "Real Estate Property"
+ _order = "id desc"
+
+ name = fields.Char(default="Unknown", required=True)
+ description = fields.Text(string="Description")
+ postcode = fields.Char(string="Postcode")
+ availability_date = fields.Date(default=lambda self: date.today() + timedelta(days=90), copy=False)
+ expected_price = fields.Float(string="Expected Price", required=True)
+ selling_price = fields.Float(readonly=True, copy=False)
+ _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.')
+]
+ bedrooms = fields.Integer(default=2)
+ living_area = fields.Float(string="Living Area")
+ facades = fields.Integer(string="Facades")
+ garage = fields.Boolean(string="Garage")
+ garden = fields.Boolean(string="Garden")
+ garden_area = fields.Float(string="Garden Area")
+ total_area = fields.Float(string="Total Area", compute="_compute_total_area")
+ garden_orientation = fields.Selection(
+ [
+ ('north', 'North'),
+ ('south', 'South'),
+ ('east', 'East'),
+ ('west', 'West')
+ ],
+ string="Garden Orientation"
+ )
+ active = fields.Boolean(default=False)
+ state = fields.Selection(
+ selection=[
+ ('new', 'New'),
+ ('offer_received', 'Offer Received'),
+ ('offer_accepted', 'Offer Accepted'),
+ ('sold', 'Sold'),
+ ('cancelled', 'Cancelled'),
+ ],
+ required=True,
+ copy=False,
+ default='new'
+ )
+ 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")
+ best_price = fields.Float(string="Best Offer", compute="_compute_best_price")
+ company_id = fields.Many2one(
+ 'res.company',
+ string='Company',
+ default=lambda self: self.env.company
+ )
+
+ @api.constrains('selling_price', 'expected_price')
+ def _check_selling_price(self):
+ for record in self:
+ if (float_is_zero(record.selling_price, precision_digits=2)
+ or record.state not in ['offer_accepted', 'sold']):
+ continue
+ min_acceptable_price = 0.9 * record.expected_price
+ if float_compare(record.selling_price, min_acceptable_price, precision_digits=2) < 0:
+ raise ValidationError("Selling price cannot be lower than 90% of the expected price.")
+
+ @api.depends('living_area', 'garden_area')
+ def _compute_total_area(self):
+ for record in self:
+ record.total_area = (record.living_area or 0.0) + (record.garden_area or 0.0)
+
+ @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
+
+ @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
+
+ def action_cancel(self):
+ for record in self:
+ if record.state == 'sold':
+ raise UserError("Sold properties cannot be cancelled.")
+ record.state = 'cancelled'
+ return True
+
+ def action_sold(self):
+ for record in self:
+ if not any(offer.state == 'accepted' for offer in record.offer_ids):
+ raise UserError("You cannot sell a property without an accepted offer.")
+ if record.state == 'cancelled':
+ raise UserError("Cancelled properties cannot be sold.")
+ record.state = 'sold'
+ return True
+
+ @api.ondelete(at_uninstall=False)
+ def _check_deletion(self):
+ for record in self:
+ if record.state not in ['new', 'cancelled']:
+ raise UserError("You can only delete a property if its state is 'New' or 'Cancelled'.")
diff --git a/real_estate/models/estate_property_offer.py b/real_estate/models/estate_property_offer.py
new file mode 100644
index 00000000000..0dbc4a6c12a
--- /dev/null
+++ b/real_estate/models/estate_property_offer.py
@@ -0,0 +1,72 @@
+from datetime import timedelta
+from odoo import api, fields, models
+from odoo.exceptions import UserError, ValidationError
+
+
+class EstatePropertyOffer(models.Model):
+ _name = "estate.property.offer"
+ _description = "Property Offer"
+ _order = "price desc"
+
+ price = fields.Float(string="Offer Price")
+ state = fields.Selection([
+ ('new', 'New'),
+ ('accepted', 'Accepted'),
+ ('refused', 'Refused')
+ ], string="State", default='new', required=True)
+ _sql_constraints = [
+ ('check_price', 'CHECK(price > 0)', 'The offer price must be strictly positive.'),
+]
+ partner_id = fields.Many2one('res.partner', string="Partner", required=True)
+ property_id = fields.Many2one('estate.property', string="Property", required=True)
+ property_type_id = fields.Many2one(
+ 'estate.property.type',
+ related="property_id.property_type_id",
+ store=True,
+ readonly=True
+ )
+ validity = fields.Integer(default=7)
+ date_deadline = fields.Date(compute="_compute_date_deadline", inverse="_inverse_date_deadline", store=True)
+
+ @api.depends('create_date', 'validity')
+ 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()
+ delta = record.date_deadline - create_date.date()
+ record.validity = delta.days
+
+ def action_accept(self):
+ for offer in self:
+ if offer.property_id.buyer_id:
+ raise UserError("An offer has already been accepted.")
+ offer.state = 'accepted'
+ offer.property_id.write({
+ 'selling_price': offer.price,
+ 'buyer_id': offer.partner_id.id,
+ 'state': 'offer_accepted'
+ })
+ return True
+
+ def action_refuse(self):
+ for offer in self:
+ offer.state = 'refused'
+ return True
+
+ @api.model_create_multi
+ def create(self, vals_list):
+ for vals in vals_list:
+ price = vals.get('price')
+ property_obj = self.env['estate.property'].browse(vals.get('property_id'))
+ existing_offers = property_obj.offer_ids.filtered(lambda o: o.price is not None and price is not None and o.price >= price)
+ if property_obj.state == 'sold':
+ raise UserError("Cannot create offer for a sold property.")
+ if existing_offers:
+ raise ValidationError("You cannot create an offer with a lower or equal price than existing offers.")
+ property_obj.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..6d526f66bbf
--- /dev/null
+++ b/real_estate/models/estate_property_tag.py
@@ -0,0 +1,13 @@
+from odoo import fields, models
+
+
+class EstatePropertyTag(models.Model):
+ _name = "estate.property.tag"
+ _description = "Property Tag"
+ _order = "name"
+
+ name = fields.Char(string="Name", required=True)
+ color = fields.Integer('Color')
+ _sql_constraints = [
+ ('unique_tag_name', 'UNIQUE(name)', 'A property tag name must be unique')
+]
diff --git a/real_estate/models/estate_property_type.py b/real_estate/models/estate_property_type.py
new file mode 100644
index 00000000000..eec16f17f20
--- /dev/null
+++ b/real_estate/models/estate_property_type.py
@@ -0,0 +1,28 @@
+from odoo import api, fields, models
+
+
+class EstatePropertyType(models.Model):
+ _name = 'estate.property.type'
+ _description = 'Property Type'
+ _order = "sequence, name"
+
+ name = fields.Char(required=True)
+ _sql_constraints = [
+ ('unique_property_type', 'UNIQUE(name)', 'A property type name must be unique')
+]
+ property_ids = fields.One2many("estate.property", "property_type_id", string="Properties")
+ sequence = fields.Integer(string="Sequence", default=10)
+ offer_ids = fields.One2many(
+ "estate.property.offer",
+ "property_type_id",
+ string="Offers"
+ )
+ offer_count = fields.Integer(
+ string="Offers Count",
+ compute="_compute_offer_count"
+ )
+
+ @api.depends("offer_ids")
+ def _compute_offer_count(self):
+ for record in self:
+ record.offer_count = len(record.offer_ids)
diff --git a/real_estate/models/estate_res_users.py b/real_estate/models/estate_res_users.py
new file mode 100644
index 00000000000..c376d77a343
--- /dev/null
+++ b/real_estate/models/estate_res_users.py
@@ -0,0 +1,12 @@
+from odoo import fields, models
+
+
+class ResUsers(models.Model):
+ _inherit = 'res.users'
+
+ property_ids = fields.One2many(
+ 'estate.property',
+ 'salesperson_id',
+ string="Properties",
+ domain=[('state', '!=', 'cancelled')]
+ )
diff --git a/real_estate/report/estate_property_reports.xml b/real_estate/report/estate_property_reports.xml
new file mode 100644
index 00000000000..307b2835a50
--- /dev/null
+++ b/real_estate/report/estate_property_reports.xml
@@ -0,0 +1,21 @@
+
+
+
+ Print Offers
+ estate.property
+ qweb-pdf
+ real_estate.report_property_offers
+ real_estate.report_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/report/estate_property_templates.xml b/real_estate/report/estate_property_templates.xml
new file mode 100644
index 00000000000..8e60997bbb6
--- /dev/null
+++ b/real_estate/report/estate_property_templates.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+ Salesman:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Expected Price:
+
+
+
+ Status:
+
+
+
+
+
+ Price |
+ Partner |
+ Validity (days) |
+ Deadline |
+ Status |
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+ No offers available for this property.
+
+
+
+
+
+
+
+
+
+ Salesman:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No properties found :
+
+
+
+
+
+
+
+
+
+
+ Invoice Information:
+
+ invoice has been generated for the customer.
+
+
+
+
+
diff --git a/real_estate/security/ir.model.access.csv b/real_estate/security/ir.model.access.csv
new file mode 100644
index 00000000000..0bc494ff4e5
--- /dev/null
+++ b/real_estate/security/ir.model.access.csv
@@ -0,0 +1,13 @@
+id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
+access_estate_property_user,access_estate_property_user,model_estate_property,base.group_user,1,1,1,1
+access_estate_offer_user,access_estate_offer_user,model_estate_property_offer,base.group_user,1,1,1,1
+
+access_estate_property_manager,access.estate.property.manager,model_estate_property,estate_group_manager,1,1,1,0
+access_estate_type_manager,access.estate.type.manager,model_estate_property_type,estate_group_manager,1,1,1,1
+access_estate_tag_manager,access.estate.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_agent,access.estate.property.agent,model_estate_property,estate_group_user,1,1,1,0
+access_estate_type_agent,access.estate.type.agent,model_estate_property_type,estate_group_user,1,1,0,0
+access_estate_tag_agent,access.estate.tag.agent,model_estate_property_tag,estate_group_user,1,0,0,0
+access_estate_offer_agent,access.estate.offer.agent,model_estate_property_offer,estate_group_user,1,1,1,0
\ No newline at end of file
diff --git a/real_estate/security/record_rules.xml b/real_estate/security/record_rules.xml
new file mode 100644
index 00000000000..bb24a7d1e29
--- /dev/null
+++ b/real_estate/security/record_rules.xml
@@ -0,0 +1,38 @@
+
+
+
+
+ Agent can access own or unassigned properties
+
+
+ [
+ '|', ('salesperson_id', '=', user.id),
+ ('salesperson_id', '=', False)
+ ]
+
+
+
+
+
+
+ Manager can access all properties
+
+
+ [(1, '=', 1)]
+
+
+
+
+
+
+ Multi-company restriction on properties
+
+ [
+ '|', ('company_id', '=', False),
+ ('company_id', 'in', company_ids)
+ ]
+
+
+
+
+
diff --git a/real_estate/security/security.xml b/real_estate/security/security.xml
new file mode 100644
index 00000000000..944cc6f8402
--- /dev/null
+++ b/real_estate/security/security.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ Agent
+
+
+
+ Manager
+
+
+
+
+
diff --git a/real_estate/tests/__init__.py b/real_estate/tests/__init__.py
new file mode 100644
index 00000000000..51377e5c131
--- /dev/null
+++ b/real_estate/tests/__init__.py
@@ -0,0 +1 @@
+from . import test_property_logic
diff --git a/real_estate/tests/test_property_logic.py b/real_estate/tests/test_property_logic.py
new file mode 100644
index 00000000000..e54c9ccc396
--- /dev/null
+++ b/real_estate/tests/test_property_logic.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_sold()
+
+ def test_can_sell_property_with_accepted_offer(self):
+ self.offer.action_accept()
+ self.property.action_sold()
+ self.assertEqual(self.property.selling_price, self.offer.price)
+ self.assertEqual(self.property.buyer_id, 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/view/estate_menu.xml b/real_estate/view/estate_menu.xml
new file mode 100644
index 00000000000..a124f812e3f
--- /dev/null
+++ b/real_estate/view/estate_menu.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/real_estate/view/estate_property_offer_views.xml b/real_estate/view/estate_property_offer_views.xml
new file mode 100644
index 00000000000..f057e7f897c
--- /dev/null
+++ b/real_estate/view/estate_property_offer_views.xml
@@ -0,0 +1,40 @@
+
+
+ Real estate offer
+ estate.property.offer
+ list,form
+ [('property_type_id', '=', active_id)]
+
+
+ estate.property.offer.form
+ estate.property.offer
+
+
+
+
+
+ estate.property.offer.list
+ estate.property.offer
+
+
+
+
+
+
+
+
+
+
diff --git a/real_estate/view/estate_property_tag_views.xml b/real_estate/view/estate_property_tag_views.xml
new file mode 100644
index 00000000000..f38bf1f9621
--- /dev/null
+++ b/real_estate/view/estate_property_tag_views.xml
@@ -0,0 +1,18 @@
+
+
+
+ estate.property.tag.list
+ estate.property.tag
+
+
+
+
+
+
+
+
+ Property Tags
+ estate.property.tag
+ list,form
+
+
diff --git a/real_estate/view/estate_property_type_views.xml b/real_estate/view/estate_property_type_views.xml
new file mode 100644
index 00000000000..c6ba499e251
--- /dev/null
+++ b/real_estate/view/estate_property_type_views.xml
@@ -0,0 +1,49 @@
+
+
+
+
+ Property Types
+ estate.property.type
+ list,form
+
+
+ estate.property.type.form
+ estate.property.type
+
+
+
+
+
+ estate.property.type.tree
+ estate.property.type
+
+
+
+
+
+
+
+
+
diff --git a/real_estate/view/estate_property_views.xml b/real_estate/view/estate_property_views.xml
new file mode 100644
index 00000000000..c7813f98ed5
--- /dev/null
+++ b/real_estate/view/estate_property_views.xml
@@ -0,0 +1,112 @@
+
+
+
+
+ estate.property.list
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.form
+ estate.property
+
+
+
+
+
+ estate.property.search
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Real estate action
+ estate.property
+ list,form
+
+
+
diff --git a/real_estate/view/estate_res_users_view.xml b/real_estate/view/estate_res_users_view.xml
new file mode 100644
index 00000000000..45beff49700
--- /dev/null
+++ b/real_estate/view/estate_res_users_view.xml
@@ -0,0 +1,21 @@
+
+
+ res.users.form.inherit.real.estate
+ res.users
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+