-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ADD] real_estate: init real estate addon #1065
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
ushyme
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.
Good work so far. Just a few remarks.
.vscode/settings.json
Outdated
| { | ||
| "cSpell.words": ["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.
| { | |
| "cSpell.words": ["odoo"] | |
| } |
This file should be removed. Editor-specific settings do not belong in the source code of an Odoo module.
estate/models/estate_property.py
Outdated
| description = fields.Text('Description') | ||
| active = fields.Boolean(default=True) | ||
| postcode = fields.Char('Postcode') | ||
| date_availability = fields.Date('Available From',default=lambda self: fields.Date.today() + timedelta(days=90), 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.
| date_availability = fields.Date('Available From',default=lambda self: fields.Date.today() + timedelta(days=90), copy=False) | |
| date_availability = fields.Date('Available From',default=lambda self: fields.Date.context_today(self) + timedelta(days=90), copy=False) |
Here, it's better to use fields.Date.context_today() for setting a default to the current date, because it correctly handles the user's timezones.
| <field name="view_mode">list,form</field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_taf_action" model="ir.actions.act_window"> |
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.
| <record id="estate_property_taf_action" model="ir.actions.act_window"> | |
| <record id="estate_property_tag_action" model="ir.actions.act_window"> |
This is just a small typo, but it means that the estate_property_tag_menu_action menu item that references this action is not working
estate/models/estate_property.py
Outdated
| garden = fields.Boolean('Garden') | ||
| garden_area = fields.Integer('Garden area') | ||
| garden_orientation = fields.Selection( | ||
| string='type', |
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 "type" ?
| <search string="Search Properties"> | ||
| <field name="name" string="Title" /> | ||
| <field name="postcode" string="Postcode" /> | ||
| <field name="expected_price" string="Postcode" /> |
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.
| <field name="expected_price" string="Postcode" /> | |
| <field name="expected_price" string="Expected Price" /> |
Small copy-paste error.
…rresponding views
…y and offer models
…tialization files
…relationships and views
5c091f1 to
c3b4579
Compare
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.
There are a few that could be improved.
- for the
cancelledstate, you are often comparing it with'canceled'(missingl). This typo makes lot of you logic incorrect. - a few files are missing a new line at the end
- the runbot is still red
estate/models/estate_property.py
Outdated
| @api.depends("create_date", "validity") | ||
| def _compute_date_deadline(self): | ||
| for record in self: | ||
| if record.create_date: | ||
| record.date_deadline = ( | ||
| record.create_date.date() + timedelta(days=record.validity) | ||
| ) | ||
| else: | ||
| record.date_deadline = fields.Date.context_today(self) |
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's the point of this ? Where is the validity field comming from ?
| @api.depends("create_date", "validity") | ||
| def _compute_date_deadline(self): | ||
| for record in self: | ||
| if record.create_date: | ||
| record.date_deadline = ( | ||
| record.create_date.date() | ||
| + timedelta(days=record.validity) | ||
| ) | ||
| else: | ||
| record.date_deadline = False | ||
|
|
||
| @api.depends("create_date", "validity") | ||
| def _compute_date_deadline(self): | ||
| for record in self: | ||
| if record.create_date: | ||
| record.date_deadline = ( | ||
| record.create_date.date() + timedelta(days=record.validity) | ||
| ) | ||
| else: | ||
| record.date_deadline = fields.Date.context_today(self) |
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'm guessing a small copy-paste mistake ?
| return True | ||
|
|
||
| @api.constrains("selling_price", "expected_price") | ||
| def _check_selling_price(self): |
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.
| def _check_selling_price(self): | |
| def _check_selling_price_value(self): |
you already used the name _check_selling_price for a constraint earlier. While this technically should work, it’s confusing for maintenance.
| <field name="garden" class="mb4" /> | ||
| <field name="garden" /> |
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 duplicate the fields ?
| <field name="garden" /> | ||
| <field name="garden_area" invisible="not garden" /> | ||
| <field name="garden_orientation" invisible="not garden" /> | ||
| <field name="garden_orientation" class="mb4" /> |
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 question here
| type="object" | ||
| icon="fa-check" | ||
| invisible="status" | ||
| title="action_accept_btn" |
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.
In Odoo, the title attribute on a button provides a tooltip. It is better to use a human-readable string like title="Accept Offer" so users know what the icon does when they hover over it.
This applies to all the other button title attributes in your code.
85a7703 to
73dbe79
Compare

No description provided.