-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[ADD] real_estate: create two module real estate and account #843
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
base: 18.0
Are you sure you want to change the base?
Conversation
From this Tutorial We learn How to create our application in odoo. In this Tutorial we create manifest.py file where stored app name and we define version, and also create init.py file where import will be stored. When we create our app then it will show in apps module in odoo localhost server. from apps we can download the app which we create. Active developer mode is must be required.
In this chapter,first we add security access rules for the basic model to manage user permissions. next we learn to give UI to our Application which we create in our first tutorial. we add some basic views and and form in our application, also we add custmize search in model.
In this tutorial we add four new models and create four-five pages like properties, tags, property type and so on.. also we learn how to manage UI for buttons and how to implement conditions using if-else statement. At the end we learn : How to implement business logic with condition checks and method decorators. How to create custom models and link them via relations (Many2one, One2many, Many2many).
…ty models In this tutorial we learn constrain and How to add sprinkles Constraints: This update adds SQL constraints for unique names on property types and tags, and a valid range check for color index. Python constraints enforce key business rules. UI Enhancements: This update introduces a computed field on property types and adds a stat button to view related offers using a domain filter. Form views are enhanced with notebooks and inline editing to improve user experience, and the navigation menu is updated to include access to property type and tag settings.
In this tutorial, we learn how to link two different modules, Python inheritance and view extensions in Odoo. It included customizing CRUD behavior (e.g., preventing deletion of non-new/cancelled properties) and adding fields to existing models like res.users, displaying them in views using XML xpath focuses on creating a link module named estate_account that depends on the estate and account modules. This module adds the functionality to automatically generate an invoice when a property is marked as ‘Sold’.
in this tutorial i get the error which related to odoo formate, like no space, extra blank space, also include unused files imported. I remove this types of errors from files...
in this tutorial I get error related to space so i fix that error.
f30155d
to
bd51e15
Compare
In this tutorial, Renamed model and view files to follow standard Odoo naming (<main_model>.py, <model>_views.xml, etc.). Updated class names to use CamelCase as per convention. Adjusted method names to match Odoo patterns e.g., _compute_, _check_, action_). Ensured XML IDs and view names follow Odoo's structured naming scheme. Cleaned up import orders and variable names for readability and consistency.
bd51e15
to
baf7908
Compare
{ | ||
"recommendations": [ | ||
"esbenp.prettier-vscode" | ||
] | ||
} |
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.
Please remove this.
This is not need here
@@ -0,0 +1 @@ | |||
from . import models |
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.
Missing Licensing statement
# 'data': [ | ||
# 'views/estate_property_views.xml', | ||
# ], |
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.
Remove this if not required
res = super().action_mark_sold() | ||
|
||
for record in self: | ||
if not record.buyer: | ||
raise UserError("Please set a Buyer before generating an invoice.") | ||
if not record.selling_price: | ||
raise UserError("Please set a Selling Price before generating an invoice.") | ||
|
||
journal = self.env['account.journal'].search([('type', '=', 'sale')], limit=1) | ||
if not journal: | ||
raise UserError("No sale journal found. Please configure at least one sale journal.") | ||
|
||
invoice_vals = { | ||
"partner_id": record.buyer.id, | ||
"move_type": "out_invoice", | ||
"journal_id": journal.id, | ||
"invoice_line_ids": [ | ||
Command.create({ | ||
"name": "6% Commission", | ||
"quantity": 1, | ||
"price_unit": 0.06 * record.selling_price, | ||
}), | ||
Command.create({ | ||
"name": "Administrative Fees", | ||
"quantity": 1, | ||
"price_unit": 100.0, | ||
}), | ||
] | ||
} | ||
|
||
self.env["account.move"].create(invoice_vals) | ||
|
||
return res |
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.
Do we need this search query in the for loop ?
'name': "estate", | ||
'version': '1.0', | ||
'depends': ['base'], | ||
'author': "Author Name", |
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.
Ensure you put a real author name
'version': '1.0', | ||
'depends': ['base'], | ||
'author': "Author Name", | ||
'category': 'Category', |
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.
Use a valid category
@@ -0,0 +1,5 @@ | |||
from . import estate |
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.
Missing licensing
@api.depends('living_area', 'garden_area') | ||
def _compute_total_area(self): | ||
for record in self: | ||
record.total_area = record.living_area + record.garden_area | ||
|
||
best_price = fields.Float( | ||
string="Best Offer", | ||
compute="_compute_best_price" | ||
) | ||
selling_price = fields.Float(copy=False) |
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.
The field definition should be before the compute function definitions
_sql_constraints = [ | ||
('unique_property_type_name', 'UNIQUE(name)', | ||
'Property type name 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.
Not the right place to define the sqlconstraints
access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1 | ||
access_estate_property_type,access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1 | ||
access_estate_property_tag,access_estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1 | ||
access_estate_property_offer,access_estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1 |
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.
End of file line is missing
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.
First pass ... 🚀 ,
This diff contains a lot of unwanted space /lines which is not required.
Please remove it.
Also, the PR title is not appropriate.
Previous we create application named Real estate. in this module we add offer, tag and type model and properties where show all properties which is created by user. also we add form to the property section and we create list or form view and use widget for status.
Also we implement CRUD logic for the tutorial purpose and we learn to create how to create invoices.
next we learn to link one module to another module and when we sold the property that will create invoice which show in second application which we linked.