diff --git a/.gitignore b/.gitignore
index b6e47617de1..8d9cce67e02 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,3 +127,6 @@ dmypy.json
# Pyre type checker
.pyre/
+
+# VSCode preferences
+.vscode/
diff --git a/README.md b/README.md
index a0158d919ee..4a653a5e569 100644
--- a/README.md
+++ b/README.md
@@ -9,3 +9,4 @@ tutorial's solutions, and one for the
[Master the Odoo web framework](https://www.odoo.com/documentation/latest/developer/tutorials/master_odoo_web_framework.html)
tutorial's solutions. For example, `17.0`, `17.0-discover-js-framework-solutions` and
`17.0-master-odoo-web-framework-solutions`.
+# Test setup dalio
diff --git a/awesome_owl/__manifest__.py b/awesome_owl/__manifest__.py
index 55002ab81de..3356dea2fec 100644
--- a/awesome_owl/__manifest__.py
+++ b/awesome_owl/__manifest__.py
@@ -29,6 +29,7 @@
'assets': {
'awesome_owl.assets_playground': [
('include', 'web._assets_helpers'),
+ ('include', 'web.assets_backend'),
('include', 'web._assets_backend_helpers'),
'web/static/src/scss/pre_variables.scss',
'web/static/lib/bootstrap/scss/_variables.scss',
diff --git a/awesome_owl/static/src/card/card.js b/awesome_owl/static/src/card/card.js
new file mode 100644
index 00000000000..26edae09b61
--- /dev/null
+++ b/awesome_owl/static/src/card/card.js
@@ -0,0 +1,23 @@
+import { Component, useState } from "@odoo/owl";
+
+export class Card extends Component {
+ static template = "awesome_owl.Card";
+
+ static props = {
+ title: String,
+ slots: {
+ type: Object,
+ shape: {
+ default: Object,
+ },
+ },
+ };
+
+ setup() {
+ this.state = useState({ isOpen: true });
+ }
+
+ toggleContent() {
+ this.state.isOpen = !this.state.isOpen;
+ }
+}
diff --git a/awesome_owl/static/src/card/card.xml b/awesome_owl/static/src/card/card.xml
new file mode 100644
index 00000000000..46744c65ec3
--- /dev/null
+++ b/awesome_owl/static/src/card/card.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
diff --git a/awesome_owl/static/src/counter/counter.js b/awesome_owl/static/src/counter/counter.js
new file mode 100644
index 00000000000..14ffcbb8bbb
--- /dev/null
+++ b/awesome_owl/static/src/counter/counter.js
@@ -0,0 +1,21 @@
+import { Component, useState } from "@odoo/owl";
+
+export class Counter extends Component {
+ static template = "awesome_owl.Counter";
+
+ static props = {
+ onChange: { type: Function, optional: true },
+ };
+
+ setup() {
+ this.state = useState({ value: 1 });
+ }
+
+ increment() {
+ this.state.value++;
+
+ if (this.props.onChange) {
+ this.props.onChange();
+ }
+ }
+}
diff --git a/awesome_owl/static/src/counter/counter.xml b/awesome_owl/static/src/counter/counter.xml
new file mode 100644
index 00000000000..f31200276ce
--- /dev/null
+++ b/awesome_owl/static/src/counter/counter.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ Counter:
+
+
+
+
+
diff --git a/awesome_owl/static/src/playground.js b/awesome_owl/static/src/playground.js
index 4ac769b0aa5..db93191361d 100644
--- a/awesome_owl/static/src/playground.js
+++ b/awesome_owl/static/src/playground.js
@@ -1,5 +1,20 @@
-import { Component } from "@odoo/owl";
+import { Component, useState, markup } from "@odoo/owl";
+import { Counter } from "./counter/counter";
+import { Card } from "./card/card";
+import { TodoList } from "./todo_list/todo_list";
export class Playground extends Component {
static template = "awesome_owl.playground";
+ static components = { Counter, Card, TodoList };
+ static props = {};
+
+ setup() {
+ this.state = useState({ sum: 2 });
+ this.normalString = "
some content
"
+ this.markupString = markup("some content
");
+ }
+
+ incrementSum() {
+ this.state.sum++;
+ }
}
diff --git a/awesome_owl/static/src/playground.xml b/awesome_owl/static/src/playground.xml
index 4fb905d59f9..18e32b06070 100644
--- a/awesome_owl/static/src/playground.xml
+++ b/awesome_owl/static/src/playground.xml
@@ -1,10 +1,33 @@
-
- hello world
+
+
+
+ Sum:
+
+
+
+
+ Simple content.
+
+
+
+
+
+
+
+
+
+
+
-
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..09ad8001e0a
--- /dev/null
+++ b/awesome_owl/static/src/todo_item/todo_item.js
@@ -0,0 +1,26 @@
+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);
+ }
+}
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..c5b8123ce87
--- /dev/null
+++ b/awesome_owl/static/src/todo_item/todo_item.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ .
+
+
+
+
+
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..1054944bc21
--- /dev/null
+++ b/awesome_owl/static/src/todo_list/todo_list.js
@@ -0,0 +1,48 @@
+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 };
+ static props = {};
+
+ setup() {
+ this.todos = useState([]);
+ this.nextId = 0;
+ this.inputRef = useAutofocus("todoInput");
+ }
+
+ toggleTodo(todoId) {
+ const todo = this.todos.find((t) => t.id === todoId);
+ if (todo) {
+ todo.isCompleted = !todo.isCompleted;
+ }
+ }
+
+ addTodo(ev) {
+
+ if (ev.keyCode === 13 ) {
+
+ const description = ev.target.value.trim();
+
+ if (description !== "") {
+ this.todos.push({
+ id: this.nextId++,
+ description,
+ isCompleted: false,
+ });
+
+ ev.target.value = "";
+
+ }
+ }
+ }
+
+ removeTodo(todoId) {
+ const index = this.todos.findIndex((t) => t.id === todoId);
+ if (index >= 0) {
+ this.todos.splice(index, 1);
+ }
+ }
+}
diff --git a/awesome_owl/static/src/todo_list/todo_list.xml b/awesome_owl/static/src/todo_list/todo_list.xml
new file mode 100644
index 00000000000..2467b811ebb
--- /dev/null
+++ b/awesome_owl/static/src/todo_list/todo_list.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
Todo List
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/awesome_owl/static/src/utils.js b/awesome_owl/static/src/utils.js
new file mode 100644
index 00000000000..9bd8e1631e7
--- /dev/null
+++ b/awesome_owl/static/src/utils.js
@@ -0,0 +1,14 @@
+import { useRef, onMounted } from "@odoo/owl";
+
+export function useAutofocus(name) {
+
+ const ref = useRef(name);
+
+ onMounted(() => {
+ if (ref.el) {
+ ref.el.focus();
+ }
+ });
+
+ return ref;
+}
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..b84ef87ac05
--- /dev/null
+++ b/estate/__manifest__.py
@@ -0,0 +1,19 @@
+{
+ "name": "Real Estate",
+ "version": "19.0.1.1.0",
+ "depends": [
+ "base",
+ ],
+ "data": [
+ "security/ir.model.access.csv",
+ "views/estate_property_offer_views.xml",
+ "views/estate_property_type_views.xml",
+ "views/estate_property_tag_views.xml",
+ "views/estate_property_views.xml",
+ 'views/res_users_views.xml',
+ "views/estate_menus.xml",
+ ],
+ "application": True,
+ "author": "dalio",
+ "license": "LGPL-3"
+}
diff --git a/estate/models/__init__.py b/estate/models/__init__.py
new file mode 100644
index 00000000000..9a2189b6382
--- /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..2d0f75afab9
--- /dev/null
+++ b/estate/models/estate_property.py
@@ -0,0 +1,123 @@
+from dateutil.relativedelta import relativedelta
+from odoo import models, fields, api
+from odoo.exceptions import UserError, ValidationError
+from odoo.tools import float_is_zero, float_compare
+
+
+class EstateProperty(models.Model):
+
+ _name = "estate.property"
+ _description = "Real Estate Property"
+ _order = "id desc"
+
+ name = fields.Char(required=True)
+ description = fields.Text()
+ postcode = fields.Char()
+ date_availability = fields.Date(default=lambda self: fields.Date.today() + relativedelta(months=3), copy=False)
+ expected_price = fields.Monetary(required=True)
+ selling_price = fields.Monetary(readonly=True, copy=False)
+ bedrooms = fields.Integer(default=2)
+ living_area = fields.Integer()
+ facades = fields.Integer()
+ garage = fields.Boolean()
+ garden = fields.Boolean()
+ garden_area = fields.Integer()
+ garden_orientation = fields.Selection(
+ string="Orientation",
+ selection=[
+ ("north", "North"),
+ ("south", "South"),
+ ("west", "West"),
+ ("east", "East")
+ ],
+ help="Orientation of the garden"
+ )
+ active = fields.Boolean(default=True)
+ state = fields.Selection(
+ string="State",
+ selection=[
+ ("new", "New"),
+ ("offer_received", "Offer Received"),
+ ("offer_accepted", "Offer Accepted"),
+ ("sold", "Sold"),
+ ("cancelled", "Cancelled")
+ ],
+ help="State of the property",
+ required=True,
+ copy=False,
+ default="new"
+ )
+
+ property_type_id = fields.Many2one("estate.property.type")
+ salesman_id = fields.Many2one("res.users", default=lambda self: self.env.user)
+ buyer_id = fields.Many2one("res.partner", copy=False)
+ currency_id = fields.Many2one("res.currency", default=lambda self: self.env.company.currency_id)
+ tag_ids = fields.Many2many("estate.property.tag")
+ offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offers")
+
+ total_area = fields.Integer(compute="_compute_total_area", string="Total area (sqm)")
+ best_price = fields.Monetary(compute="_compute_best_price", currency_field="currency_id", string="Best Offer")
+
+ _check_expected_price = models.Constraint(
+ "CHECK(expected_price > 0)",
+ "the expected price must be strictly positive.",
+ )
+
+ _check_selling_price = models.Constraint(
+ "CHECK(selling_price >= 0)",
+ "the selling price must be positive.",
+ )
+
+ @api.depends("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"), default=0.0)
+
+ @api.constrains("selling_price", "expected_price")
+ def _check_selling_price_limit(self):
+ for record in self:
+
+ if float_is_zero(record.selling_price, precision_digits=2):
+ continue
+
+ lower_bound = 0.9 * record.expected_price
+
+ if float_compare(record.selling_price, lower_bound, precision_digits=2) == -1:
+ raise ValidationError(
+ "The selling price must be at least 90% of the expected price! "
+ "You must reduce the expected price if you want to accept this offer."
+ )
+
+ @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.ondelete(at_uninstall=False)
+ def _check_state_before_deletion(self):
+ for record in self:
+ if record.state not in ["new", "cancelled"]:
+ raise UserError("Only new and canceled properties can be deleted.")
+
+ def action_sold(self):
+ for record in self:
+ if record.state == "cancelled":
+ raise UserError("Canceled properties cannot be sold.")
+ self.state = "sold"
+ return True
+
+ def action_cancel(self):
+ for record in self:
+ if record.state == "sold":
+ raise UserError("Sold properties cannot be canceled.")
+ self.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..20735b3862f
--- /dev/null
+++ b/estate/models/estate_property_offer.py
@@ -0,0 +1,81 @@
+from dateutil.relativedelta import relativedelta
+from odoo import fields, models, api
+from odoo.exceptions import UserError, ValidationError
+
+
+class EstatePropertyOffer(models.Model):
+
+ _name = "estate.property.offer"
+ _description = "Property Offer"
+ _order = "price desc"
+
+ price = fields.Monetary()
+ status = fields.Selection(
+ selection=[
+ ("accepted", "Accepted"),
+ ("refused", "Refused")
+ ],
+ help="Status of the offer"
+ )
+ validity = fields.Integer(default=7, string="Validity (days)")
+
+ partner_id = fields.Many2one('res.partner', string="Partner", required=True)
+ property_id = fields.Many2one('estate.property', string="Property", required=True)
+ currency_id = fields.Many2one("res.currency", default=lambda self: self.env.company.currency_id)
+ property_type_id = fields.Many2one("estate.property.type", related="property_id.property_type_id", string="Property Type", store=True)
+
+ date_deadline = fields.Date(compute="_compute_date_deadline", inverse="_inverse_date_deadline", string="Deadline")
+
+ _check_price = models.Constraint(
+ "CHECK(price > 0)",
+ "the offer price must be strictly positive.",
+ )
+
+ @api.depends("create_date", "validity")
+ def _compute_date_deadline(self):
+ for record in self:
+ base_date = record.create_date or fields.Date.today()
+ record.date_deadline = base_date + relativedelta(days=record.validity)
+
+ def _inverse_date_deadline(self):
+ for record in self:
+ base_date = record.create_date.date() if record.create_date else fields.Date.today()
+
+ delta = record.date_deadline - base_date
+ record.validity = delta.days
+
+ @api.model
+ def create(self, vals_list):
+
+ property_ids = [vals.get("property_id") for vals in vals_list if vals.get("property_id")]
+ properties = self.env["estate.property"].browse(property_ids)
+
+ for vals, prop in zip(vals_list, properties):
+
+ existing_prices = prop.offer_ids.mapped("price")
+
+ if existing_prices and vals.get("price") < max(existing_prices):
+ raise UserError(f"The offer must be higher than {max(existing_prices):.2f}")
+
+ prop.state = "offer_received"
+
+ return super().create(vals_list)
+
+ def accept_offer(self):
+
+ for record in self:
+
+ if record.property_id.garden and record.property_id.garden_orientation == "south":
+ if record.price < record.property_id.expected_price:
+ raise ValidationError("The offer is too low for a property with a garden in south orientation.")
+
+ record.status = "accepted"
+ record.property_id.state = 'offer_accepted'
+ record.property_id.selling_price = record.price
+ record.property_id.buyer_id = record.partner_id
+
+ return True
+
+ def action_refuse(self):
+ self.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..3783491a00f
--- /dev/null
+++ b/estate/models/estate_property_tag.py
@@ -0,0 +1,16 @@
+from odoo import fields, models
+
+
+class EstatePropertyTag(models.Model):
+
+ _name = "estate.property.tag"
+ _description = "Property Tag"
+ _order = "name"
+
+ name = fields.Char(required=True)
+ color = fields.Integer()
+
+ _unique_name = models.Constraint(
+ "UNIQUE(name)",
+ "the name must be unique.",
+ )
diff --git a/estate/models/estate_property_type.py b/estate/models/estate_property_type.py
new file mode 100644
index 00000000000..6be3d3cb58b
--- /dev/null
+++ b/estate/models/estate_property_type.py
@@ -0,0 +1,26 @@
+from odoo import fields, models, api
+
+
+class EstatePropertyType(models.Model):
+
+ _name = "estate.property.type"
+ _description = "Property Type"
+ _order = "sequence, name"
+
+ name = fields.Char(required=True)
+ sequence = fields.Integer('Sequence', default=1, help="Used to order stages. Lower is better.")
+
+ property_ids = fields.One2many("estate.property", "property_type_id")
+ offer_ids = fields.One2many("estate.property.offer", "property_type_id")
+
+ offer_count = fields.Integer(compute="_compute_offer_count")
+
+ _unique_name = models.Constraint(
+ "UNIQUE(name)",
+ "the name must be unique.",
+ )
+
+ @api.depends("offer_ids")
+ def _compute_offer_count(self):
+ for record in self:
+ record.offer_count = len(record.offer_ids)
diff --git a/estate/models/res_users.py b/estate/models/res_users.py
new file mode 100644
index 00000000000..4e085cca759
--- /dev/null
+++ b/estate/models/res_users.py
@@ -0,0 +1,8 @@
+from odoo import models, fields
+
+
+class ResUsers(models.Model):
+
+ _inherit = "res.users"
+
+ property_ids = fields.One2many("estate.property", "salesman_id", string="Assigned properties", domain=[("state", "in", ["new", "offer_received"])])
diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv
new file mode 100644
index 00000000000..b2f2cb31b05
--- /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
+estate_property_access_user,estate.property.user,model_estate_property,base.group_user,1,1,1,1
+estate_property_type_access_user,estate.property.type.user,model_estate_property_type,base.group_user,1,1,1,1
+estate_property_tag_access_user,estate.property.tag.user,model_estate_property_tag,base.group_user,1,1,1,1
+estate_property_offer_access_user,estate.property.offer.user,model_estate_property_offer,base.group_user,1,1,1,1
diff --git a/estate/tests/__init__.py b/estate/tests/__init__.py
new file mode 100644
index 00000000000..576617cccff
--- /dev/null
+++ b/estate/tests/__init__.py
@@ -0,0 +1 @@
+from . import test_estate_property
diff --git a/estate/tests/test_estate_property.py b/estate/tests/test_estate_property.py
new file mode 100644
index 00000000000..6f6b1d6724b
--- /dev/null
+++ b/estate/tests/test_estate_property.py
@@ -0,0 +1,45 @@
+from odoo.exceptions import ValidationError
+from odoo.tests import TransactionCase, tagged
+from odoo import Command
+
+
+@tagged('post_install', '-at_install')
+class TestEstateProperty(TransactionCase):
+
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.estate = cls.env['estate.property'].create({
+ 'name': 'Super test estate',
+ 'expected_price': 100000.0,
+ 'state': 'new',
+ })
+ cls.test_partner = cls.env['res.partner'].create({
+ 'name': 'Maman ours',
+ })
+
+ def test_estate_best_price(self):
+ '''
+ Ensure best price is correctly updated when an offer is received.
+ '''
+ self.assertEqual(self.estate.best_price, 0.0)
+ self.estate.offer_ids = [Command.create({
+ 'price': 125000.0,
+ 'partner_id': self.test_partner.id,
+ })]
+ self.assertEqual(self.estate.best_price, 125000.0)
+
+ def test_accept_offer_south_facing_garden(self):
+ '''
+ Ensure offers for estates with south-facing gardens can only be accepted if above expected
+ price.
+ '''
+ self.estate.expected_price = 500000
+ self.estate.garden = True
+ self.estate.garden_orientation = 'south'
+ self.estate.offer_ids = [Command.create({
+ 'price': 475000.0,
+ 'partner_id': self.test_partner.id,
+ })]
+ with self.assertRaises(ValidationError):
+ self.estate.offer_ids.accept_offer()
diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml
new file mode 100644
index 00000000000..9fa93980dc0
--- /dev/null
+++ b/estate/views/estate_menus.xml
@@ -0,0 +1,15 @@
+
+
+
+
diff --git a/estate/views/estate_property_offer_views.xml b/estate/views/estate_property_offer_views.xml
new file mode 100644
index 00000000000..9e9d93c915b
--- /dev/null
+++ b/estate/views/estate_property_offer_views.xml
@@ -0,0 +1,40 @@
+
+
+
+ estate.property.offer.list
+ estate.property.offer
+
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.offer.form
+ estate.property.offer
+
+
+
+
+
+
+ Property Offers
+ estate.property.offer
+ list,form
+ [('property_type_id', '=', active_id)]
+
+
diff --git a/estate/views/estate_property_tag_views.xml b/estate/views/estate_property_tag_views.xml
new file mode 100644
index 00000000000..b5d4d99f1e6
--- /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
+
+
diff --git a/estate/views/estate_property_type_views.xml b/estate/views/estate_property_type_views.xml
new file mode 100644
index 00000000000..957652adb0b
--- /dev/null
+++ b/estate/views/estate_property_type_views.xml
@@ -0,0 +1,51 @@
+
+
+
+ Property Types
+ estate.property.type
+ list,form
+
+
+
+ estate.property.type.form
+ estate.property.type
+
+
+
+
+
+
+ estate.property.type.list
+ estate.property.type
+
+
+
+
+
+
+
+
diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml
new file mode 100644
index 00000000000..934928787d1
--- /dev/null
+++ b/estate/views/estate_property_views.xml
@@ -0,0 +1,140 @@
+
+
+
+ Properties
+ estate.property
+ list,form,kanban
+ {'search_default_available': True}
+
+
+
+ estate.property.list
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.form
+ estate.property
+
+
+
+
+
+
+ estate.property.search
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ estate.property.kanban
+ estate.property
+
+
+
+
+
+
+
+
+
+
+
+ Expected price:
+
+
+ Best price:
+
+
+ Selling price:
+
+
+
+
+
+
+
+
+
+
+
diff --git a/estate/views/res_users_views.xml b/estate/views/res_users_views.xml
new file mode 100644
index 00000000000..c8d93ba45ed
--- /dev/null
+++ b/estate/views/res_users_views.xml
@@ -0,0 +1,15 @@
+
+
+
+ res.users.form.inherit.estate
+ res.users
+
+
+
+
+
+
+
+
+
+
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..9e670884446
--- /dev/null
+++ b/estate_account/__manifest__.py
@@ -0,0 +1,12 @@
+{
+ "name": "Invoicing",
+ "version": "19.0.1.1.0",
+ "depends": [
+ "estate",
+ "account",
+ ],
+ "data": [],
+ "installable": True,
+ "author": "dalio",
+ "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..407a4fa14d2
--- /dev/null
+++ b/estate_account/models/estate_property.py
@@ -0,0 +1,29 @@
+from odoo import models, Command
+
+
+class EstateProperty(models.Model):
+
+ _inherit = "estate.property"
+
+ def action_sold(self):
+
+ self.env["account.move"].create(
+ {
+ "partner_id": self.buyer_id.id,
+ "move_type": "out_invoice",
+ "invoice_line_ids": [
+ Command.create({
+ "name": f"Sales commission: {self.name}",
+ "quantity": 1.0,
+ "price_unit": self.selling_price * 0.06,
+ }),
+ Command.create({
+ "name": "Administrative fees",
+ "quantity": 1.0,
+ "price_unit": 100.00,
+ }),
+ ],
+ }
+ )
+
+ return super().action_sold()