Conversation
| @@ -0,0 +1 @@ | |||
| from . import estate_property No newline at end of file | |||
There was a problem hiding this comment.
We try to always have an empty line at the end of every file.
You can use the Ruff extension with the config from https://runbot326.odoo.com/runbot/static/build/125365592-19-0/logs/ruff_config.txt to have warning about style inside your editor.
Disable auto formatting on save as we try to reduce the quantity of diff when editing file made by someone else
You can also check the ci/style from the runbot (https://runbot.odoo.com/runbot/bundle/190-technical-training-demat-512697) to check what it says.
|
|
||
| class TestModel(models.Model): |
There was a problem hiding this comment.
nitpick (check ci/ctyle) but before classes, 2 empty lines are asked
| class TestModel(models.Model): | |
| class TestModel(models.Model): |
| import datetime | ||
|
|
||
| class TestModel(models.Model): | ||
| _name = "estate_property_model" |
There was a problem hiding this comment.
We name models name.of.module.name.of.model.
| _name = "estate_property_model" | |
| _name = "estate.property" |
| garden_area = fields.Integer() | ||
| garden_orientation = fields.Selection([("north", "North"), ("south", "South"), ("west", "West"), ("east", "East")]) | ||
| active = fields.Boolean(default=True) | ||
| state = fields.Selection([("new", "New"), ("offer_received", "Offer Received"), ("offer_accepted", "Offer Accepted"), ("sold", "Sold"), ("cancelled", "Cancelled")], default="new") No newline at end of file |
There was a problem hiding this comment.
We try to keep line bellow ~120 characters. If you have using vs code you can add a rulers in the setting to have a line and visualize it.
| state = fields.Selection([("new", "New"), ("offer_received", "Offer Received"), ("offer_accepted", "Offer Accepted"), ("sold", "Sold"), ("cancelled", "Cancelled")], default="new") | |
| state = fields.Selection( | |
| selection=[ | |
| ("new", "New"), | |
| ("offer_received", "Offer Received"), | |
| ("offer_accepted", "Offer Accepted"), | |
| ("sold", "Sold"), | |
| ("cancelled", "Cancelled"), | |
| ], | |
| default="new", | |
| ) |
| name = fields.Char(default="Unknown", required=True) | ||
| description = fields.Text("Description of the Estate Propert Model") | ||
| postcode = fields.Char("Post code") | ||
| date_availability = fields.Date("Availability date", default=datetime.date.today() + datetime.timedelta(days=90), copy=False) |
There was a problem hiding this comment.
If not using lambda, datetime.date.today() will resolve when the server start, so if your server keept running for a few days, the date would be wrong.
Also for adding date it's best to use fields.Date.add instead of +
| date_availability = fields.Date("Availability date", default=datetime.date.today() + datetime.timedelta(days=90), copy=False) | |
| date_availability = fields.Date("Availability date", default=lambda self: datetime.date.today() + datetime.timedelta(days=90), copy=False) |
| @@ -0,0 +1,30 @@ | |||
| <odoo> | |||
| <menuitem id="test_menu_root" name="Real Estate"> | |||
There was a problem hiding this comment.
To prevent any issue it's best to prefix any view id with the name of the module
| <menuitem id="test_menu_root" name="Real Estate"> | |
| <menuitem id="estate_test_menu_root" name="Real Estate"> |
1345fd6 to
a2b4948
Compare
|
Hey 👋 I'll be managing your review now to spread the load among the 4 of us 😄 |

No description provided.