-
Notifications
You must be signed in to change notification settings - Fork 2.8k
19.0 tutorial dhvag #1110
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?
19.0 tutorial dhvag #1110
Conversation
- Set up the estate module based on the Odoo 19 Server Framework 101 tutorial - Added estate.property model with proper naming conventions - Implemented basic fields as introduced in chapters 1–3 - Kept the code aligned with Odoo ORM standards
- Continued the estate module implementation by completing Chapters 4–6 - Added and configured views, actions, and menus to make the estate.property model fully accessible from the UI - Implemented list and form, views, filter, group-by - Added required defaults and the active field - Verified that all earlier checkpoints (Chapters 1–3) are still satisfied and working as expected - Overall implementation remains consistent with Odoo ORM guidelines and framework best practices
…er 7) - Added relational fields (Many2one, One2many, Many2many) to the estate module - Linked properties with types, offers, tags, buyer, and salesperson - Created required views for managing offers within the property form - Updated access rights for new models
- Fixed the import issue in estate_property_offer file.
mash-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 @dhvag-odoo,
Good work on the new module..
Please check my comments and apply the needed changes
- Applied the changes suggested during code review - Updated XML view structure and corrected attribute order - Cleaned up naming issues in views and filters - Adjusted default values and selection field keys - Removed unnecessary field strings in the model - Added new line in the file ir.model.access.csv
- This chapter introduces computed fields to derive values automatically. - Field dependencies are managed using the @api.depends decorator. - Onchange methods react to user input in real time on forms.
- Added accept and refuse actions for property offers - Handled the case where only one offer should be accepted - Updated property details like selling price and buyer when an offer is accepted - Learn to add python and SQL constraint
mash-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,
Good job on the PR!
Here are some few suggestions..
- Improve the look and behavior of form and list views. - Add status bar, decorations, and widgets for better clarity. - Control button visibility based on record state. - Set default sorting and make views more user-friendly. - Enhance search and display to make records easier to understand.
- Each request includes a title, cost, and status. - Validation added to ensure approved maintenance requests have a valid cost. - Total maintenance cost calculated. - Only done maintenance requests are to be sold.
mash-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!
Good work on the task..
Here are some suggestions..
| def action_accept(self): | ||
| for record in self: | ||
| if record.property_id.state != 'offer_accepted': | ||
| record.status = 'accepted' | ||
| record.property_id.selling_price = record.price | ||
| record.property_id.buyer_ids = self.partner_id | ||
| record.property_id.state = 'offer_accepted' | ||
| else: | ||
| raise UserError('One offer has already been accepted') |
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 optimize this?
| access_estate_property_type,access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1 | ||
| access_estate_property_tag,access_estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1 | ||
| access_estate_property_offer,access_estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1 | ||
| access_estate_property_maintenance_requests,access_estate_property_maintenance_requests,model_estate_property_maintenance_requests,base.group_user,1,1,1,1 No newline at end of file |
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.
Add a line at the end of file
| <field name="name">estate.view.list</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <list decoration-success="state == 'offer_received' or state == 'offer_accepted'" decoration-bf="state == 'offer_accepted'" decoration-muted="state == '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.
Can we add decoration in form view?
| <field name="living_area" string="living_area" filter_domain="[('living_area', '>=', self)]"/> | ||
| <field name="facades"/> | ||
| <separator/> | ||
| <filter string="New / Offer Received" name="state" domain="['|',('state', '=', 'new'), ('state', '=', 'offer received')]"/> |
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.
What are required params in the filter? How to add a default filter?
| <field name="name">Properties</field> | ||
| <field name="res_model">estate.property</field> | ||
| <field name="view_mode">list,form</field> | ||
| <field name="context">{'search_default_best_price': 0, 'search_default_state': 0}</field> |
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.
What does this 0 value indicate here?
| <field name="arch" type="xml"> | ||
| <list> | ||
| <field name="name"/> | ||
| <field name="sequence" widget="handle"/> |
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.
What does this widget do?
| from odoo import api, fields, models | ||
|
|
||
|
|
||
| class EstatePropertyType(models.Model): |
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.
Follow this conventions while declaring fields, constraints, methods or CRUD operations.
| property_type_id = fields.Many2one( | ||
| 'estate.property.type', string="Property Type") | ||
| seller_ids = fields.Many2one( | ||
| 'res.users', string="Salesman", default=lambda self: self.env.user |
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.
What does this lambda function do?
| ) | ||
| property_type_id = fields.Many2one( | ||
| 'estate.property.type', string="Property Type") | ||
| seller_ids = fields.Many2one( |
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.
| seller_ids = fields.Many2one( | |
| seller_id = fields.Many2one( |
| <group> | ||
| <group> | ||
| <field name="tags_ids" widget="many2many_tags" options="{'color_field': 'color'}"/> | ||
| <field name='state'/> |
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.
I don't think this is required here anymore as you are already adding this field in header as a statusbar

No description provided.