-
Couldn't load subscription status.
- Fork 2.6k
QUCOL Onboarding #993
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?
QUCOL Onboarding #993
Conversation
46fe336 to
5cda5fe
Compare
ad8ec7f to
3a01b0f
Compare
3a01b0f to
a14ca42
Compare
a29a9bb to
5563be0
Compare
9951f58 to
42d5841
Compare
d0a617c to
0cf2ff3
Compare
eff89b1 to
2faaaee
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.
Hi @qucol-odoo 👋,
Here is a review of your code. You went through the tutorials without much difficulty so I've been a little bit more touchy on your PR 😃.
Your branch is very clean! And we're not going to dirty it. Then can you do the corrections in the right commits ? In the end, your branch shouldn't contain new commit. If you meet some issue doing it, ping me 😃.
Thanks for your job and for helping your teammates!
estate/models/__init__.py
Outdated
| from . import estate_properties | ||
| from . import estate_property_types | ||
| from . import estate_property_tags | ||
| from . import estate_property_offers |
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.
They should be listed alphabetically.
estate/models/estate_property.py
Outdated
| DEFAULT_GARDEN_AREA = 10 | ||
| DEFAULT_GARDEN_ORIENTATION = "north" | ||
|
|
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.
That's the right way to write constants but I am not sure to understand why it is required. They are used only in _update_garden_area_and_orientation, can they be defined directly in that method?
| selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')] | ||
| ) | ||
| total_living_area = fields.Integer(compute="_compute_total_area") | ||
|
|
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 of that blank line 😃.
estate/models/estate_properties.py
Outdated
| record.total_living_area = record.living_area + record.garden_area | ||
|
|
||
| @api.depends("offer_ids") | ||
| def _get_highest_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.
As this method is used to compute the best_price, it should be named _compute_best_offer 😃, that way we know easily 1. it computes field and 2 which field.
FYI, _get or get methods should return an object and should not modify the database. For example, _get_res_user should only return a res_user and do nothing else.
| record.best_offer = max(record.offer_ids.mapped("price")) if record.offer_ids else 0 | ||
|
|
||
| @api.onchange("garden") | ||
| def _update_garden_area_and_orientation(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.
Same here.
| <field name="arch" type="xml"> | ||
| <form string="Property type"> | ||
| <sheet> | ||
| <button name="%(estate.estate_property_offer_action)d" string="Offers" type="action" title="Offers list" invisible="not offer_count > 0"/> |
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.
| <button name="%(estate.estate_property_offer_action)d" string="Offers" type="action" title="Offers list" invisible="not offer_count > 0"/> | |
| <button name="%(estate.estate_property_offer_action)d" string="Offers" type="action" title="Offers list" invisible="offer_count == 0"/> |
| <field name="name"/> | ||
| </h1> | ||
| <group> | ||
| <field name="offer_count"/> |
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.
Maybe you can test to add it inside your oe_stat_button ? (not a priority). You can find a solution here (line 847)
| @@ -0,0 +1,21 @@ | |||
| <odoo> | |||
| <record id="estate_res_user_view_form" model="ir.ui.view"> | |||
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.
You can call it as its parent. Other modules will refer to this one as estate.res_user_view_form. So here we know that the main form of the user has been modified and this is not a new one.
| <record id="estate_res_user_view_form" model="ir.ui.view"> | |
| <record id="res_user_view_form" model="ir.ui.view"> |
estate/__manifest__.py
Outdated
| ], | ||
| 'data': [ | ||
| 'security/ir.model.access.csv', | ||
|
|
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 of this blank line. Do not forget that a lot of developers are working on the project and we must avoid unnecessary changes.
| taken_ids = set() | ||
| for invoice in self.env["account.move"].search([]): | ||
| if (match := re.match(r"Invoice\s+(\d+)", invoice.name)): | ||
| taken_ids.add(int(match.group(1))) | ||
| i = 1 | ||
| while i in taken_ids: | ||
| i += 1 | ||
| return f"Invoice {i}" |
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 you want to select the first number missing in the sequence or the one above the maximum ?
If it is the last case, I would do something like that to avoid too many loops.
| taken_ids = set() | |
| for invoice in self.env["account.move"].search([]): | |
| if (match := re.match(r"Invoice\s+(\d+)", invoice.name)): | |
| taken_ids.add(int(match.group(1))) | |
| i = 1 | |
| while i in taken_ids: | |
| i += 1 | |
| return f"Invoice {i}" | |
| invoice = self.env["account.move"].search([("name", "like", "Invoice %")], order='id desc', limit=1) | |
| if invoice and (match := re.match(r"Invoice (\d+)", invoice.name)): | |
| return f"Invoice {match.group(1)}" | |
| return "Invoice 1" |
807bbc0 to
1255d29
Compare
1229223 to
327b3f5
Compare

No description provided.