-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[ADD] estate: created a new module 'estate' #791
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: 18.0
Are you sure you want to change the base?
Conversation
This is an exercise on the tutorial "Server Framework 101: Chapter 2" The commit introduces the bare minimum files for creating a new odoo module: - __init__.py (empty for now) - __manifest__.py
The model includes the needed fields for a property: address, expected price, number of bedrooms, etc. This is an exercise on the tutorial "Server Framework 101: Chapter 3"
Gave "read" access to all users of the database. This is an exercise on the tutorial "Server Framework 101: Chapter 4"
Gave "write" and "create" access to all users of the database, to allow users to edit & create new records. Created a new "ir.actions.act_window" action, that's associated with two views: list and form. Created a menu item that triggers the action. This is an exercise on the tutorial "Server Framework 101: Chapter 4"
Created basic list, form & search views for the estate module. For the search view, a filter on availability, and a group by option on postcode have been added. This is an exercise on the tutorial "Server Framework 101: Chapter 6"
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.
Thanks for your work 🌟
Just small nitpicking
estate/models/estate_property.py
Outdated
@@ -0,0 +1,32 @@ | |||
from odoo import fields, models |
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 file is missing newline at the end
estate/models/estate_property.py
Outdated
state = fields.Selection(string='Property State', selection=[('new', 'New'), | ||
('offer_received', 'Offer Received'), | ||
('offer_accepted', 'Offer Accepted'), | ||
('sold', 'Sold'), ('cancelled', 'Cancelled')], | ||
default='new', required=True, copy=False) |
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.
Look for the state
field and how the selection
fields are formatted in the code base
estate/security/ir.model.access.csv
Outdated
@@ -0,0 +1,2 @@ | |||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | |||
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,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.
As you are at the same module you do not need the estate.
@@ -0,0 +1,7 @@ | |||
<odoo> |
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.
make sure that all xmlids follow this https://www.odoo.com/documentation/18.0/contributing/development/coding_guidelines.html#security-view-and-action
Defined the relation between the different models and the `estate.property` model using relation fields. Created basic views for the new models. Applied some necessary refactoring to fulfill the requests made by the PR reviewer. This is an exercise on the tutorial "Server Framework 101: Chapter 7"
The added computed fields for the `property` model are: - best_price: highest amount offered for the property. - total_area: sum of `living_area` and `garden_area` The added computed fields for the `offer` model: - deadline: sum of `create_date` and `validity_days` Also added an "inverse" to the deadline field to update the validity when the deadline is edited, according to the create_date. Updated the respective views to display the newly added fields. This is an exercise on the tutorial "Server Framework 101: Chapter 8"
New: - Properties' state can now be set to `Sold` or 'Cancelled' using newly added UI buttons. - Offers can now be accepted or refused with two added buttons within the list view of offers. - property state changes accordingly with offer(s) changes; for example: when an offer is made to a `new` property, it's state is set to 'offer_recieved'. - UI feedback for when the user attempts to cancel an already `sold` property, or vice versa. - Deleting properties with existing linked offers is now possible. Updated the respective views to display the newly added buttons. This is an exercise on the tutorial "Server Framework 101: Chapter 9"
Added constraints: - A property expected price must be strictly positive - A property selling price must be >= 0 - An offer price must be strictly positive - A property tag name and property type name must be unique - the selling price cannot be lower than 90% of the expected price. This is an exercise on the tutorial "Server Framework 101: Chapter 10"
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.
looking good so far 🌟
you can remove the comment whenever it is not needed.
estate/models/estate_property_tag.py
Outdated
# DB Constraints | ||
_sql_constraints = [ | ||
("check_tag_name_is_unique", "UNIQUE(name)", "This tag name already exists!"), | ||
] |
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.
do not forget the line in the EOF
<sheet> | ||
<div> | ||
<group> | ||
<!-- <field name="name"/>--> |
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.
if no need delete
<field name="arch" type="xml"> | ||
<form string="estate_property_tag_form"> | ||
<sheet> | ||
<div> |
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.
no need for the div
New: - Properties that belong to a property type are displayed as a list on that Type form view. - The state of the property is now displayed using a `statusbar` widget. - Add default orderings: = properties are ordered desc based on their ids. = offers are ordered desc based on the amount (`price`). = tags are ordered asc based on the `name` field. = types can be reordered manually by the user, from the ui. - SOLD & CANCEL Buttons disappear when the property is sold or cancelled. - property tags can be edited from within the list views, and can have custom colors. - garden area and orientation become invisible in the estate.property form view when the garden option is not checked. - 'Accept' button disappears for accepted offers. Similarly, 'Refuse' button disappears for refused offers. - When the property state is ‘Offer Accepted’, ‘Sold’ or ‘Cancelled’, adding an offer from the UI won't be possible. - Added color decorations to the property and offer list views: = Properties with an offer received are green = Properties with an offer accepted are green and bold = Properties sold are muted = Refused offers are red = Accepted offers are green - The properties will be filtered by default on current availability. - Searching on the living area will return results where the area is larger than the input. - Added a stat smart button (stat button) on the property type form view, showing the number of all offers made towards properties belonging to that type. When the stat button is clicked, the user is redirected to a list view with those offers. This is an exercise on the tutorial "Server Framework 101: Chapter 11"
New: - Prevented the deletion of a property if its state is not ‘New’ or ‘Cancelled’. - At offer creation, set the property state to ‘Offer Received’. Also raise an error if the user tries to create an offer with a lower amount than an existing offer. - Extended the res.users model and views to include and display the sold properties by that user, if any. - Extended the res.partner model and views to include and display the properties bought by that partner. This is an exercise on the tutorial "Server Framework 101: Chapter 12"
New: - Whenever a property is sold, an invoice would be created, associated with the accepted offer: = the invoice partner is the same as the offer's partner (the buyer). = the invoice consists of two lines: 1) 6% of the offer amount. 2) an additional 100.00 from administrative fees This is an exercise on the tutorial "Server Framework 101: Chapter 13"
New: - Now you can check the invoices created related to some property, using a stat button within the form view of the estate property mode. Note that you need the estate_account module to be installed.
New: - A simple kanban view that groups properties into columns according to their type. - The kanban cards show the name, expected price, best price, selling price and tags of the property. = the best price is only displayed when an offer is received, while the selling price is only displayed when an offer is accepted. This is an exercise on the tutorial "Server framework 101: Chapter 14"
- Polished the code to respect the coding guidelines. - Corrected the order of views within the menifest of the 'estate' module. This is an exercise on the tutorial "Server Framework 101: Chapter 15"
84fde99
to
b3830f1
Compare
This is an exercise on the tutorial "Server Framework 101: Chapter 2"
The commit introduces the bare minimum files for creating a new odoo module: