8000 [ADD] estate: initial Real Estate module with models, views, and rela… by raaa-odoo · Pull Request #757 · odoo/tutorials · GitHub
[go: up one dir, main page]

Skip to content
< 8000 div class="d-flex flex-column flex-md-row flex-items-start flex-md-items-center">

[ADD] estate: initial Real Estate module with models, views, and rela… #757

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 15 commits into
base: 18.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
8000
Prev Previous commit
Next Next commit
[IMP] estate: implement business logic for offers, constraints, state…
… transitions

This commit completes the enhancements from chapters 11 to 15 of the Odoo 18
Real Estate module. It introduces a range of improvements:

- Added state field with custom transitions (`new`, `offer received`,
`offer accepted`, `sold`, `cancelled`), including buttons and logic for
Sold/Cancelled.
- Added computed fields: total_area (living + garden), best_offer, and
selling_price.
- Added SQL constraints and Python constraints to ensure offers are above
a threshold and selling price is logically correct.
- Used computed and inverse fields to manage garden area visibility based on the
garden boolean.
- Refactored UI behavior (e.g., readonly fields) based on the state of the
property.
- Automatically assigns partner to offers upon creation.
- Used Inheritance for inheriting the class and use the features.
- Created kanban view while using drag and drop.

These changes reinforce business rules and improve usability for real estate
 agents managing listings and offers.
  • Loading branch information
raaa-odoo committed May 29, 2025
commit 0f69fe999a4590464f30e8b4a6c9f71646b84464
2 changes: 1 addition & 1 deletion rental_deposit/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import models
from . import models
2 changes: 1 addition & 1 deletion rental_deposit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
'deposit_rental/static/src/website_deposit_amount.js',
}
},
}
}
2 changes: 1 addition & 1 deletion rental_deposit/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from . import res_config_settings
from . import product_template
from . import sale_order
from . import sale_order_line
from . import sale_order_line
3 changes: 2 additions & 1 deletion rental_deposit/models/product_template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from odoo import api, fields, models
from odoo import fields, models


class ProductTemplate(models.Model):
_inherit = 'product.template'
Expand Down
1 change: 1 addition & 0 deletions rental_deposit/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from odoo import api, fields, models


class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

Expand Down
7 changes: 4 additions & 3 deletions rental_deposit/models/sale_order.py
8000
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from odoo import _, api, fields, models
from odoo import _, models
from odoo.exceptions import UserError


class SaleOrder(models.Model):
_inherit = 'sale.order'

Expand All @@ -14,7 +15,7 @@ def _add_deposit_product(self, order_line):
raise UserError(_("The configured deposit product does not exist."))

existing_line = self.order_line.filtered(lambda l: l.linked_line_id.id == order_line.id)
amount = order_line.product_id.deposit_amount * order_line.product_uom_qty
# amount = order_line.product_id.deposit_amount * order_line.product_uom_qty

if existing_line:
existing_line.write({
Expand All @@ -31,4 +32,4 @@ def _add_deposit_product(self, order_line):
'price_unit': order_line.product_id.deposit_amount,
'linked_line_id': order_line.id,
'name': f"Deposit for {order_line.product_id.display_name}",
})
})
1 change: 1 addition & 0 deletions rental_deposit/models/sale_order_line.py
Original file line number Diff line number Diff line chan 9ADE ge
@@ -1,5 +1,6 @@
from odoo import api, fields, models


class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'

Expand Down
2 changes: 1 addition & 1 deletion rental_deposit/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
</xpath>
</field>
</record>
</odoo>
</odoo>
0