Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
71296e3
[ADD] estate: initialize module structure and model
jakan-odoo Dec 31, 2025
3665d34
[ADD] estate: add security rules and fix style
jakan-odoo Jan 1, 2026
d8791e0
[ADD] estate: add basic user interface
jakan-odoo Jan 1, 2026
378ed7c
[IMP] estate: create basic views and search
jakan-odoo Jan 2, 2026
f155702
[IMP] estate: add many2one model relation
jakan-odoo Jan 5, 2026
1c69bbe
[IMP] estate: add one2many and many2many relations
jakan-odoo Jan 6, 2026
9131c01
[IMP] estate: add computed fields and onchanges
jakan-odoo Jan 7, 2026
2784e60
[IMP] estate: implement object-based actions
jakan-odoo Jan 7, 2026
8c66cd9
[IMP] estate: add sql and python constraints
jakan-odoo Jan 8, 2026
dbb059f
[IMP] estate: add inline views, widgets, and order
jakan-odoo Jan 9, 2026
aee8aeb
[IMP] estate: add property maintenance requests
jakan-odoo Jan 12, 2026
6dd7eec
[FIX] estate: improve maintenance cost validation
jakan-odoo Jan 12, 2026
ac29768
[IMP] estate: enhance views with UI improvements
jakan-odoo Jan 13, 2026
54f03a6
[IMP] estate: apply python, model, and view inheritance
jakan-odoo Jan 16, 2026
cc37406
[ADD] estate: add translations, constraints, and UI updates
jakan-odoo Jan 19, 2026
50ec57f
[IMP] estate_account: integrate estate with accounting
jakan-odoo Jan 20, 2026
616598d
[IMP] estate: add investor profile and compute unsold value
jakan-odoo Jan 21, 2026
5e71759
[IMP] estate: add kanban view and default grouping
jakan-odoo Jan 21, 2026
9c162ab
[ADD] awesome_owl: add Owl component examples in playground
jakan-odoo Jan 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,5 @@ dmypy.json

# Pyre type checker
.pyre/

i18n
1 change: 1 addition & 0 deletions awesome_owl/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'awesome_owl.assets_playground': [
('include', 'web._assets_helpers'),
('include', 'web._assets_backend_helpers'),
('include', 'web.assets_backend'),
'web/static/src/scss/pre_variables.scss',
'web/static/lib/bootstrap/scss/_variables.scss',
'web/static/lib/bootstrap/scss/_maps.scss',
Expand Down
10 changes: 10 additions & 0 deletions awesome_owl/static/src/card/card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from "@odoo/owl";

export class Card extends Component{
static template = "awesome_owl.card";

static props = {
title: String,
content: String,
};
}
11 changes: 11 additions & 0 deletions awesome_owl/static/src/card/card.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="awesome_owl.card">
<div class="card d-inline-block m-2" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title"><t t-esc="props.title"/></h5>
<p class="card-text"><t t-out="props.content"/></p>
</div>
</div>
</t>
</templates>
13 changes: 13 additions & 0 deletions awesome_owl/static/src/counter/counter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Component, useState } from "@odoo/owl";

export class Counter extends Component {
static template = "awesome_owl.counter";

setup() {
this.state = useState({ value: 0 });
}

increment() {
this.state.value++;
}
}
9 changes: 9 additions & 0 deletions awesome_owl/static/src/counter/counter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="awesome_owl.counter">
<div class="border d-inline-block p-2 mt-2">
Counter: <t t-esc="state.value"/>
<button class="btn btn-primary m-2" t-on-click="increment">Increment</button>
</div>
</t>
</templates>
10 changes: 9 additions & 1 deletion awesome_owl/static/src/playground.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { Component } from "@odoo/owl";
import { Component, markup } from "@odoo/owl";
import { Counter } from "./counter/counter";
import { Card } from "./card/card";

export class Playground extends Component {
static template = "awesome_owl.playground";
static components = { Counter, Card };

setup() {
this.htmlContent = markup("<div class='text-primary'>some content</div>");
this.rawString = "<div class='text-primary'>some content</div>";
}
}
7 changes: 5 additions & 2 deletions awesome_owl/static/src/playground.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">

<t t-name="awesome_owl.playground">
<div class="p-3">
hello world
<Counter/>
<div class="d-flex flex-wrap">
<Card title="'Card 1'" content="htmlContent"/>
<Card title="'Card 2'" content="rawString"/>
</div>
</div>
</t>

</templates>
1 change: 1 addition & 0 deletions estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
23 changes: 23 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
'name': "Real Estate",
'version': "1.0",
'category': "Real Estate",
'summary': "Manage real estate properties",
'description': "This module allows managing properties",
'depends': ['base'],
'author': "jakan",
'license': "LGPL-3",
'application': True,
'installable': 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/estate_property_maintenance_views.xml",
"views/estate_property_investor_views.xml",
'views/res_users_views.xml',
"views/estate_menus.xml",
]
}
7 changes: 7 additions & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from . import estate_property
from . import estate_property_type
from . import estate_property_tag
from . import estate_property_offer
from . import estate_property_maintenance
from . import estate_property_investor
from . import res_users
145 changes: 145 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
from dateutil.relativedelta import relativedelta

from odoo import api, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo.tools.float_utils import float_compare, float_is_zero
from odoo import _


class EstateProperty(models.Model):
_name = 'estate.property'
_description = 'Real Estate Property'
_order = 'id desc'

# Each field becomes a column in PostgreSQL table
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.Float(required=True)
selling_price = fields.Float(
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="Direction",
selection=[
('north', "North"),
('south', "South"),
('east', "East"),
('west', "West")])
active = fields.Boolean(default=True)
state = fields.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)
seller_id = fields.Many2one("res.users", string="Seller", default=lambda self: self.env.user)
tag_ids = fields.Many2many("estate.property.tag", string="Property Tags")
offer_ids = fields.One2many("estate.property.offer", "property_id", string="Property Offers")
total_area = fields.Float(string="Total Area", compute="_compute_total_area", store=True)
best_price = fields.Float(string="Best Offer", compute="_compute_best_price")
maintenance_ids = fields.One2many("estate.property.maintenance", "property_id")
total_cost = fields.Float(string="Total Cost", compute="_compute_total_cost")

_check_expected_price = models.Constraint(
'CHECK(expected_price > 0)',
'Expected price must be strictly positive.',
)

_check_selling_price = models.Constraint(
'CHECK(selling_price > 0)',
'Selling price must be positive.',
)

@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_price(self):
for property in self:
if property.offer_ids:
property.best_price = max(property.offer_ids.mapped('price'))
else:
property.best_price = 0

@api.depends('maintenance_ids.cost')
def _compute_total_cost(self):
for maintenance in self:
maintenance.total_cost = sum(maintenance.maintenance_ids.mapped('cost'))

@api.constrains('expected_price', 'selling_price')
def _check_selling_price(self):
for property in self:
if float_is_zero(property.selling_price, precision_digits=2):
continue

minimum_price = property.expected_price * 0.9

if float_compare(property.selling_price, minimum_price, precision_digits=2) < 0:
raise ValidationError("Selling price cannot be lower than 90% of the expected 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

@api.ondelete(at_uninstall=False)
def _check_property_deletion(self):
for property in self:
if property.state not in ('new', 'cancelled'):
raise UserError("You can only delete properties in New or Cancelled state")

def action_sold(self):
for property in self:
if property.state == 'cancelled':
raise UserError(_("Sold property cannot be cancelled"))
if not property.buyer_id:
raise UserError(_("Without accept any offer we can't sold it"))
if property.maintenance_ids:
for maintenance in property.maintenance_ids:
if maintenance.status in ('new', 'cancle'):
raise UserError(_("Maintenance cost must be Approved or Done"))
property.state = 'sold'
return True

def action_cancel(self):
for property in self:
if property.state == 'sold':
raise UserError("Cancelled property cannot be sold")
property.state = 'cancelled'
return True

def offer_accepted(self):
for record in self:
if not record.offer_ids:
raise UserError("There are no offers to accept")

best_offer = max(record.offer_ids, key=lambda p:p.price)
best_offer.action_accept()

return True
9 changes: 9 additions & 0 deletions estate/models/estate_property_investor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import fields, models


class EstatePropertyInvestor(models.Model):
_name = 'estate.property.investor'
_description = 'Property Investor'
_inherits = {'res.partner': 'partner_id'}

partner_id = fields.Many2one('res.partner', required=True, ondelete='cascade')
36 changes: 36 additions & 0 deletions estate/models/estate_property_maintenance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from odoo import fields, models
from odoo.exceptions import UserError
from odoo.tools.float_utils import float_is_zero


class EstatePropertyMaintenance(models.Model):
_name = 'estate.property.maintenance'
_description = 'Estate Property maintenance'

title = fields.Char(required=True)
cost = fields.Float(string="Cost")
status = fields.Selection(
[
('new', "New"),
('approved', "Approved"),
('done', "Done"),
('cancle', "Cancle")
],
required=True,
default="new",
)

property_id = fields.Many2one('estate.property', required=True)

def maintenance_accept(self):
for maintenance in self:
if float_is_zero(maintenance.cost, precision_digits=2):
raise UserError("Maintenance cost must be greater than zero")

maintenance.status = "approved"
return True

def maintenance_refuse(self):
for maintenance in self:
maintenance.status = "cancle"
return True
Loading