Skip to content

tutorial joemo#1241

Open
djoewie wants to merge 57 commits intoodoo:19.0from
odoo-dev:19.0-tutorial-joemo
Open

tutorial joemo#1241
djoewie wants to merge 57 commits intoodoo:19.0from
odoo-dev:19.0-tutorial-joemo

Conversation

@djoewie
Copy link
Copy Markdown

@djoewie djoewie commented Apr 21, 2026

No description provided.

djoewie added 9 commits April 21, 2026 14:02
convert module in application
make it possible to store properties in the database
make it easier to understand what the estate property means
make sure the basic information can be stored in the estate property
make sure that data is only accessible for the predefined usergroup
making it possible to have a view the model of property
make it possible to see the properties in the userinterface
@robodoo
Copy link
Copy Markdown

robodoo commented Apr 21, 2026

Pull request status dashboard

@djoewie djoewie requested a review from cgun-odoo April 21, 2026 14:22
Comment thread estate/models/__init__.py Outdated
@@ -0,0 +1 @@
from . import estate_property No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to have an empty line at the end of every file. This will be automatic if you use a formatter like Ruff

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can check which files are missing the line on the PR

Comment thread estate/security/ir.model.access.csv Outdated
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1 No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1
access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1

You don't need to start with the module name here as that will be done automatically.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important thing to notice: You need to keep 'base' in base.group_user because it's a different module. But if you just write model_estate_property odoo knows to look for that in the estate module.

Comment thread estate/models/estate_property.py Outdated


class EstateProperty(models.Model):
_name = 'estate_property'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For technical names we separate words with .

Suggested change
_name = 'estate_property'
_name = 'estate.property'

https://www.odoo.com/documentation/18.0/contributing/development/coding_guidelines.html#symbols-and-conventions

Comment thread estate/views/estate_menus.xml Outdated
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to have this line for xml files

Suggested change
<?xml version="1.0" encoding="utf-8" ?>

Comment thread estate/models/estate_property.py Outdated
garden = fields.Boolean()
garden_area = fields.Integer()
garden_orientation = fields.Selection(
selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')]
[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')]

The first positional argument is already 'selection' so it's redundant to have it.

djoewie added 17 commits April 21, 2026 16:46
keep code inline with the python standard
change the labels so the labes in the UI stay inline with the wireframe
improve consistency with rest of the codebase
make sure property specific information is not copied
reducing work by filling in fields op properties with sensible default values
reducing work by filling in fields op properties with sensible default values
when creating new properties they should not be archived immediately
making sure the current state of a property can be properly represented
making it possible to view more information in the list view
make the detail view of a property more appealing
improve the possible options for searching
improve the options for searching properties by having defaults
make it possible to distinguish between multiple types of properties
keep track of who bought the property and the salesperson
adding an option to some custom tag to buildings so you don't need to search for important information about the building
allow the system to store offers on a property, in preparation to be able to really sell
@djoewie djoewie force-pushed the 19.0-tutorial-joemo branch from e291eec to a2c494c Compare April 22, 2026 13:35
djoewie added 2 commits April 22, 2026 17:27
make sure an offer is not valid for an infinite amount of time
help users when garden is selected to fill in some details and remove them if no garden is there
Copy link
Copy Markdown

@cgun-odoo cgun-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job 👍 You can check the runbot, you're getting a warning

Image

Comment thread estate/models/estate_property.py Outdated
_description = 'Estate Property'

name = fields.Char(required=True)
name = fields.Char('Title', required=True)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For strings, as far as I know in R&D they put user facing strings in double quotes and technical strings in single quotes. In PS-Tech we put everything in double quotes.
Again something that will easily be fixed with a formatter configuration

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a formatter configuration I can start from, because now I use the formatter of pycharm by default.
I forgot to enable it for the first couple of commits.

Comment thread estate/models/estate_property.py Outdated
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date()
date_availability = fields.Date('Available From', default=fields.Date.today() + relativedelta(months=3), copy=False)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you're passing a value as default. This value will be calculated once when you run the server.
However, what you want to do is to pass a function, so that the value is calculated every time the default value is needed.

Comment thread estate/models/estate_property.py Outdated
[('new', 'New'), ('offer', 'Offer Received'), ('accepted', 'Offer Accepted'), ('sold', 'Sold'), ('canceled', 'Cancelled')],
default='new'
)
property_type_id = fields.Many2one('estate.property.type', 'Property Type')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add the string here, the default string for property_type_id is already Property Type

Comment thread estate/models/estate_property.py Outdated
default='new'
)
property_type_id = fields.Many2one('estate.property.type', 'Property Type')
sales_person_id = fields.Many2one('res.users', "Salesman", copy=False, default=lambda self: self.env.user)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sales_person_id = fields.Many2one('res.users', "Salesman", copy=False, default=lambda self: self.env.user)
salesperson_id = fields.Many2one('res.users', copy=False, default=lambda self: self.env.user)

salesperson is one word i guess, not super sure

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed this is one word, is there a way to not loose data when renaming a field?

Copy link
Copy Markdown

@cgun-odoo cgun-odoo Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread estate/models/estate_property.py Outdated
)
property_type_id = fields.Many2one('estate.property.type', 'Property Type')
sales_person_id = fields.Many2one('res.users', "Salesman", copy=False, default=lambda self: self.env.user)
buyer_id = fields.Many2one('res.partner', 'Buyer', copy=False)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
buyer_id = fields.Many2one('res.partner', 'Buyer', copy=False)
buyer_id = fields.Many2one('res.partner, copy=False)

Comment thread estate/views/estate_property_views.xml Outdated
<odoo>

<record id="estate_property_view_search_name" model="ir.ui.view">
<field name="name">estate.property.list</field>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="name">estate.property.list</field>
<field name="name">estate.property.view.search</field>

Comment thread estate/views/estate_property_views.xml Outdated
<field name="living_area"/>
<field name="facades"/>
<field name="property_type_id"/>
<filter name="available" domain="['|',('state','=','new'),('state','=','offer')]"/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<filter name="available" domain="['|',('state','=','new'),('state','=','offer')]"/>
<filter name="available" domain="[('state', 'in', ['new', 'offer'])]"/>

Comment thread estate/views/estate_property_views.xml Outdated
</record>

<record id="estate_property_view_form" model="ir.ui.view">
<field name="name">estate.property.list</field>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="name">estate.property.list</field>
<field name="name">estate.property.view.form</field>

Comment thread estate/__manifest__.py Outdated
"views/estate_property_views.xml",
"views/estate_property_offer_views.xml",
"views/estate_menus.xml",
'security/ir.model.access.csv',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually put the security files on the top, since what they define can be used in the views but not the opposite

Comment thread estate/models/estate_property_tag.py Outdated

class EstatePropertyTag(models.Model):
_name = 'estate.property.tag'
_description = 'Tags for properties'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_description = 'Tags for properties'
_description = 'Estate Property Tag'

djoewie added 27 commits April 23, 2026 09:47
follow coding guidelines
default availability needs to be calculated when creating the property, not at startup
make field in line with naming standaard
make sure transitions are set to reduce users making impossible actions
make sure the module is compliant with the testing tools
make sure the module is compliant with the coding style
the _description is used in technical locations so keep it useful for that environment over an explanation
make sure offers can be deleted, but only if you know what you do
the content of the security can be used in the views but not the opposite
follow style defined by team
make sure the id's are unique for security rules
make sure no invalid data or duplicate can be entered in the database
make sure the property can not be sold if it is not at least 90% of the expected price
make it possible to view a minimum of property information that is linked to one type of property
make the status visually appealing
making sure there is a logical default ordering for each model
make sure that it is possible to manually sort the properties
making sure property tags can be easily distinguished from each-other based on color
avoid accidentally creating new property types when creating or editing properties
help user by not showing buttons they can not use op properties
help user by disabling or hiding buttons or items they do not need
there is no need for detailed form_view if the data is limited and can easily be changed in the listview
improve usability by making fields optional if they are not adding value all the time
make the state visually appealing so less space is wasted on the screen and have a quick overview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants