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: create estate.property model and initial views #107

Draft
wants to merge 21 commits into
base: 17.0
Choose a base branch
from

Conversation

amya-odoo
Copy link

Training adding the estate module

- Added `estate.property` model
- Created initial views for the model
- Added menus under Advertisement -> Property
- Covered content up to Chapter 5
- Created tree ,form  and search in estate module
- Created to show the smiling_face when property record data not found on
  default search
- Covered content up to Chapter 6
…r, tag

- Done mapping Many2one between estate_property to estate_property_type.
- Done mapping Many2many between estate_property to
  estate_property_tag
- Done mapping One2Many between estate_property to estate_property_offer
- Also their views and menu
- Covered content up to Chapter 7
@amya-odoo amya-odoo force-pushed the 17.0-training-amya branch 5 times, most recently from dcc8928 to 647a1ee Compare August 6, 2024 10:56
…onstraint

- Create Best Offer field with computed
- Create the Offer date with Validation date
- Create sold, canceled, accepted, refused button
- Create validation warning on negative number
- Add SQL constraint
- Covered from chapter 8 to 10
@amya-odoo amya-odoo force-pushed the 17.0-training-amya branch 4 times, most recently from 34a9a66 to 67f2f9f Compare August 12, 2024 12:15
…use button

- Add inline view and make editable
- Add sequence and widget
- Add conditional button on Offer and State
- Add invisible, optional, editable filled
- Add related fields in model property_type_id
- Add Offer view from property_type
- Covered chapter 11
@amya-odoo amya-odoo force-pushed the 17.0-training-amya branch 2 times, most recently from eac3c23 to 4c0ce8f Compare August 14, 2024 05:17
…unt module

- Add ondelete decorator in models and override the models method
- Created the res_user_model and inherit the res.users
- Add new module estate_account
- Create the invoice on action of property sold from estate_account to invoice
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 @amya-odoo

I have added some comments and a couple of suggestions.
Can you give it a try?

Thanks!!

Comment on lines 1 to 3
from odoo import models, fields, api
from dateutil.relativedelta import relativedelta
from datetime import date

Choose a reason for hiding this comment

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

Suggested change
from odoo import models, fields, api
from dateutil.relativedelta import relativedelta
from datetime import date
from datetime import date
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models

Generally, we first import external libraries and then we import from odoo. And also take care for the imports in alphabetical order.

</tree>
</field>
</record>
</odoo>

Choose a reason for hiding this comment

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

Need a blank line at the EOF

Comment on lines 44 to 49
if record.deadline:
today = fields.Date.to_date(record.create_date)
deadline_date = fields.Date.from_string(record.deadline)
record.validity = (deadline_date - today).days
else:
record.validity = 7

Choose a reason for hiding this comment

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

Suggested change
if record.deadline:
today = fields.Date.to_date(record.create_date)
deadline_date = fields.Date.from_string(record.deadline)
record.validity = (deadline_date - today).days
else:
record.validity = 7
record.validity = (record.deadline - record.property_id.create_date.date()).days

Comment on lines 32 to 40
today = record.create_date
if today:
today = record.create_date
else:
today = date.today()
if record.validity:
record.deadline = today + timedelta(days=record.validity)
else:
record.deadline = today

Choose a reason for hiding this comment

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

Suggested change
today = record.create_date
if today:
today = record.create_date
else:
today = date.today()
if record.validity:
record.deadline = today + timedelta(days=record.validity)
else:
record.deadline = today
record.deadline = record.property_id.create_date + relativedelta(
days=record.validity
)

Can you give it a try but make sure to check all the cases

else:
self.status = "refused"

_sql_constraints = [

Choose a reason for hiding this comment

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

Generally we define SQL constraints just after field definition

Comment on lines +28 to +33
<button type="action" name="%(estate.action_estate_property_offer_y)d" string="Offers" class="oe_stat_button" icon="fa-ticket">
<div class="o_stat_info">
<field name="offer_count" widget="statinfo" string=""/>
<span class="o_stat_text"> Offer</span>
</div>
</button>

Choose a reason for hiding this comment

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

Suggested change
<button type="action" name="%(estate.action_estate_property_offer_y)d" string="Offers" class="oe_stat_button" icon="fa-ticket">
<div class="o_stat_info">
<field name="offer_count" widget="statinfo" string=""/>
<span class="o_stat_text"> Offer</span>
</div>
</button>
<div name="button_box">
<button class="oe_stat_button" type="action" name="%(estate.action_estate_property_offer)d"
icon="fa-ticket">
<field string="Offers" name="offer_count" widget="statinfo"/>
</button>
</div>

We can do something like this to well format the stat button

Comment on lines 76 to 90
property_id = vals.get('property_id')
price = vals.get('price', 0)
if not property_id:
raise ValidationError("Property ID is required.")
property_record = self.env['estate.property'].browse(property_id)
existing_offers = self.search([('property_id', '=', property_id)])
max_price = max(existing_offers.mapped('price'), default=0)
if price < max_price:
raise UserError("The offer price must be higher than the existing offers.")
record = super().create(vals)
if property_record:
property_record.state = 'offer_recived'
else:
raise ValidationError("Property record could not be found.")
return record

Choose a reason for hiding this comment

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

Suggested change
property_id = vals.get('property_id')
price = vals.get('price', 0)
if not property_id:
raise ValidationError("Property ID is required.")
property_record = self.env['estate.property'].browse(property_id)
existing_offers = self.search([('property_id', '=', property_id)])
max_price = max(existing_offers.mapped('price'), default=0)
if price < max_price:
raise UserError("The offer price must be higher than the existing offers.")
record = super().create(vals)
if property_record:
property_record.state = 'offer_recived'
else:
raise ValidationError("Property record could not be found.")
return record
property_record = self.env["estate.property"].browse(vals.get("property_id"))
property_record.state = "offer_recived"
if property_record.offer_ids.filtered(lambda o: o.price >= vals.get("price")):
raise UserError(
"The offer price must be higher than the existing offers."
)
return super().create(vals)

We can do something like this

- Make interaction between other  model account
- Add demo data of property
- Covered chapter 13 and Demo data module
- Implemented a property offers PDF report using QWeb templates.
- Created estate_property_templates.xml to define the report template for
- displaying property offers.
- Added estate_property_reports.xml for the ir.actions.report to include the
  report in the module's business logic.
- Enhanced the report by adding logic to conditionally handle cases with no
  offers using t-if and t-else.
- Introduced a sub-template to separate the table portion of the offers,
  promoting code reuse.
- Created a new report for res.users to list all the Real Estate Properties
  for a salesperson, including property offers.
- Extended the property report in the estate_account module to include
  invoice information for sold properties using QWeb inheritance.
@amya-odoo amya-odoo force-pushed the 17.0-training-amya branch 5 times, most recently from 21c63a7 to 7ddf520 Compare August 27, 2024 05:03
- Created the controller in estate
- Add pagination
- Add redirect of property detail view
- Covered the controller section
…nager

- Implemented the Wizard to add Offer on multiple properties
- Created Agent and Manger
- Implemented the Access Right to Agent and Manager
- Added new module make meeting
- created a new meeting function to add event to calendar
- Created models
- Created required views
- Create ir.model.access.csv file
- ADD the models Tags
- ADD views Tags
- ADD the report
- ADD the invoice
- Visible on Website
- Add controller for patients, history
- Add web template
- Design UI
- Add demo data
- Add static files
@amya-odoo amya-odoo force-pushed the 17.0-training-amya branch 2 times, most recently from 2d08a9e to cb04219 Compare September 10, 2024 07:20
- Personal form view from controller
- Medical History form view from controller
- Dental history list view on click open form view
- Add setting section for installment
- Add wizard for Add EMI
- Add Button for document module redirect
- Implemented the invoice schedule when exceed the delay process day
- Implemented the Document Upload  request smart button
- Implemented document upload wizard
- Modifies the new invoice creation
- Add warranty wizard
- Add warranty check box
- Add warranty config in setting
- Add warranty config tree view editable
- Implement the on delete on sale order line to delete the product then delete
  the warranty product also.
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.

2 participants