8000 [ADD] estate, estate_account, awesome_owl, awesome_dashboard: tutorial modules by pavy-odoo · Pull Request #761 · odoo/tutorials · GitHub
[go: up one dir, main page]

Skip to content

[ADD] estate, estate_account, awesome_owl, awesome_dashboard: tutorial modules #761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 29 commits into
base: 18.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
25cc118
[ADD] estate: initialize module with manifest file
pavy-odoo Apr 23, 2025
f28831d
[ADD] estate: implement models for estate properties
pavy-odoo Apr 23, 2025
a7342c6
[ADD] estate: expand estate property model with additional fields
pavy-odoo Apr 23, 2025
ef3744e
[ADD] estate: add access control for estate property model
pavy-odoo Apr 23, 2025
82e69fb
[IMP] estate: update module version and enhance manifest details
pavy-odoo Apr 23, 2025
3ef3a1b
[IMP] estate: rename module and add estate property views
pavy-odoo Apr 24, 2025
88da444
[ADD] estate: enhance property model with additional fields and defau…
pavy-odoo Apr 24, 2025
8b64fcc
[IMP] estate: enhance property views with additional fields and impro…
pavy-odoo Apr 24, 2025
326f856
[ADD] estate: add state field to property form and enhance search vie…
pavy-odoo Apr 24, 2025
4d1c849
[ADD] estate: add estate property type model and views; update menus …
pavy-odoo Apr 24, 2025
25545e5
[IMP] estate: implement property offers and tags; enhance property mo…
pavy-odoo Apr 25, 2025
cc9ac0b
[IMP] estate: format code for consistency; following standard code st…
pavy-odoo Apr 28, 2025
0b54412
[IMP] estate: enhance property and offer models with new fields and m…
pavy-odoo Apr 29, 2025
94b71d0
[IMP] estate: add SQL constraints for expected and selling prices in …
pavy-odoo Apr 29, 2025
77a7e86
[IMP] estate: update views and models; add ordering, new fields, and …
pavy-odoo May 1, 2025
8523b10
[IMP] estate: add inheritance for res.users to link properties; updat…
pavy-odoo May 2, 2025
f07e781
[IMP] estate: update manifest and views; enhance res.users model with…
pavy-odoo May 2, 2025
d4c35a8
[IMP] estate_account: initialize module with manifest and model impor…
pavy-odoo May 5, 2025
bc0753a
[IMP] estate: add kanban view for properties
pavy-odoo May 5, 2025
e24aeaa
[IMP] estate_account: remove debug print statements
pavy-odoo May 5, 2025
ac70966
[IMP] awesome_owl: implement playground, card, counter, todo list com…
pavy-odoo May 7, 2025
8d9c143
[IMP] awesome_dashboard: complete awesome dashboard module
pavy-odoo May 8, 2025
4793d26
[IMP] estate: remove vscode launch config; LF line endings
pavy-odoo May 11, 2025
4a0c1a8
[IMP] awesome_owl: adding missing newline
pavy-odoo May 11, 2025
d9842d2
[IMP] estate: add demo data and security groups
pavy-odoo May 12, 2025
304fe57
[IMP] estate: add images to static assets
pavy-odoo May 12, 2025
7962039
[IMP] estate: add image field to estate property model
pavy-odoo May 12, 2025
2484058
[IMP] estate: standardize state terminology from 'cancelled' to 'canc…
pavy-odoo May 12, 2025
e032fb4
[IMP] estate: add report templates and security rules
pavy-odoo May 13, 2025
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
Prev Previous commit
Next Next commit
[IMP] estate: add SQL constraints for expected and selling prices in …
…property model; enforce unique name constraints in property tag and type models
  • Loading branch information
pavy-odoo committed Apr 29, 2025
commit 94b71d056b19800fcee59346cf11f27fc913405e
25 changes: 23 additions & 2 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
from odoo import models, fields, api
from dateutil.relativedelta import relativedelta
from odoo.exceptions import UserError
from odoo.tools.float_utils import float_compare, float_is_zero


class EstateProperty(models.Model):
_name = "estate.property"
_description = "Estate Property"
_sql_constraints = [
(
"check_expected_price",
"CHECK(expected_price > 0)",
"A property expected price must be strictly positive",
),
(
"check_selling_price",
"CHECK(selling_price >= 0)",
"A property selling price must be positive",
),
]

name = fields.Char(required=True)
description = fields.Text()
Expand Down Expand Up @@ -105,14 +118,22 @@ def action_sold(self):
raise UserError("You cannot sell an already sold property")
if record.state == "cancelled":
raise UserError("Cancelled Property can't be sold")
accepted_offer = record.offer_ids.filtered(lambda offer: offer.status == "accepted")
accepted_offer = record.offer_ids.filtered(
lambda offer: offer.status == "accepted"
)
if not accepted_offer:
raise UserError("You cannot sell a property without an accepted offer")
record.write({'state': 'sold'})
record.write({"state": "sold"})

def action_cancel(self):
for record in self:
if record.state != "sold":
record.state = "cancelled"
else:
raise UserError("Sold Property can't be cancelled")

@api.constrains('expected_price', 'selling_price')
def _check_selling_price(self):
for record in self:
if not float_is_zero(record.selling_price, precision_digits=2) and float_compare(record.selling_price, 0.9 * record.expected_price, precision_digits=2) < 0:
raise UserError("The selling price cannot be lower than 90% of the expected price.")
7 changes: 7 additions & 0 deletions estate/models/estate_property_offer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
class EstatePropertyOffer(models.Model):
_name = "estate.property.offer"
_description = "Estate Property Offer"
_sql_constraints = [
(
"check_price",
"CHECK(price > 0)",
"An offer price must be strictly positive",
)
]

price = fields.Float("Price", required=True)
status = fields.Selection(
Expand Down
7 changes: 7 additions & 0 deletions estate/models/estate_property_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@
class EstatePropertyTag(models.Model):
_name = "estate.property.tag"
_description = "Property Tag"
_sql_constraints = [
(
"check_name",
"UNIQUE(name)",
"The name must be unique",
)
]

name = fields.Char("Name", required=True)
7 changes: 7 additions & 0 deletions estate/models/estate_property_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@
class EstatePropertyType(models.Model):
_name = "estate.property.type"
_description = "Estate Property Type"
_sql_constraints = [
(
"check_name",
"UNIQUE(name)",
"The name must be unique",
)
]

name = fields.Char("Name", required=True)
0