-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ADD] estate: Add initial module structure with property model #1072
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
base: 19.0
Are you sure you want to change the base?
Conversation
…nifest. Created 'estate_property' model and fields.
|
Hello, can you please ensure that your runbot is green 😄 |
Also added access rights for estate.property model
lost-odoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I already made a small review. Not a big deal but just some nitpicking stuff that we try to avoid. 😄
|
Also please don't forget to make one commit per chapter. Try to make a correct title. Don't hesitate to amend or squash your commits. |
Added estate_property_views.xml which contains list and form views Added a separate estate_property_search_view.xml for search with filters for active and availability as well as group by based on postcode. Also addressed code review comments.
Added estate.property.type model which specifies the type of property. Eg: House/Apartment Added estate.property.tag model to indicate the tags(cozy, renovated) for each property Added estate.property.offer model which indicates the offers for each property. Also added views for each model mentioned above.
f23d67c to
f11fc50
Compare
|
Hey don't forget to close all the comments I did on the review when you did them 😄 |
total_area field is based on the size of both garden_area and living_area best_offer field is based on the max price among the list of offers Also added validity and deadline for the offers as a computed and inverse function impacting each other.
d33c5b0 to
e512458
Compare
Added Sold and Cancel buttons: When a property is sold it cannot be canceled When a property is canceled it cannot be sold Added offer accept and rejected icon button: When an offer is accepted: 1. The selling price is automatically updated by button actions 2. Status changes to 'Offer Accepted' 3. Rejects all other offers Added an onchange, which updates the status to 'Offer Received' when there is an offer.
Added SQL constraints for expected_price, selling_price, property_tag_name and property_type_name Added python constraint for selling_price to be >= 90% of expected_price unless it is 0.0
| 'website': "https://www.odoo.com", | ||
|
|
||
| 'category': 'Tutorials', | ||
| 'version': '0.1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can switch this to 1.0 which is the default for a new module.
| required=True) | ||
| status = fields.Selection( | ||
| string="Status", | ||
| selection=[('new', "New"), ('offer_received', "Offer Received"), ('offer_accepted', "Offer Accepted"), ('sold', "Sold"), ('canceled', "Canceled")], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you split this into multiple lines please. Same for above.
| else: | ||
| record.status = record.status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed anymore as you changed the compute to onchange.
| def action_mark_sold(self): | ||
| for record in self: | ||
| if record.status == 'canceled': | ||
| raise UserError("Canceled properties cannot be sold.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to translate this string. You can use self.env._("Canceled properties cannot be sold.") to make it translatable.
| def action_mark_cancel(self): | ||
| for record in self: | ||
| if record.status == 'sold': | ||
| raise UserError("Sold properties cannot be canceled.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
| _check_expected_price = models.Constraint( | ||
| 'CHECK(expected_price > 0)', | ||
| 'The expected price must be strictly positive' | ||
| ) | ||
|
|
||
| _check_selling_price = models.Constraint( | ||
| 'CHECK(selling_price >= 0)', | ||
| 'The selling price must be positive' | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move that on top of the class. It seems a bit lost here, I would put it after or before the fields but, before any functions.
| if not float_is_zero(record.selling_price, precision_digits=2): | ||
| if float_compare(record.selling_price, record.expected_price * 0.9, precision_digits=2) < 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why two conditions ? I think it could be merged into one.
| for record in self: | ||
| if not float_is_zero(record.selling_price, precision_digits=2): | ||
| if float_compare(record.selling_price, record.expected_price * 0.9, precision_digits=2) < 0: | ||
| raise ValidationError('The selling price must be atleast 90% of the expected price! You must reduce the expected price to accept the offer') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget about the double quotes here 😄
|
|
||
| class PropertyTag(models.Model): | ||
| _name = 'estate.property.tag' | ||
| _description = 'Estate Property Tag' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here this can be double quotes
|
|
||
| _check_price = models.Constraint( | ||
| 'CHECK(price > 0)', | ||
| 'The offer price must be strictly positive' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here this can also be double quotes.

Initialized Estate module and created 'estate_property' model.