-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
First and second chapter of the training #230
base: 18.0
Are you sure you want to change the base?
Conversation
estate/__manifest__.py
Outdated
'demo': [ | ||
'demo/demo_data.xml', | ||
], | ||
} |
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 generally (actually, pretty much always) want to leave an empty newline at the end of a file
…in the models folder, where all models will be.
…in the models folder, where all models will be.
4fa9c6b
to
0edf76f
Compare
…scription. Can't see the database.
estate/__manifest__.py
Outdated
'demo': [ | ||
'demo/demo_data.xml', | ||
], | ||
} |
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 install this extention: https://marketplace.visualstudio.com/items?itemName=riccardoNovaglia.missinglineendoffile
It does it automatically
…an underscore, which made the import useless. The security rule is now enabled and can be viewed in ir.model.access.csv in the security folder.
estate/data/estate.property.csv
Outdated
@@ -0,0 +1 @@ | |||
"id","name" |
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 don't need this file
estate/models/estate_property.py
Outdated
@@ -1,6 +1,6 @@ | |||
from odoo import models, fields | |||
|
|||
class EstateProperty(models.Model): | |||
class estate_property(models.Model): |
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.
class EstateProperty(models.Model):
Python files should be in Pascal Case
estate/__init__.py
Outdated
from . import models | ||
from . import security |
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.
Data files shouldn't be imported in the init.py
You only import folders that contain python files
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.
The commit title is the first line of the commit message.
then you should add a new line to write the commit description.
> Add a form view and a list view for the estate_property model. Also adds the action and some menu items. Refactors the model to add the needed attributes.
estate/__manifest__.py
Outdated
'data' : ['security/ir.model.access.csv', | ||
'views/estate_property_view.xml', | ||
'views/estate_menu.xml'], |
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.
the closing bracket should be on a separate line
|
||
|
||
|
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.
remove extra lines
estate/views/estate_menu.xml
Outdated
</menuitem> | ||
</menuitem> | ||
</data> | ||
</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.
add line at EOF
</record> | ||
</data> | ||
</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.
remove extra line
A custom form and list view has been added. A custom search for almost all fields is available. A custom filter to filter out certain states has been implemented as well as a group by option on the postcode.Various view ameliorations. Various upgrades aswell in concerning the previous PR returns.
These menu items can be used to give more informations about the estate properties that has to be sold. Doesn't work as there is a bug on the Offer part of the project
The structure of the XML files was not how it should have been. Some views were called before being declared thus resulting in a bug. The chapter 7 has been completed.
The computed fields added are used to know the total area of a property and the onchange field is used to change the garden area and orientation once the checkbox is checked. The best offer for a property is also added and it changes automatically when a new best offer is created
The actions added are buttons that can change the state of models when clicked. It can change a house to the cancelled or sold status. They can accept or reject an offer and change the corresponding values in the models, like the selling price or the buyer
There are SQL constraints to make sure that tags are unique, aswell as making sure that every prices for a property is strictly positive. There is also one Python constraint to make sure that the selling price for a property is never below 90% of the expected price of that same property.
@@ -62,3 +62,24 @@ def _onchange_garden(self): | |||
else: | |||
self.garden_area = 0 | |||
self.garden_orientation = False | |||
|
|||
def cancel_property(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.
Leave a newline betwixt method definitions
Add offers related to a type on the type form view. Add a property state as a widget on top of the form. Add an order to all models in the list view. Add a handle to change this order. Add colors for tags. Add invisible for some functionnalities if conditions are met. Add an offer as readonly on certain condition. The list view is now editable. Make date availability an optionnal in the list view. Add some decoration so it is clearer without needing to display the status. The available filter is enabled by default. Add a search domain on name and description. Add a stat button to get the number of offers related to a type. When clicked, the list view of only those offers is displayed.
@@ -16,6 +17,13 @@ class EstatePropertyOffer(models.Model): | |||
property_id = fields.Many2one("estate.property", required=True) | |||
validity = fields.Integer(name="Validity", default=7) | |||
date_deadline = fields.Date(name="Deadline", compute="_compute_deadline", inverse="_inverse_validity") | |||
#property_type_id = fields.Many2one("estate.property.types", name="Property 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.
remove
@@ -16,6 +17,13 @@ class EstatePropertyOffer(models.Model): | |||
property_id = fields.Many2one("estate.property", required=True) | |||
validity = fields.Integer(name="Validity", default=7) | |||
date_deadline = fields.Date(name="Deadline", compute="_compute_deadline", inverse="_inverse_validity") | |||
#property_type_id = fields.Many2one("estate.property.types", name="Property type") | |||
property_type_id = fields.Many2one( | |||
"estate.property.types", |
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 don't have to change it all at this point, but we prefer single quotes in python files unless using double is required for some semantic reasons
if isinstance(record.create_date, fields.Date): | ||
record.validity = (record.date_deadline - record.create_date).days | ||
if record.date_deadline: | ||
# Convert create_date to a date object if it exists |
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.
imo it doesn't need an explanation
@@ -22,6 +23,13 @@ | |||
<field name="view_mode">list,form</field> | |||
<field name="view_id" ref="view_estate_property_offer_list"/> | |||
</record> | |||
<record id="action_estate_property_offer_from_types" model="ir.actions.act_window"> | |||
<field name="name">OffersFromTypes</field> |
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 either make it regularly spaced, i.e., Offers from types
(or whatever the name)
or you can make it snake case offers_from_types
@@ -94,6 +96,7 @@ | |||
<field name="living_area" string="Living area (m²)"/> | |||
<field name="type_id" string="Property type"/> | |||
<filter name="available" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer received')]"/> | |||
<field name="description" string="Name and description" filter_domain="['|', ('name', 'ilike', self), ('description', 'ilike', 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.
You can check equality with strings, ilike
is really more for when you need wildcards/only know part of the string you are trying to match
Add a constraint on creating an offer so that the price can't be lower than the best price for that property. A warning remains in this. Add one on delete where the state can only be new or cancelled, otherwise the record won't be deleted. Extend the res.users model to add a field displaying the properties.
This is made to automatically create invoices once the house is sold. Doesn't work for now as the override of the sold_property function doesn't work.
Adds a kanban view for the estate properties, grouped by type and not draggable. The informations are not yet displayed on it.
The fields were not correctly formated and some didn't appear. They did not appear because the field state was not declared before the template so we couldn't access it's raw value.
You can interactive rebase ( |
The lingering warning has been fixed by replace the decorator on the create override method. The bug preventing the sold_property method on the new module to override the main one was caused by the model from the new module having a name. It has been fixed.
No description provided.