Skip to content
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

Draft
wants to merge 11 commits into
base: 18.0
Choose a base branch
from

Conversation

dija-odoo
Copy link

Create a real estate module module for training purpose

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.
@robodoo
Copy link

robodoo commented Jan 17, 2025

Pull request status dashboard

Added images to demo data for card view of properties on the
website. configured menu item named properties in the navbar.
Copy link

@adsh-odoo adsh-odoo left a 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

def properties(self, page=1):
items_per_page = 6
Property = request.env['estate.property']
total_properties = Property.search_count([

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.

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid pushing commented code

Comment on lines 122 to 123
def print_quotation(self):
return self.env.ref('estate.action_report_estate_property_sold').report_action(self)

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

'view_mode': 'form',
'res_model': 'estate.property.make.bulk.offer',
'context': {
'default_property_id': self.ids,

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.

<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>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="domain_force">[]</field>
<field name="domain_force">[(1, '=', 1)]</field>

Comment on lines 113 to 116
for record in self:
if record.status_button != 'sold':
record.status_button='cancelled'
record.state='cancelled'

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):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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")

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

Comment on lines 13 to 22
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
})

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

Comment on lines 1 to 4
from datetime import datetime
from odoo import models,fields,api,_
from dateutil.relativedelta import relativedelta
from odoo.exceptions import UserError

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants