- hello world
+ Hello World
+
+
+
+ content of card 1
+
+
+
+
+
+
-
diff --git a/awesome_owl/static/src/todo_item/todo_item.js b/awesome_owl/static/src/todo_item/todo_item.js
new file mode 100644
index 00000000000..305365ff491
--- /dev/null
+++ b/awesome_owl/static/src/todo_item/todo_item.js
@@ -0,0 +1,21 @@
+import { Component } 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 }
+ },
+ toggleState: Function,
+ removeTodo: Function,
+ };
+
+ onChange() {
+ this.props.toggleState(this.props.todo.id);
+ }
+
+ onRemove() {
+ this.props.removeTodo(this.props.todo.id);
+ }
+}
\ No newline at end of file
diff --git a/awesome_owl/static/src/todo_item/todo_item.xml b/awesome_owl/static/src/todo_item/todo_item.xml
new file mode 100644
index 00000000000..ab21b5eb865
--- /dev/null
+++ b/awesome_owl/static/src/todo_item/todo_item.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ 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..e43f34baa22
--- /dev/null
+++ b/awesome_owl/static/src/todo_list/todo_list.js
@@ -0,0 +1,41 @@
+import { Component, useState } from "@odoo/owl";
+import { TodoItem } from "../todo_item/todo_item";
+import { useAutofocus } from "../utils";
+
+
+export class TodoList extends Component {
+ static template = "awesome_owl.TodoList";
+ static components = { TodoItem };
+
+ setup() {
+ this.nextId = 0;
+ this.todos = useState([]);
+ useAutofocus("input")
+ }
+
+ addTodo(ev) {
+ if (ev.keyCode === 13 && ev.target.value != "") {
+ this.todos.push({
+ id: this.nextId++,
+ description: ev.target.value,
+ isCompleted: false
+ });
+ ev.target.value = "";
+ }
+ }
+
+ toggleTodo(todoId) {
+ const todo = this.todos.find((todo) => todo.id === todoId);
+ if (todo) {
+ todo.isCompleted = !todo.isCompleted;
+ }
+ }
+
+ removeTodo(todoId) {
+ const todoIndex = this.todos.findIndex((todo) => todo.id === todoId);
+ if (todoIndex >= 0) {
+ this.todos.splice(todoIndex, 1);
+ }
+ }
+
+}
\ No newline at end of file
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..da712437054
--- /dev/null
+++ b/awesome_owl/static/src/todo_list/todo_list.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/awesome_owl/static/src/utils.js b/awesome_owl/static/src/utils.js
new file mode 100644
index 00000000000..6a5475b357e
--- /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();
+ });
+}
\ No newline at end of file
diff --git a/estate/__init__.py b/estate/__init__.py
new file mode 100644
index 00000000000..0650744f6bc
--- /dev/null
+++ b/estate/__init__.py
@@ -0,0 +1 @@
+from . import models
diff --git a/estate/__manifest__.py b/estate/__manifest__.py
new file mode 100644
index 00000000000..96351812b24
--- /dev/null
+++ b/estate/__manifest__.py
@@ -0,0 +1,23 @@
+{
+ 'name': "estate",
+ 'version': '1.0',
+ 'category': 'Sales/RealEstate',
+ 'summary': 'Track and deal with real estate properties.',
+ 'author': "Odoo S.A.",
+ 'description': """
+ Description text
+ """,
+ 'depends': ['base'],
+ 'installable': True,
+ 'application': True,
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'views/estate_property_views.xml',
+ 'views/estate_property_offer_views.xml',
+ 'views/estate_property_type_views.xml',
+ 'views/estate_property_tag_views.xml',
+ 'views/res_users_views.xml',
+ 'views/estate_menus.xml',
+ ],
+ 'license': 'LGPL-3',
+}
diff --git a/estate/models/__init__.py b/estate/models/__init__.py
new file mode 100644
index 00000000000..3a6159510bf
--- /dev/null
+++ b/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 (res_users)
diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py
new file mode 100644
index 00000000000..6b643f4488a
--- /dev/null
+++ b/estate/models/estate_property.py
@@ -0,0 +1,131 @@
+from odoo import _, api, exceptions, fields, models
+from odoo.tools.date_utils import add
+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_strictly_positive', 'CHECK(expected_price > 0)',
+ 'The expected price of a property should be strictly positive.'),
+ ('check_selling_price_positive', 'CHECK(selling_price >= 0)',
+ 'The selling price of a property should be positive or zero.'),
+ ]
+
+ name = fields.Char("Title", required=True)
+ description = fields.Text()
+ postcode = fields.Char()
+ date_availability = fields.Date("Available From", copy=False,
+ default=lambda _: add(fields.Date.today(), months=3))
+ expected_price = fields.Float(required=True)
+ selling_price = fields.Float(readonly=True, copy=False)
+ bedrooms = fields.Integer(default=2)
+ living_area = fields.Integer("Living Area (sqm)")
+ facades = fields.Integer()
+ garage = fields.Boolean()
+ garden = fields.Boolean()
+ garden_area = fields.Integer("Garden Area (sqm)")
+ garden_orientation = fields.Selection(
+ selection=[('north', 'North'),
+ ('south', 'South'),
+ ('east', 'East'),
+ ('west', 'West')],
+ help="Orientation of the garden, if it exists.",
+ )
+ active = fields.Boolean(default=True)
+ state = fields.Selection(
+ string="Status",
+ selection=[('new', 'New'),
+ ('offer_received', 'Offer Received'),
+ ('offer_accepted', 'Offer Accepted'),
+ ('sold', 'Sold'),
+ ('cancelled', 'Cancelled')],
+ default='new',
+ help="State of the property.",
+ copy=False,
+ required=True,
+ )
+ property_type_id = fields.Many2one(
+ comodel_name='estate.property.type',
+ help="Type of the property.",
+ )
+ buyer_id = fields.Many2one(
+ comodel_name='res.partner',
+ copy=False,
+ help="Buyer of the property.",
+ )
+ salesperson_id = fields.Many2one(
+ comodel_name='res.users',
+ default=lambda self: self.env.user,
+ help="Salesperson responsible for the property.",
+ )
+ tag_ids = fields.Many2many(
+ string="Tags",
+ comodel_name='estate.property.tag',
+ help="Tags associated with the property.",
+ )
+ offer_ids = fields.One2many(
+ string="Offers",
+ comodel_name='estate.property.offer',
+ inverse_name='property_id',
+ help="Offers made on the property.",
+ )
+ total_area = fields.Integer(
+ string="Total Area (sqm)",
+ compute='_compute_total_area',
+ help="Total area of the property, including living area and garden area.",
+ )
+ best_offer = fields.Float(
+ compute='_compute_best_offer',
+ help="Best offer made on the property.",
+ )
+
+ @api.depends('living_area', 'garden_area')
+ def _compute_total_area(self):
+ for property in self:
+ property.total_area = property.living_area + property.garden_area
+
+ @api.depends('offer_ids.price')
+ def _compute_best_offer(self):
+ for property in self:
+ property.best_offer = max(property.offer_ids.mapped('price'), default=0.0)
+
+ @api.constrains('expected_price', 'selling_price')
+ def _check_prices(self):
+ for property in self:
+ if (
+ not float_is_zero(property.selling_price, precision_rounding=0.01)
+ and float_compare(property.selling_price,
+ 0.9 * property.expected_price, precision_rounding=0.01) < 0):
+ raise exceptions.ValidationError(_("The selling price cannot be lower than 90% of the expected price."))
+
+ @api.onchange('garden')
+ def _onchange_garden(self):
+ if not self.garden:
+ self.garden_area = 0
+ self.garden_orientation = False
+ else:
+ self.garden_area = 10
+ self.garden_orientation = 'north'
+
+ @api.ondelete(at_uninstall=False)
+ def _delete_except_new_cancelled(self):
+ for property in self:
+ if property.state not in ['new', 'cancelled']:
+ raise exceptions.UserError(_("You can only delete properties that are new or cancelled."))
+
+ def action_sold(self):
+ for property in self:
+ if property.state != 'offer_accepted':
+ raise exceptions.UserError(_("Only properties with an accepted offer can be sold."))
+ property.state = 'sold'
+ return True
+
+ def action_cancel(self):
+ for property in self:
+ if property.state == 'sold':
+ raise exceptions.UserError(_("Sold properties cannot be cancelled."))
+ property.state = 'cancelled'
+ return True
diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py
new file mode 100644
index 00000000000..0a4fa0c2d32
--- /dev/null
+++ b/estate/models/estate_property_offer.py
@@ -0,0 +1,93 @@
+from odoo import _, api, exceptions, fields, models
+from odoo.tools.date_utils import add
+
+
+class EstatePropertyOffer(models.Model):
+ _name = 'estate.property.offer'
+ _description = 'Estate Property Offer'
+ _order = 'price desc'
+ _sql_constraints = [
+ ('check_price_strictly_positive', 'CHECK(price > 0)',
+ 'The price of an offer should be strictly positive.'),
+ ]
+
+ price = fields.Float()
+ status = fields.Selection(
+ selection=[
+ ('accepted', 'Accepted'),
+ ('refused', 'Refused'),
+ ],
+ copy=False,
+ help="Status of the offer.",
+ )
+ partner_id = fields.Many2one(
+ comodel_name='res.partner',
+ required=True,
+ help="Partner who made the offer.",
+ )
+ property_id = fields.Many2one(
+ comodel_name='estate.property',
+ required=True,
+ help="Property for which the offer is made.",
+ )
+ validity = fields.Integer(
+ string="Validity (days)",
+ default=7,
+ help="Validity period of the offer in days.",
+ )
+ date_deadline = fields.Date(
+ string="Deadline",
+ compute='_compute_date_deadline',
+ inverse='_inverse_date_deadline',
+ store=True,
+ help="Deadline for the offer based on validity period.",
+ )
+ property_type_id = fields.Many2one(
+ related='property_id.property_type_id',
+ )
+
+ @api.depends('validity')
+ def _compute_date_deadline(self):
+ for property_offer in self:
+ property_offer.date_deadline = add(fields.Date.to_date(property_offer.create_date)
+ or fields.Date.today(), days=property_offer.validity)
+
+ def _inverse_date_deadline(self):
+ for property_offer in self:
+ property_offer.validity = (property_offer.date_deadline -
+ fields.Date.to_date(property_offer.create_date)
+ or fields.Date.today()).days
+
+ @api.model_create_multi
+ def create(self, vals_list):
+ for vals in vals_list:
+ property = self.env['estate.property'].browse(vals.get('property_id'))
+
+ if (vals.get('price') < property.best_offer):
+ raise exceptions.UserError(
+ _("The offer price must be greater than the best offer of the property.")
+ )
+
+ if property.state == 'new':
+ property.state = 'offer_received'
+ return super().create(vals_list)
+
+ def action_accept(self):
+ for property_offer in self:
+ if (property_offer.property_id.state != 'offer_accepted'):
+ property_offer.status = 'accepted'
+ property_offer.property_id.state = 'offer_accepted'
+ property_offer.property_id.buyer_id = property_offer.partner_id
+ property_offer.property_id.selling_price = property_offer.price
+
+ self.search(
+ [('property_id', 'in', property_offer.property_id.ids),
+ ('status', '=', False)]
+ ).write({'status': 'refused'})
+
+ return True
+
+ def action_refuse(self):
+ for property_offer in self:
+ property_offer.status = 'refused'
+ return True
diff --git a/estate/models/estate_property_tag.py b/estate/models/estate_property_tag.py
new file mode 100644
index 00000000000..368d8b7f2fe
--- /dev/null
+++ b/estate/models/estate_property_tag.py
@@ -0,0 +1,14 @@
+from odoo import fields, models
+
+
+class EstatePropertyTag(models.Model):
+ _name = 'estate.property.tag'
+ _description = 'Estate Property Tag'
+ _order = 'name'
+ _sql_constraints = [
+ ('check_name_unique', 'UNIQUE(name)',
+ 'The name of the property type must be unique.'),
+ ]
+
+ name = fields.Char(required=True)
+ color = fields.Integer()
diff --git a/estate/models/estate_property_type.py b/estate/models/estate_property_type.py
new file mode 100644
index 00000000000..12e593c1436
--- /dev/null
+++ b/estate/models/estate_property_type.py
@@ -0,0 +1,36 @@
+from odoo import api, fields, models
+
+
+class EstatePropertyType(models.Model):
+ _name = 'estate.property.type'
+ _description = 'Estate Property Type'
+ _order = 'sequence, name'
+ _sql_constraints = [
+ ('check_name_unique', 'UNIQUE(name)',
+ 'The name of the property type must be unique.'),
+ ]
+
+ name = fields.Char(required=True)
+ property_ids = fields.One2many(
+ string="Properties",
+ comodel_name='estate.property',
+ inverse_name='property_type_id',
+ help="Properties of this type.",
+ )
+ sequence = fields.Integer(
+ default=1,
+ help="Sequence of the property type for ordering.",
+ )
+ offer_ids = fields.One2many(
+ string="Offers",
+ comodel_name='estate.property.offer',
+ inverse_name='property_type_id',
+ )
+ offer_count = fields.Integer(
+ compute='_compute_offer_count',
+ )
+
+ @api.depends('offer_ids')
+ def _compute_offer_count(self):
+ for property_type in self:
+ property_type.offer_count = len(property_type.offer_ids)
diff --git a/estate/models/res_users.py b/estate/models/res_users.py
new file mode 100644
index 00000000000..8d418f7962b
--- /dev/null
+++ b/estate/models/res_users.py
@@ -0,0 +1,13 @@
+from odoo import fields, models
+
+
+class ResUsers(models.Model):
+ _inherit = "res.users"
+
+ property_ids = fields.One2many(
+ string="Properties",
+ comodel_name='estate.property',
+ inverse_name='salesperson_id',
+ help="Properties owned by the user.",
+ domain=['|', ('state', '=', 'new'), ('state', '=', 'offer_received')],
+ )
diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv
new file mode 100644
index 00000000000..e9bde38a35f
--- /dev/null
+++ b/estate/security/ir.model.access.csv
@@ -0,0 +1,5 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_estate_user,estate.user,model_estate_property,base.group_user,1,1,1,1
+access_estate_prop_type_user,estate.property.type.user,model_estate_property_type,base.group_user,1,1,1,1
+access_estate_prop_tag_user,estate.property.tag.user,model_estate_property_tag,base.group_user,1,1,1,1
+access_estate_prop_offer_user,estate.property.offer.user,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
new file mode 100644
index 00000000000..8389b129155
--- /dev/null
+++ b/estate/views/estate_menus.xml
@@ -0,0 +1,12 @@
+
+
+
+
\ No newline at end of file
diff --git a/estate/views/estate_property_offer_views.xml b/estate/views/estate_property_offer_views.xml
new file mode 100644
index 00000000000..e3d1cda5d37
--- /dev/null
+++ b/estate/views/estate_property_offer_views.xml
@@ -0,0 +1,47 @@
+
+
+
+ estate.property.offer.form
+ estate.property.offer
+
+
+
+
+
+
+ estate.property.offer.list
+ estate.property.offer
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property Offers
+ estate.property.offer
+ list
+ [('property_type_id', '=', active_id)]
+
+
+
\ No newline at end of file
diff --git a/estate/views/estate_property_tag_views.xml b/estate/views/estate_property_tag_views.xml
new file mode 100644
index 00000000000..895a21554b7
--- /dev/null
+++ b/estate/views/estate_property_tag_views.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ estate.property.tag.list
+ estate.property.tag
+
+
+
+
+
+
+
+
+ Property Tags
+ estate.property.tag
+ list,form
+
+
\ No newline at end of file
diff --git a/estate/views/estate_property_type_views.xml b/estate/views/estate_property_type_views.xml
new file mode 100644
index 00000000000..96ad06e6dae
--- /dev/null
+++ b/estate/views/estate_property_type_views.xml
@@ -0,0 +1,55 @@
+
+
+
+
+ estate.property.type.list
+ estate.property.type
+
+
+
+
+
+
+
+
+
+ estate.property.type.form
+ estate.property.type
+
+
+
+
+
+
+ Property Types
+ estate.property.type
+ list,form
+
+
\ 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..c86afdc64c1
--- /dev/null
+++ b/estate/views/estate_property_views.xml
@@ -0,0 +1,146 @@
+
+
+
+
+ estate.property.search
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.form
+ estate.property
+
+
+
+
+
+
+ estate.property.list
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.kanban
+ estate.property
+
+
+
+
+
+
+
+
+
+ Expected Price:
+
+
+ Best Offer:
+
+
+ Selling Price:
+
+
+
+
+
+
+
+
+
+ Properties
+ estate.property
+ list,form,kanban
+ {"search_default_available": True}
+
+
diff --git a/estate/views/res_users_views.xml b/estate/views/res_users_views.xml
new file mode 100644
index 00000000000..d6164f7fdf9
--- /dev/null
+++ b/estate/views/res_users_views.xml
@@ -0,0 +1,15 @@
+
+
+
+ res.users.view.form.inherit.estate
+ res.users
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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..596dcb0371a
--- /dev/null
+++ b/estate_account/__manifest__.py
@@ -0,0 +1,17 @@
+{
+ 'name': "estate_account",
+ 'version': '1.0',
+ 'category': 'Sales/RealEstate',
+ 'summary': 'Link estate properties with accounting features.',
+ 'author': "Odoo S.A.",
+ 'description': """
+ Description text
+ """,
+ 'depends': [
+ 'estate',
+ 'account'
+ ],
+ 'installable': True,
+ 'application': False,
+ 'license': 'LGPL-3',
+}
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..b8de561dc65
--- /dev/null
+++ b/estate_account/models/estate_property.py
@@ -0,0 +1,23 @@
+from odoo import Command, models
+
+
+class EstateAccountProperty(models.Model):
+ _inherit = "estate.property"
+
+ def action_sold(self):
+ for property_record in self:
+ self.env['account.move'].create(
+ [
+ dict(
+ partner_id=property_record.buyer_id.id,
+ move_type="out_invoice",
+ line_ids=[
+ Command.create(dict(name="6% Down Payment", quantity=1,
+ price_unit=0.06 * property_record.selling_price)),
+ Command.create(dict(name="Administrative Fees", quantity=1, price_unit=100))
+ ],
+
+ )
+ ]
+ )
+ return super().action_sold()