[ADD] estate: initialize estate module#1333
Conversation
Add the basic module structure and manifest file for the estate application.
Define the 'estate.property' model. - Add basic fields: name, description, postcode, date_availability, expected_price, selling_price, bedrooms, living_area, facades, garage, garden, garden_area, and garden_orientation. - Set 'name' and 'expected_price' as required fields. - Initialize the models package and set up imports.
- Create ir.model.access.csv in security folder - Grant read, write, create, and unlink permissions to base.group_user - Register security file in __manifest__.py - Fix manifest warnings by adding author and license keys
- Add tree (list), form, and search views for 'estate.property' in views/estate_property_views.xml. - Configure action 'action_estate_property' to load 'list,form,kanban' views and default filter 'available'. - Define advertisements menu structure in views/estate_menus.xml. - Clean up hardcoded field column widths from the list view in views/estate_property_views.xml to use standard auto-sizing layout.
| @@ -0,0 +1,29 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <odoo> | |||
| <data> | |||
There was a problem hiding this comment.
The <data> tag was not needed because we were not using attributes like noupdate="1". So, I removed the unnecessary tags from the security and view files and kept only the root tag.
|
|
||
| <record id="module_category_real_estate" model="ir.module.category"> | ||
| <field name="name">Real Estate</field> | ||
| <field name="sequence">10</field> |
There was a problem hiding this comment.
What's the purpose of this sequence field?
There was a problem hiding this comment.
The sequence field decides the order of the categories. A smaller number shows the category first.
| <field name="name">Properties</field> | ||
| <field name="res_model">estate.property</field> | ||
| <field name="view_mode">list,form,kanban</field> | ||
| <field name="context">{'search_default_available': 1}</field> |
There was a problem hiding this comment.
What's the difference between domain and context?
There was a problem hiding this comment.
-Domain is used to filter records at the database level (like a SQL WHERE clause). It decides "which" records to display.
-Context is used to pass information to the view, such as grouping records (like {'group_by': 'postcode'} ) or setting default values for new records.
| <field name="living_area" /> | ||
| <field name="facades" /> | ||
| <separator /> | ||
| <filter name="available" string="Available" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]" /> |
There was a problem hiding this comment.
Yes, I have optimized it to:
domain= [('state', 'in', ('new', 'offer_received'))]
It is better because it is much easier to read and makes it simple to add more states in the future.
| <field name="bedrooms" /> | ||
| <field name="living_area" /> | ||
| <field name="facades" /> | ||
| <separator /> |
There was a problem hiding this comment.
The tag shows a vertical line between filters in the UI.
Logically, it joins filters with an AND operator instead of OR,
I have practiced this in our search view (estate_property_view_search) by using to split the State filters and Feature filters (Garage/Garden).
| </field> | ||
| </record> | ||
|
|
||
| <record id="view_estate_property_form" model="ir.ui.view"> |
There was a problem hiding this comment.
Follow this for naming your views
| <record id="view_estate_property_form" model="ir.ui.view"> | |
| <record id="estate_property_view_form" model="ir.ui.view"> |
<model_name>_view_<view_type>, where view_type is kanban, form, list, search,...
There was a problem hiding this comment.
Done. I have renamed all view IDs to follow the <model_name>view<view_type> format (e.g., estate_property_view_form).
| "name": "Real Estate", | ||
| "author": "Odoo S.A.", | ||
| "license": "LGPL-3", | ||
| "depends": ["base"], |
There was a problem hiding this comment.
If we don't write base, Odoo will still load it automatically. However, writing it explicitly is a best practice to make the module dependency clear.
mash-odoo
left a comment
There was a problem hiding this comment.
Hello!
Good start on the task..
Here are a few comments...Have a look!
Introduce the property tag (estate.property.tag) and property offer (estate.property.offer) models, establishing relationship fields. - Add estate.property.tag model with basic views. - Add Many2many field tag_ids to estate.property. - Add estate.property.offer model with form and list views. - Add One2many field offer_ids to estate.property. - Add security access rules (ACLs) for both new models task-7
Address the code styling, domain filters, and manifest configurations requested in the code review. Additionally, set up demo data for the property, type, and tag models.

Add the basic module structure and manifest file for the estate application.