Conversation
make basic setup
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
some fields should not be required
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
| @@ -0,0 +1 @@ | |||
| from . import estate_property No newline at end of file | |||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
You can check which files are missing the line on the PR
| @@ -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 | |||
There was a problem hiding this comment.
| 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.
There was a problem hiding this comment.
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.
|
|
||
|
|
||
| class EstateProperty(models.Model): | ||
| _name = 'estate_property' |
There was a problem hiding this comment.
For technical names we separate words with .
| _name = 'estate_property' | |
| _name = 'estate.property' |
| @@ -0,0 +1,9 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
There was a problem hiding this comment.
No need to have this line for xml files
| <?xml version="1.0" encoding="utf-8" ?> |
| garden = fields.Boolean() | ||
| garden_area = fields.Integer() | ||
| garden_orientation = fields.Selection( | ||
| selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')] |
There was a problem hiding this comment.
| 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.
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
make naming consistent
allow the system to store offers on a property, in preparation to be able to really sell
e291eec to
a2c494c
Compare
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
| _description = 'Estate Property' | ||
|
|
||
| name = fields.Char(required=True) | ||
| name = fields.Char('Title', required=True) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
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.
| [('new', 'New'), ('offer', 'Offer Received'), ('accepted', 'Offer Accepted'), ('sold', 'Sold'), ('canceled', 'Cancelled')], | ||
| default='new' | ||
| ) | ||
| property_type_id = fields.Many2one('estate.property.type', 'Property Type') |
There was a problem hiding this comment.
No need to add the string here, the default string for property_type_id is already Property Type
| 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) |
There was a problem hiding this comment.
| 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
There was a problem hiding this comment.
indeed this is one word, is there a way to not loose data when renaming a field?
There was a problem hiding this comment.
Yes there is, you can check:
https://www.odoo.com/documentation/18.0/developer/reference/upgrades/upgrade_scripts.html
For this specific case:
https://www.odoo.com/documentation/18.0/developer/reference/upgrades/upgrade_utils.html#odoo.upgrade.util.fields.rename_field
No need for now, but do it if you find it interesting
| ) | ||
| 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) |
There was a problem hiding this comment.
| buyer_id = fields.Many2one('res.partner', 'Buyer', copy=False) | |
| buyer_id = fields.Many2one('res.partner, copy=False) |
| <odoo> | ||
|
|
||
| <record id="estate_property_view_search_name" model="ir.ui.view"> | ||
| <field name="name">estate.property.list</field> |
There was a problem hiding this comment.
| <field name="name">estate.property.list</field> | |
| <field name="name">estate.property.view.search</field> |
| <field name="living_area"/> | ||
| <field name="facades"/> | ||
| <field name="property_type_id"/> | ||
| <filter name="available" domain="['|',('state','=','new'),('state','=','offer')]"/> |
There was a problem hiding this comment.
| <filter name="available" domain="['|',('state','=','new'),('state','=','offer')]"/> | |
| <filter name="available" domain="[('state', 'in', ['new', 'offer'])]"/> |
| </record> | ||
|
|
||
| <record id="estate_property_view_form" model="ir.ui.view"> | ||
| <field name="name">estate.property.list</field> |
There was a problem hiding this comment.
| <field name="name">estate.property.list</field> | |
| <field name="name">estate.property.view.form</field> |
| "views/estate_property_views.xml", | ||
| "views/estate_property_offer_views.xml", | ||
| "views/estate_menus.xml", | ||
| 'security/ir.model.access.csv', |
There was a problem hiding this comment.
We usually put the security files on the top, since what they define can be used in the views but not the opposite
|
|
||
| class EstatePropertyTag(models.Model): | ||
| _name = 'estate.property.tag' | ||
| _description = 'Tags for properties' |
There was a problem hiding this comment.
| _description = 'Tags for properties' | |
| _description = 'Estate Property Tag' |
follow coding guidelines
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 to follow coding guidelines
make sure offers can be deleted, but only if you know what you do
follow coding rules
improve readability
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


No description provided.