-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[ADD] estate: add real estate module #221
base: 18.0
Are you sure you want to change the base?
Conversation
Added basic models for property, property type, property tags and property offer Also made basic views needed for proper representation of data. Right now all base user have access of data. Note: Right now all model views and records are there in single xml.
Finished chapter 7,8 and 9 with all features and exercise mentioned. Business Logic SQL constrains Validations
Finished chapter 10 and half 11 (Uptill Attributes and options) Added python constrains and UI improvements
upto chapter 11 and 12 half note: I am still not able to reference new field from inherited user model
finished chapter 12 inheritance is working fine we can see real estate properties assigned to salesperson in users tab.
removed unnecessory model access given on inherited model
Finished all chapters of server framework 101 added some of my own ideas in kanban view. and guess what it's looking good ;)
Added demo data in estate module, checked all possibilities of demo data. Only one problem i noticed is that we can not use the same database twice while working with demo data because it overwrites demo data every time so states of properties are jumbled.
Added pdf reports feature so that user can download pdf reports based on property or salesman. Finised build pdf reports module.
Fixed offer action button bug. I was unable to access Many2One fiend in view. So i made an related field in offer model to make sure accept and reject buttons are disappeared whenever property goes into offer_Accepted state.
Added ACL so that all users can not access all properties. Also restricted access of agents to see other agent's property. Also bypassed marking property sold by agents. (But only if current user has write access on estate property)
Added feature to view property based on company selected. Visibility of companies is limited to manager only. Agent can only see information in his/her company only. Also added wizard for creating bulk offer on selected properties.
Fixed bug while creating bulk offer when one of the property throws validation error. Also added properties on website through controller. Pagination is still remaining.
Corrected incorrectly working pager and property details page where user can see details of property whose state is new, offer_received or offer_accepted. Also users can not see archived properties. Finished all the python training given by our mentor.
5a0e7fa
to
9691a9b
Compare
9691a9b
to
13455c5
Compare
83553fd
to
28a21db
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.
Hello @nipl-odoo
Some comments/suggestions
I can also see some extra blank lines remove them also.
Thanks!!
estate/controllers/estate_website.py
Outdated
@http.route( | ||
["/properties", "/properties/page/<int:page>"], | ||
type="http", | ||
auth="user", |
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.
we can use auth="public" here
estate/models/estate_property.py
Outdated
"context": { | ||
"default_property_ids": self.ids, | ||
}, |
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.
it will not be needed we can get the selected property by self.env.context.get('active_ids')
_sql_constraints = [ | ||
("name_uniq", "unique(name)", "Type must be unique"), | ||
] |
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.
we write constraints after field definition
estate/security/estate_security.xml
Outdated
<field name="name">Estate Manager rules for all properties</field> | ||
<field name="model_id" ref="estate.model_estate_property"/> | ||
<field name="groups" eval="[Command.link(ref('estate.estate_group_manager'))]" /> | ||
<field name="domain_force">[]</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.
<field name="domain_force">[]</field> | |
<field name="domain_force">[(1, '=', 1)]</field> |
<h1> | ||
<field name="name" label="Property Name" placeholder="Property Name" /> | ||
</h1> | ||
<field name="image" widget="image" options="{'size': [150, 150]}"/> |
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.
Generally, we put the image in the right side of the sheet
estate_account/__manifest__.py
Outdated
"website": "https://www.odoo.com", | ||
"category": "Tutorials/Estate_Account", | ||
"version": "0.1", | ||
"application": True, |
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.
it's bridge module so we can remove the application true here.
_name = "estate.property.make.offer" | ||
_description = "Estate Property Make Offer Wizard" | ||
|
||
property_ids = fields.Many2many("estate.property", string="Properties") |
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.
I think there is no need to link this wizard with estate property
failed_properties = [] | ||
for property in self.property_ids: | ||
try: | ||
self.env["estate.property.offer"].create( | ||
{ | ||
"price": self.offer_price, | ||
"property_id": property.id, | ||
"partner_id": self.partner_id.id, | ||
"validity": self.offer_validity, | ||
} | ||
) | ||
except Exception: | ||
failed_properties.append(property.name) | ||
if failed_properties: | ||
return { | ||
"type": "ir.actions.client", | ||
"tag": "display_notification", | ||
"params": { | ||
"message": "Failed to create offers for the following properties: " | ||
+ ", ".join(failed_properties), | ||
"type": "danger", | ||
"next": {"type": "ir.actions.act_window_close"}, | ||
}, | ||
} |
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.
we can simplify this by taking the property_ids from context (from my previous comment) and creating offer directly inside them Let me know what you think.
Can you give it a try?
estate/models/estate_property.py
Outdated
from odoo import models, fields, api | ||
from odoo.exceptions import UserError | ||
from datetime import datetime | ||
from dateutil.relativedelta import relativedelta |
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.
from odoo import models, fields, api | |
from odoo.exceptions import UserError | |
from datetime import datetime | |
from dateutil.relativedelta import relativedelta | |
from datetime import datetime | |
from dateutil.relativedelta import relativedelta | |
from odoo import api, fields, models | |
from odoo.exceptions import UserError |
Generally we first make external imports and then we import from odoo in alphabetical order.
Need to adapt in all files
3bbd00a
to
1ad40ed
Compare
Refactored code according to common coding guidelines followed here.
1ad40ed
to
17d0010
Compare
Create real estate module for training purposes.