-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[ADD] Estate: create a new module for real estate management #786
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: 18.0
Are you sure you want to change the base?
Conversation
@josv-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.
Hi @josv-odoo
Here are small improvements you can apply to your codebase to match development standards at Odoo
👍
estate/__manifest__.py
Outdated
@@ -0,0 +1,14 @@ | |||
{ | |||
'name': "Real estate", |
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.
'name': "Real estate", | |
'name': 'Real estate', |
Prefer using double quotes ("") for long strings, multiline or user inputs/displays.
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 | |||
access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1 |
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.
access_estate_property,access_estate_property,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 | |
Always newline character at the end of your files for UNIX compatibility.
<field name="name">Test action</field> | ||
<field name="res_model">test_model</field> | ||
<field name="view_mode">list,form</field> | ||
</record> |
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.
</record> | |
</record> | |
Same here.
5158389
to
6596273
Compare
6596273
to
e9d5840
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.
@josv-odoo
Please, don't push local config files (pyproject.toml
) as they are not part of the project.
Small changes required.
👍
estate/models/estate_property.py
Outdated
from odoo import fields, models | ||
|
||
|
||
class TestModel(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.
Rename your model accordingly based on the module
Some interesting docs:
estate/models/estate_property.py
Outdated
_description = 'It allows to manage your properties' | ||
name = fields.Char(required=True, default='Unknown') |
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.
_description = 'It allows to manage your properties' | |
name = fields.Char(required=True, default='Unknown') | |
_description = 'It allows to manage your properties' | |
name = fields.Char(required=True, default='Unknown') |
There should be an empty space here to distinguish private attributes from fields
e3e2293
to
c55f8e7
Compare
0ce39ff
to
cdc392e
Compare
@josv-odoo ,
The title is nearly correct, one small change required though |
estate/.gitignore
Outdated
#Untracked files | ||
pyproject.toml |
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.
Please don't push your local configuration
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.
Don't forget this one please
<field name="arch" type="xml"> | ||
<search string="Search Estates"> | ||
<field name="name"/> | ||
<filter string="Available" name="available" domain="[('state', '!=', 'sold' ), ('state', '!=', 'cancelled'), ('state', '!=', 'offer_accepted')]"/> |
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.
Try using not in
…ate_property_? offer, tag and type\n create one2many, many2one and many2many fields
… Improve the aesthetics. . Security: prohibit: duplicate tags and negative prices Actions: added visuals for properties state, linked status of offer to state of properties, added action to accept/refuse offer, added action to sold/cancel properties. Aesthetics : Added color to tags, hidden sold/cancelled/accepted/refused button (properties view), added status as a status bar on top (properties view), added properties (in properties type view)
6efe63a
to
bc6fa2c
Compare
estate/.gitignore
Outdated
#Untracked files | ||
pyproject.toml |
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.
Don't forget this one please
if record.create_date: | ||
record.date_deadline = record.create_date + relativedelta(days=record.validity) | ||
else: | ||
record.date_deadline = fields.Date.today() + relativedelta(days=record.validity) |
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.
Probably a better way to do using or
estate/models/estate_property.py
Outdated
def action_property_sold(self): | ||
for record in self: | ||
if record.state == 'cancelled': | ||
raise exceptions.UserError('property already cancelled') |
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.
Import your exceptions for an easier future use
estate/models/estate_property.py
Outdated
def action_property_cancelled(self): | ||
for record in self: | ||
if record.state == 'sold': | ||
raise exceptions.UserError('property already sold') |
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.
raise exceptions.UserError('property already sold') | |
raise UserError(self.env._('property already sold')) |
As Séna would say:
In Odoo, translatable strings in "data"-type content are automatically exported for translation. However, other user-facing strings, Odoo cannot automatically know whether they are translatable. To ensure these strings are exported for translation, you need to explicitly mark them. This is achieved by wrapping the literal string with the self.env._() function. The _() function signals to Odoo's translation system that the string should be included in the translation catalog.
More info here: https://www.odoo.com/documentation/18.0/developer/howtos/translations.html#explicit-exports
You can check this line here:
https://github.com/odoo/odoo/blob/05cff3b7d866f6bc95c4b32f343ae14a4da946f2/addons/account/models/account_move.py#L2075
…removed gitignore
…ype. -Added smart button on property type form view. -Added a variable to estate.property.offer and estate.property.type -Added a field offer_count to improve readability of the smart button (number of offers availables)
Kanban: - new kanban record in the xml and add kanban as standard view Link with invoicing: New module called estate_account - model called estate_sold_inherited that inherit from account to implement on "action_property_sold" (when a property is marked as sold) to create an invoice with the following lines: * property price * commission for the sale of property * Administrative fees
- move estate.estate_property_type_offer_action - checkStyle: super(class,self) -> super() - erase '_' at the end of compute function
Creation of module estate
Create Access file
Create Model for module