[ADD] estate: create initial module structure and manifest - #1416
mawat-odoo wants to merge 10 commits into
Conversation
Initialize the estate module with its basic directory structure and manifest file as required for the technical onboarding training. task-6573564
2e4eb5e to
55b2599
Compare
msho-odoo
left a comment
There was a problem hiding this comment.
nice job on the commit message format
I left you a comment, feel free to ping me here when yo push for the next improvement in the chapters 🔥
| @@ -1,3 +1,9 @@ | |||
| # Created by https://www.toptal.com/developers/gitignore/api/python,odoo | |||
There was a problem hiding this comment.
ops, I shouldn't see that file :)
Environmental files (usually starts with .) shouldn't be pushed or seen here, you might have a quick search on how to avoid this :)
c8728d7 to
f34bcf9
Compare
- Create models package and __init__.py files - Define estate.property model with basic fields: * name, description, postcode * date_availability, expected_price, selling_price * bedrooms, living_area, facades, garage * garden, garden_area, garden_orientation task-6573564
cd8d2d9 to
06d81bc
Compare
- Add security/ir.model.access.csv with full permissions for internal users - Declare security file in __manifest__.py task-6573564
669949c to
97a5918
Compare
…elds - Create estate_property_views.xml with act_window for estate.property model - Create estate_menus.xml with 3-level menu hierarchy - Register XML files sequentially in __manifest__.py - Set selling_price as readonly and non-copyable - Prevent copy on date_availability and set default to 3 months from today - Set default bedrooms to 2 - Add reserved active field (Boolean) with default=True - Add required state field (Selection: New, Offer Received, Offer Accepted, Sold, Cancelled) with default='new' and copy=False task-6573564
97a5918 to
32a2e25
Compare
Task ID: 6573564
Add list, form, and search views for estate.property model. Search view includes custom filter for available properties and grouping by postcode. - Add list view for property model - Add form view with sheet, group, and notebook tags - Add search view with domain filter and group_by context Task ID: 6573564
f83d668 to
74647bf
Compare
|
@msho-odoo some stuffs to review when you have time:) thank you! |
msho-odoo
left a comment
There was a problem hiding this comment.
Thank you for the good work (and the green runbot :))
Regarding the commit message, we only use [ADD] tag when adding a brand new module but adding fields, views, logic, etc is considered an improvement so we use [IMP] tag.
I also left you a couple of comments to address,
please ping me when you finish the next chapter 😉
Thanks!
| @@ -0,0 +1,34 @@ | |||
| from odoo.tools import date_utils | |||
|
|
|||
There was a problem hiding this comment.
nitpick: you can delete that empty line
| name = fields.Char(required=True) | ||
| description = fields.Text() | ||
| postcode = fields.Char() | ||
| date_availability = fields.Date(copy=False, default=lambda self: date_utils.add(fields.Date.today(), months=3)) |
There was a problem hiding this comment.
you can import the add directly from odoo.tools.date_utils and use it instead of importing the whole thing
| garage = fields.Boolean() | ||
| garden = fields.Boolean() |
There was a problem hiding this comment.
it's better to have boolean fields named is_something or has_something so may call these has_garden and has_garage and then you can give them UI names using the string attribute or just put a string as the first parameter in Boolean()
| garden_orientation = fields.Selection( | ||
| string='Type', | ||
| selection=[('North', 'North'), ('South', 'South'), ('East', 'East'), ('West', 'West')] | ||
| ) |
There was a problem hiding this comment.
Having the selection list in one line is okay but when we have such multiple values we style it like this.
Also it's better to have the keys of the selection tuples to be all lower case letters to avoid confusion when used later in the code.
| garden_orientation = fields.Selection( | |
| string='Type', | |
| selection=[('North', 'North'), ('South', 'South'), ('East', 'East'), ('West', 'West')] | |
| ) | |
| garden_orientation = fields.Selection( | |
| string='Garden Orientation', | |
| selection=[ | |
| ('north', 'North'), | |
| ('south', 'South'), | |
| ('east', 'East'), | |
| ('west', 'West') | |
| ] | |
| ) |
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
| <menuitem id="estate_menu_root" name="Real Estate"> | ||
| <menuitem id="estatre_first_level_menu" name="Advertisements"> |
There was a problem hiding this comment.
ids better be descriptive so other coders know what it mostly does by name only
| <filter name="state" string="Available Properties" domain="['|', | ||
| ('state', '=', 'new'), | ||
| ('state', '=', 'offer_received')]"/> |
There was a problem hiding this comment.
correct but this is more readable :)
| <filter name="state" string="Available Properties" domain="['|', | |
| ('state', '=', 'new'), | |
| ('state', '=', 'offer_received')]"/> | |
| <filter name="state" string="Available Properties" domain="[('state', 'in', ('new', 'offer_received'))]"/> |
| <group> | ||
| <field name="description"/> | ||
| <field name="bedrooms"/> | ||
| <field name="living_area" string="Living Area (sqm)"/> |
There was a problem hiding this comment.
You can add the string attribute to the field definition in the python model, that way you wouldn't need to repeat it every time you use the field in a view (unless you want it different in a certain view)
| @@ -0,0 +1,13 @@ | |||
| # __manifest__.py | |||
| { # noqa: B018 | |||
| "author": "mawat", | |||
| @@ -1,129 +0,0 @@ | |||
| # Byte-compiled / optimized / DLL files | |||
There was a problem hiding this comment.
hmmm I still believe you should make this whole file disappear from the diff history.
Maybe get this file in a separate commit and then drop it using git rebase -i 🤔
Consider it a git challenge on how to remove a file from your git commit diff :)
Add estate.property.type, estate.property.tag, and estate.property.offer models along with their actions and views to handle property classification and offers. - Create estate.property.type model with menu, action, and views - Create estate.property.tag model with action and list/form views - Create estate.property.offer model with list and form views - Add Many2one links (property_type_id, buyer_id, user_id) to estate.property - Add Many2many link (tag_ids) to estate.property - Add One2many link (offer_ids) to estate.property Task ID: 6573564
Address code review comments by improving field definitions, using lowercase selection keys, simplifying domains, and fixing PEP 8 blank line rules (E302). - Fix E302 missing blank lines before class declarations - Remove unused empty line and refine date_utils import in estate_property.py - Convert selection keys to lowercase for garden_orientation - Simplify domain filter syntax using in operator in estate_property_views.xml - Move field string labels to Python definitions - Fix typo in menu identifier estate_first_level_menu - Change manifest author to Odoo S.A. Task ID: 6573564
88dd0a3 to
0f630ff
Compare
Restore .gitignore to its initial branch state to eliminate unneeded changes from the PR diff history. Task ID: 6573564
0f630ff to
d4dd647
Compare

Initialize the estate module with its basic directory structure and manifest file as required for the technical onboarding training.
task-6573564