Skip to content

Conversation

@japat-odoo
Copy link

@japat-odoo japat-odoo commented Jan 1, 2026

Add SQL constraints to ensure data integrity:

  • Expected price and offer price must be strictly positive.
  • Selling price must be positive.
  • Property type and tag names must be unique.
  • Added the Python constraints, but without using float_compare and float_is_zero

- The Estate Module, which is needed as of tutorials
- Required fields were added, including the selection
- CHAPTER 1,2,3
@robodoo
Copy link

robodoo commented Jan 1, 2026

Pull request status dashboard

-Added the list and form view for proper readability with the group feature
-Added the search functionality, i.e, available and Postcode
-Added the security read, write, and create rules  to solve the warning message
-improved the structure of the estate property
-CHAPTER 4,5,6
Copy link

@bit-odoo bit-odoo left a comment

Choose a reason for hiding this comment

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

Hello,
Good work!

No need to define a chapter in the PR message.
And can you please adapt your commit message according to guidelines?

Thanks

Comment on lines 1 to 2
from odoo import models, fields
from datetime import timedelta
Copy link

Choose a reason for hiding this comment

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

name="Properties"
parent="estate_first_level_menu"
action="estate_property_action" />
</odoo> No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Should be one empty line at the EOF.

<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>
</odoo> No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Should be one empty line at the EOF.

- Created the 'estate.property.offer' model with fields
- Add a One2many relationship 'offer_ids' to the 'estate.property' model.
- Implement list and form views for the offer model.
- Update the property form view to display offers in a dedicated tab.
- Implemented computed fields for 'total_area' and 'best_price' to
  automatically aggregate property data and identify the highest offer.
- Added 'validity' and 'date_deadline' to property offers with inverse
  logic, allowing users to define deadlines either by a date or a
  duration in days.
- Add an onchange method for the garden field
- Fix ParseError by ensuring actions are defined before menuitems
- chapter 8
Copy link

@bit-odoo bit-odoo left a comment

Choose a reason for hiding this comment

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

Hello
Nice work!
Can you please update your PR description.
Thanks

Comment on lines 1 to 2
from odoo import api, fields, models
from datetime import timedelta
Copy link

Choose a reason for hiding this comment

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

Please apply these changes.-#1107 (comment)


name = fields.Char(required=True)
description = fields.Text()
postcode = fields.Char()
Copy link

Choose a reason for hiding this comment

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

Why is this field char() ?

Copy link
Author

Choose a reason for hiding this comment

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

Because, Sir, here in Chapter 3, we are told to have this field as a Character
https://www.odoo.com/documentation/19.0/developer/tutorials/server_framework_101/03_basicmodel.html#types
I have done the other changes
Thank You.

Comment on lines 1 to 2
from odoo import api, fields, models
from datetime import timedelta
Copy link

Choose a reason for hiding this comment

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

Please apply these changes here also.-#1107 (comment)

estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1
estate.access_estate_property_type,access_estate_property_type,estate.model_estate_property_type,base.group_user,1,1,1,1
estate.access_estate_property_tag,access_estate_property_tag,estate.model_estate_property_tag,base.group_user,1,1,1,1
estate.access_estate_property_offer,access_estate_property_offer,estate.model_estate_property_offer,base.group_user,1,1,1,1 No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Should be one empty line at EOF.

<h1>
<field name="name" />
</h1>

Copy link

Choose a reason for hiding this comment

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

unneccary space.

help="here you will get the tags" />
</group>
<group>

Copy link

Choose a reason for hiding this comment

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

unneccary space.

<field name="total_area" />
</group>
</page>

Copy link

Choose a reason for hiding this comment

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

unneccary space.

<page string="Offers">
<field name="offer_ids"></field>
</page>

Copy link

Choose a reason for hiding this comment

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

unneccary space.

- Added 'Sold' and 'Cancel' buttons to estate.property.
- Added 'Accept' and 'Refuse' buttons to estate.property.offer.
- Implement logic to prevent selling canceled properties and vice-versa.
- Update property state, selling price, and buyer when an offer is accepted.
Add SQL constraints to ensure data integrity:
- Expected price and offer price must be strictly positive.
- Selling price must be positive.
- Property type and tag names must be unique.
- Added the Python constrains but without using float_compare and float_is_zero
…ttributes

- Model Ordering:
    - Added default ordering for properties (newest first), offers
      (highest price), tags, and types (alphabetical).
    - Implemented manual ordering for property types using a
      'sequence' field and the 'handle' widget in list views.

- View Enhancements:
    - Integrated 'statusbar' widget for property states.
    - Added color pickers to tags and 'no_create'/'no_edit' options
      to property types to prevent accidental data entry.
    - Enabled inline editing (editable=bottom) for offers and tags
      to reduce form switching.
    - Applied conditional decorations (colors/bold) to list views
      based on property status and offer values.

- Business Logic & Visibility:
    - Used 'invisible' attributes to hide garden details when no
      garden is present and to hide offer buttons once processed.
    - Set 'readonly' on offers once a property reaches a terminal
      state (Offer Accepted, Sold, or Cancelled) to ensure data integrity.

- Chapter 10 done, 11 (85%)
Copy link

@bit-odoo bit-odoo left a comment

Choose a reason for hiding this comment

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

Hello,
Can you please improve your PR title.
Thanks

Comment on lines +10 to +17
_check_expected_price = models.Constraint(
"CHECK(expected_price >= 0)",
"The expected price should be strictly positive",
)
_check_selling_price = models.Constraint(
"CHECK(selling_price >= 0)",
"The selling price should be strictly positive",
)

Choose a reason for hiding this comment

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

Please follow the coding guidelines SQL constraints are declared after the field declaration.

copy=False,
required=True,
)
status = fields.Selection(

Choose a reason for hiding this comment

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

Why have you created this field? We already have a state field.

Comment on lines +103 to +108
for record in self:
if record.status == "cancelled":
raise UserError("Cancelled Property cannot be sold.")
else:
record.state = "sold"
record.status = "sold"

Choose a reason for hiding this comment

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

It's good to make the error message translatable.
raise UserError(_("Cancelled Property cannot be sold."))

We can use filtered() here.

if self.filtered(lamda x: x.state=="cancelled")

Comment on lines +111 to +115
for record in self:
if record.status == "sold":
raise UserError("Sold Property cannot be Cancelled.")
record.state = "cancelled"
record.status = "cancelled"

Choose a reason for hiding this comment

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

It's good to make the error message translatable.
raise UserError(_("Sold Property cannot be Cancelled."))

We can use filtered() here.

if self.filtered(lamda x: x.state=="sold")

class EstatePropertyOffer(models.Model):
_name = "estate.property.offer"
_description = "Estate Property Offer"
_check_offer_price = models.Constraint(

Choose a reason for hiding this comment

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

Please follow the coding guidelines SQL constraints are declared after the field declaration.

date_diff = record.date_deadline - creation_date
record.validity = date_diff.days

def refuse_offer_action_icon(self):

Choose a reason for hiding this comment

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

Please follow the coding guidelines prefix with action_ .

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