Skip to content

Conversation

@yewentai
Copy link

No description provided.

@robodoo
Copy link

robodoo commented Nov 19, 2025

Pull request status dashboard

@yewentai yewentai force-pushed the 19.0-tutorials-joyep branch 6 times, most recently from e9da80b to c526e50 Compare November 20, 2025 09:53
Copy link

@antonrom1 antonrom1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look really good overall, good job :P

Comment on lines 3 to 14
<menuitem id="estate_menu_root" name="Real Estate"/>

<menuitem id="estate_property_menu_categ"
name="Properties"
parent="estate_menu_root"
sequence="10"/>

<menuitem id="estate_property_menu_action"
name="Properties"
parent="estate_property_menu_categ"
action="estate_property_action"
sequence="20"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good! 👍
Just as a note, you can also define them like this instead of specifying the parent

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx! fixed.

Comment on lines 60 to 100
@api.depends("living_area", "garden_area")
def _compute_total_area(self):
for record in self:
record.total_area = record.living_area + record.garden_area

total_area = fields.Integer("Total Area (sqm)", compute="_compute_total_area", store=True)

@api.depends("offer_ids.price")
def _compute_best_offer(self):
for record in self:
prices = record.offer_ids.mapped("price")
record.best_offer = max(prices) if prices else 0.0

best_offer = fields.Float("Best Offer", compute="_compute_best_offer", store=True)

@api.onchange("garden")
def _onchange_garden(self):
if not self.garden:
self.garden_area = 0
self.garden_orientation = False
else:
if not self.garden_area:
self.garden_area = 10
if not self.garden_orientation:
self.garden_orientation = "north"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a Model attribute order should be

  • Private attributes (_name, _description, _inherit, …)
  • Default method and default_get
  • Field declarations
  • SQL constraints and indexes
  • Compute, inverse and search methods in the same order as field declaration
  • Selection method (methods used to return computed values for selection fields)
  • Constrains methods (@api.constrains) and onchange methods (@api.onchange)
  • CRUD methods (ORM overrides)
  • Action methods
  • And finally, other business methods.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx! fixed.

Comment on lines 43 to 55
other_offers = self.search(
[
("property_id", "=", offer.property_id.id),
("id", "!=", offer.id),
]
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's good, but you can make it a bit simpler. Recordsets have bitwise operations (__sub__, __or__, __and__ etc)

Suggested change
other_offers = self.search(
[
("property_id", "=", offer.property_id.id),
("id", "!=", offer.id),
]
)
other_offers = self.property_id.offer_ids - offer

Also check that none other offers were already accepted. e.g.:

if any(other_offers.filtered(lambda o: o.status == 'accepted')): ...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx! fixed.

Comment on lines 1 to 3
from odoo import api, fields, models
from odoo.exceptions import UserError
from dateutil.relativedelta import relativedelta

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: import order https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#imports

Suggested change
from odoo import api, fields, models
from odoo.exceptions import UserError
from dateutil.relativedelta import relativedelta
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
from odoo.exceptions import UserError

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx! fixed.

Comment on lines 18 to 26
date_availability = fields.Date(
"Available From", default=lambda self: fields.Date.today() + relativedelta(months=3), copy=False
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget the trailing comma. Also making this multiline would look better imo

Copy link
Author

@yewentai yewentai Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx!

Comment on lines 2 to 4
from . import estate_property_type
from . import estate_property_tag
from . import estate_property_offer

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: alphabetical import order

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx! fixed.

@yewentai yewentai force-pushed the 19.0-tutorials-joyep branch 9 times, most recently from d851b07 to b65f969 Compare November 20, 2025 13:35
@yewentai yewentai force-pushed the 19.0-tutorials-joyep branch from b65f969 to b565d8b Compare November 20, 2025 13:37
joyep added 4 commits November 20, 2025 14:46
Add property types, tags, and offers with corresponding views and access rights
Enhance property and offer models with computed fields and views
Implement action methods for property status  and offer status
Add SQL constraints for price and uniqueness in property models and add Python constraints for the accepted price.
@yewentai yewentai force-pushed the 19.0-tutorials-joyep branch from b565d8b to 859d32c Compare November 20, 2025 13:47
Enhance property management - update launch configuration, modify ordering, and improve views
Implement inherited user model and views, add CRUD validation for property offers
@yewentai yewentai force-pushed the 19.0-tutorials-joyep branch from 1305fc1 to d8b4942 Compare November 25, 2025 12:10
@yewentai yewentai force-pushed the 19.0-tutorials-joyep branch from 39c6702 to 935914a Compare November 27, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants