-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: 17.0
Are you sure you want to change the base?
Conversation
- 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
dcc8928
to
647a1ee
Compare
…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
34a9a66
to
67f2f9f
Compare
…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
eac3c23
to
4c0ce8f
Compare
…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
4c0ce8f
to
090fd5b
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 @amya-odoo
I have added some comments and a couple of suggestions.
Can you give it a try?
Thanks!!
estate/models/estate_property.py
Outdated
from odoo import models, fields, api | ||
from dateutil.relativedelta import relativedelta | ||
from datetime import date |
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 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> |
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.
Need a blank line at the EOF
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 |
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.
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 |
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 |
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.
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 = [ |
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 define SQL constraints just after field definition
<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> |
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.
<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
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 |
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.
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.
21c63a7
to
7ddf520
Compare
- Created the controller in estate - Add pagination - Add redirect of property detail view - Covered the controller section
7ddf520
to
50bb5db
Compare
…nager - Implemented the Wizard to add Offer on multiple properties - Created Agent and Manger - Implemented the Access Right to Agent and Manager
c41eaf3
to
6dd52ac
Compare
- 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
6512b53
to
997a934
Compare
- Add controller for patients, history - Add web template - Design UI - Add demo data - Add static files
2d08a9e
to
cb04219
Compare
- Personal form view from controller - Medical History form view from controller - Dental history list view on click open form view
cb04219
to
a688159
Compare
- Add setting section for installment - Add wizard for Add EMI - Add Button for document module redirect
d63733f
to
bb55acf
Compare
- 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
9d2dfa9
to
ababe7f
Compare
- 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.
488c552
to
f863581
Compare
Training adding the estate module