-
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 #224
base: 18.0
Are you sure you want to change the base?
Conversation
For learning purposes, I added an Estate module to the app, which includes views and models for managing new properties, property types, tags, and offers.
…ethods. For learning purpose, tried implementing computed fields, Dependencies.. Also created button of type object and learned difference of private and public methods.
For learning purposes, tried to implement different types of methods & buttons. Learned different ways to manipulating views by using widgets, attributes & more
Learned different types of Inheritance in Odoo including Model & View Inheritance and then further implemented it. Created estate_account module to link invoicing to invoice sold properties. For learning purposes, Implemented kanban view and related changes.
Completed chapters of Server framework 101 for learning purposes, also tried to follow coding guidelines. Implemented adding demo data.
For learning purposes, completed Build PDF reports. Implemented templates and also template inheritance.
Changes made in a way to restrict unauthorized access to property data, limits agent interaction with property types and tags, and uses security bypasses for selling property.
For learning purpose, added wizard for making offer for selected multiple properties and also handling case where offers can not be applied to all properties which will show error in notification and skip adding offers to properties generating errors.
Added controllers for estate module to view available properties on the website in grid format. Clicking on the property opens detailed view of the property.
Added images to demo data for card view of properties on the website. configured menu item named properties in the navbar.
3b3e869
to
055f4d5
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 @dija-odoo
Some comments/suggestions
Thanks
estate/controllers/main.py
Outdated
def properties(self, page=1): | ||
items_per_page = 6 | ||
Property = request.env['estate.property'] | ||
total_properties = Property.search_count([ |
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 need to use sudo for public user here.
estate/models/estate_property.py
Outdated
selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], | ||
string='Garden Orientation') | ||
active=fields.Boolean(default=True) | ||
# last_seen = fields.Datetime("Last Seen", default=fields.Datetime.now) |
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.
avoid pushing commented code
estate/models/estate_property.py
Outdated
def print_quotation(self): | ||
return self.env.ref('estate.action_report_estate_property_sold').report_action(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.
we can remove this one as we are printing reports from action menu
estate/models/estate_property.py
Outdated
'view_mode': 'form', | ||
'res_model': 'estate.property.make.bulk.offer', | ||
'context': { | ||
'default_property_id': 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.
we can get the selected properties using self.context.get('active_ids') so there is no need for passing the context explicitly here.
estate/security/security.xml
Outdated
<field name="model_id" ref="estate.model_estate_property"/> | ||
<field name="perm_read" eval="True"/> | ||
<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> |
estate/models/estate_property.py
Outdated
for record in self: | ||
if record.status_button != 'sold': | ||
record.status_button='cancelled' | ||
record.state='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.
same here as above
return True | ||
|
||
|
||
def cross_refuse(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.
def cross_refuse(self): | |
def action_refuse(self): |
Same for above
_name = 'estate.property.make.bulk.offer' | ||
_description = 'Make Bulf Offer for Properties at once' | ||
|
||
property_id = fields.Many2many('estate.property', string='Property', required=True, ondelete="cascade") |
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.
no need for this field when we use the active_ids from context
def make_offers(self): | ||
property_failed = [] | ||
for property in self.property_id: | ||
try: | ||
self.env['estate.property.offer'].create({ | ||
'price': self.price, | ||
'property_id': property.id, | ||
'partner_id': self.partner_id.id, | ||
'validity': self.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.
adapt here also with new implementation using active_ids
estate/models/estate_property.py
Outdated
from datetime import datetime | ||
from odoo import models,fields,api,_ | ||
from dateutil.relativedelta import relativedelta | ||
from odoo.exceptions import UserError |
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 datetime import datetime | |
from odoo import models,fields,api,_ | |
from dateutil.relativedelta import relativedelta | |
from odoo.exceptions import UserError | |
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
Create a real estate module module for training purpose