-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[ADD] estate: started the server framework,completed the coding guidelines, setup guide, and chapter 1 #1265
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: 19.0
Are you sure you want to change the base?
Changes from all commits
c3e4f07
2fa05e2
5fe1cb8
5c8fc3a
d321a38
b42866e
0aa7d15
134ae19
6500c28
cd5b099
8c5215d
9996f6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| from . import models | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "name": "real estate", | ||
| "version": "1.0", | ||
| "summary": "Estate management", | ||
| "description": "Estate management", | ||
| "author": "Odoo S.A.", | ||
| "category": "tutorials", | ||
| "depends": ["base"], | ||
| "data": [ | ||
| "security/ir.model.access.csv", | ||
| "views/estate_property_views.xml", | ||
| "views/estate_property_type_views.xml", | ||
| "views/estate_property_tag_views.xml", | ||
| "views/estate_menus.xml" | ||
| ], | ||
| "license": "LGPL-3", | ||
| "application": True, | ||
| "installable": True | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| from . import estate_property | ||
| from . import estate_property_type | ||
| from . import estate_property_tag | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| from dateutil.relativedelta import relativedelta | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstateProperty(models.Model): | ||
| _name = "estate.property" | ||
| _description = "Real Estate Property" | ||
|
|
||
| name = fields.Char(required=True) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be one line empty before the field declaration. |
||
| description = fields.Text() | ||
| postcode = fields.Char() | ||
| date_availability = fields.Date( | ||
| default=lambda self: ( | ||
| # Without lambda, date would be fixed permanently | ||
| fields.Date.today() + relativedelta(months=3) | ||
| ) | ||
| ) | ||
| expected_price = fields.Float() | ||
| selling_price = fields.Float(readonly=True, copy=False) | ||
| bedrooms = fields.Integer(default=2) | ||
| living_area = fields.Integer() | ||
| facades = fields.Integer() | ||
| garage = fields.Boolean() | ||
| garden = fields.Boolean() | ||
| garden_area = fields.Integer() | ||
| garden_orientation = fields.Selection( | ||
| [ | ||
| ('north', 'North'), | ||
| ('south', 'South'), | ||
| ('east', 'East'), | ||
| ('west', 'West'), | ||
| ] | ||
| ) | ||
| active = fields.Boolean(default=True) | ||
| state = fields.Selection( | ||
| [ | ||
| ('new', 'New'), | ||
| ('offer_received', 'Offer Received'), | ||
| ('offer_accepted', 'Offer Accepted'), | ||
| ('sold', 'Sold'), | ||
| ('canceled', 'Canceled'), | ||
| ], | ||
| required=True, | ||
| copy=False, | ||
| default='new' | ||
| ) | ||
| buyer_id = fields.Many2one( | ||
| "res.partner", | ||
| string="Buyer", | ||
| copy=False, | ||
| ) | ||
| salesperson_id = fields.Many2one( | ||
| "res.users", | ||
| string="salesperson", | ||
| default=lambda self: self.env.user, | ||
| ) | ||
| property_type_id = fields.Many2one( | ||
| "estate.property.type", | ||
| string="Property Type", | ||
| ) | ||
| tag_ids = fields.Many2many( | ||
| "estate.property.tag", | ||
| string="Tags", | ||
| ) | ||
| # def test_tags(self): | ||
| # breakpoint() | ||
|
|
||
| # for tag in self.tag_ids: | ||
| # print(tag.name) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from odoo import fields, models | ||
|
|
||
| class EstatePropertyTag(models.Model): | ||
| _name = "estate.property.tag" | ||
| _description = "Property Tags" | ||
|
|
||
| name = fields.Char(required=True) | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstatePropertyType(models.Model): | ||
| _name = "estate.property.type" | ||
| _description = "Property Types" | ||
|
|
||
| name = fields.Char(required=True) | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
| 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 | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <odoo> | ||
| <!-- Main App Menu --> | ||
| <menuitem | ||
| id="estate_menu_root" | ||
| name="Real Estate" | ||
| /> | ||
| <!--First | ||
| Level Menu--> | ||
| <menuitem | ||
| id="estate_property_menu" | ||
| name="Advertisement" | ||
| parent="estate_menu_root" | ||
| /> | ||
| <!--Action | ||
| Menu--> | ||
| <menuitem | ||
| id="estate_property_action_menu" | ||
| name="Property List" | ||
| parent="estate_property_menu" | ||
| action="estate_property_action" | ||
| /> | ||
| <!--Action | ||
| Menu--> | ||
| <menuitem | ||
| id="estate_property_type_menu" | ||
| name="Settings" | ||
| parent="estate_menu_root" | ||
| /> | ||
| <!--Action | ||
| Menu--> | ||
| <menuitem | ||
| id="estate_property_type_list_menu" | ||
| name="Property Type" | ||
| parent="estate_property_type_menu" | ||
| action="estate_property_type_action" | ||
| /> | ||
| <menuitem | ||
| id="estate_property_tag_menu" | ||
| name="Property Tags" | ||
| parent="estate_property_type_menu" | ||
| action="estate_property_tag_action" | ||
| /> | ||
| </odoo> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be one empty line at the end of the file. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <odoo> | ||
|
|
||
| <record id="estate_property_tag_view_list" model="ir.ui.view"> | ||
| <field name="name">estate.property.tag.view.list</field> | ||
| <field name="model">estate.property.tag</field> | ||
| <field name="arch" type="xml"> | ||
| <list> | ||
| <field name="name" /> | ||
| </list> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_tag_view_form" model="ir.ui.view"> | ||
| <field name="name">estate.property.tag.view.form</field> | ||
| <field name="model">estate.property.tag</field> | ||
| <field name="arch" type="xml"> | ||
| <form> | ||
| <sheet> | ||
| <group> | ||
| <field name="name" /> | ||
| </group> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_tag_action" model="ir.actions.act_window"> | ||
| <field name="name">Property Tags</field> | ||
| <field name="res_model">estate.property.tag</field> | ||
| <field name="view_mode">list,form</field> | ||
| </record> | ||
|
|
||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <odoo> | ||
| <!--ACTION--> | ||
| <record id="estate_property_type_action" model="ir.actions.act_window"> | ||
| <field name="name">Property Types</field> | ||
| <field name="res_model">estate.property.type</field> | ||
| <field name="view_mode">list,form</field> | ||
| </record> | ||
| </odoo> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be one empty line at the end of the file. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| <odoo> | ||
| <!--List View--> | ||
| <record id="estate_property_list_view" model="ir.ui.view"> | ||
| <field name="name">estate.property.list</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <list string="Properties" delete="False"> | ||
| <field name="name" /> | ||
| <field name="postcode" /> | ||
| <field name="bedrooms" /> | ||
| <field name="living_area" /> | ||
| <field name="expected_price" /> | ||
| <field name="selling_price" /> | ||
| <field name="date_availability" /> | ||
| <field name="property_type_id" /> | ||
| <field name="tag_ids" widget="many2many_tags" /> | ||
| </list> | ||
| </field> | ||
| </record> | ||
| <!--Form | ||
| View--> | ||
| <record id="estate_property_form_view" model="ir.ui.view"> | ||
| <field name="name">estate.property.form</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Properties"> | ||
| <sheet> | ||
| <div> | ||
| <h1> | ||
| <field name="name" /> | ||
| </h1> | ||
| <group> | ||
| <field name="tag_ids" widget="many2many_tags" /> | ||
| </group> | ||
| </div> | ||
|
|
||
| <group> | ||
| <group> | ||
| <field name="property_type_id" /> | ||
| <field name="postcode" /> | ||
| <field name="expected_price" /> | ||
| </group> | ||
|
|
||
| <group> | ||
| <field name="date_availability" /> | ||
| <field name="selling_price" /> | ||
| </group> | ||
| </group> | ||
|
|
||
| <notebook> | ||
| <page string="Description"> | ||
| <group> | ||
| <field name="description" /> | ||
| <field name="bedrooms" /> | ||
| <field name="living_area" /> | ||
| <field name="facades" /> | ||
| <field name="garage" /> | ||
| <field name="garden" /> | ||
| <field name="garden_area" /> | ||
| <field name="garden_orientation" /> | ||
| <field name="active" /> | ||
| <field name="state" /> | ||
| </group> | ||
| </page> | ||
|
|
||
| <page string="Other Info"> | ||
| <group> | ||
| <field name="buyer_id" /> | ||
| <field name="salesperson_id" /> | ||
| </group> | ||
| </page> | ||
| </notebook> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <!--Search | ||
| View--> | ||
| <record id="estate_property_search_view" model="ir.ui.view"> | ||
| <field name="name">estate.property.search</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <search> | ||
| <field name="name" string="xyz" /> | ||
| <field name="postcode" /> | ||
| <field name="expected_price" /> | ||
| <field name="bedrooms" /> | ||
| <field name="living_area" /> | ||
| <field name="facades" /> | ||
| <filter string="Available" name="state" | ||
| domain="['|',('state','=','new'),('state','=','offer_received')]" /> | ||
| <filter string="Postcode" name="postcode" context="{'group_by':'postcode'}" /> | ||
| </search> | ||
| </field> | ||
| </record> | ||
|
|
||
| <!--ACTION--> | ||
| <record id="estate_property_action" model="ir.actions.act_window"> | ||
| <field name="name">Properties</field> | ||
| <field name="res_model">estate.property</field> | ||
| <field name="view_mode">list,form</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.
Can you please follwe the import coding guidelines?
https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#imports