-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ADD] real_estate: init real estate addon #1065
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
7e844b7
f5d86c5
fe45480
ac62922
7ec5101
90cf058
580267f
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,3 @@ | ||
| { | ||
| "cSpell.words": ["odoo"] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import models |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| 'name': "Real Estate", | ||
| 'application': True, | ||
| 'installable': True, | ||
| 'depends': ['base'], | ||
| 'data': [ | ||
| 'security/ir.model.access.csv', | ||
| 'views/estate_property_views.xml', | ||
| 'views/estate_menus_views.xml', | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| 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,65 @@ | ||||||
| from odoo import fields, models | ||||||
| from datetime import timedelta | ||||||
|
|
||||||
|
|
||||||
| class EstateProperty(models.Model): | ||||||
| _name = "estate.property" | ||||||
| _description = "Estate property" | ||||||
|
|
||||||
| name = fields.Char('Name', required=True, default='My new house') | ||||||
| description = fields.Text('Description') | ||||||
| active = fields.Boolean(default=True) | ||||||
| postcode = fields.Char('Postcode') | ||||||
| date_availability = fields.Date('Available From',default=lambda self: fields.Date.today() + timedelta(days=90), copy=False) | ||||||
|
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.
Suggested change
Here, it's better to use |
||||||
| expected_price = fields.Float('Expected Price', required=True) | ||||||
| selling_price = fields.Float('Selling Price', readonly=True, copy=False) | ||||||
| bedrooms = fields.Integer('Bedrooms', default=2) | ||||||
| living_area = fields.Integer('Living Area (sqm)') | ||||||
| facades = fields.Integer('#Facades') | ||||||
| garage = fields.Boolean('Garage') | ||||||
| garden = fields.Boolean('Garden') | ||||||
| garden_area = fields.Integer('Garden area') | ||||||
| garden_orientation = fields.Selection( | ||||||
| string='type', | ||||||
|
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. why "type" ? |
||||||
| selection=[ | ||||||
| ('north', 'North'), | ||||||
| ('south', 'South'), | ||||||
| ('east', 'East'), | ||||||
| ('west', 'West') | ||||||
| ]) | ||||||
|
|
||||||
| state = fields.Selection( | ||||||
| [ | ||||||
| ('new', 'New'), | ||||||
| ('offer_received', 'Offer Received'), | ||||||
| ('offer_accepted', 'Offer Accepted'), | ||||||
| ('sold', 'Sold'), | ||||||
| ('cancelled', 'Cancelled'), | ||||||
| ], | ||||||
| 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" | ||||||
| ) | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from odoo import models, fields | ||
|
|
||
| class EstatePropertyTag(models.Model): | ||
| _name = "estate.property.tag" | ||
| _description = "Estate Property Tag" | ||
|
|
||
| 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 = "Estate property type" | ||
|
|
||
| name = fields.Char('Name', required=True) | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| 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,23 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <menuitem id="estate_menu_root" name="Estate"> | ||
| <menuitem id="estate_property_menu" name="Property"> | ||
| <menuitem | ||
| id="estate_property_menu_action" | ||
| action="estate_property_model_action" | ||
| /> | ||
| </menuitem> | ||
|
|
||
| <menuitem id="estate_property_type_menu" name="Settings"> | ||
| <menuitem | ||
| id="estate_property_type_menu_action" | ||
| action="estate_property_type_action" | ||
| /> | ||
| <menuitem | ||
| id="estate_property_tag_menu_action" | ||
| action="estate_property_tag_action" | ||
| /> | ||
| </menuitem> | ||
|
|
||
| </menuitem> | ||
| </odoo> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,146 @@ | ||||||
| <?xml version="1.0"?> | ||||||
| <odoo> | ||||||
| <record id="estate_property_model_action" model="ir.actions.act_window"> | ||||||
| <field name="name">Property</field> | ||||||
| <field name="res_model">estate.property</field> | ||||||
| <field name="view_mode">list,form</field> | ||||||
| </record> | ||||||
|
|
||||||
| <record id="estate_property_type_action" model="ir.actions.act_window"> | ||||||
| <field name="name">Settings</field> | ||||||
| <field name="res_model">estate.property.type</field> | ||||||
| <field name="view_mode">list,form</field> | ||||||
| </record> | ||||||
|
|
||||||
| <record id="estate_property_taf_action" model="ir.actions.act_window"> | ||||||
|
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.
Suggested change
This is just a small typo, but it means that the |
||||||
| <field name="name">Settings</field> | ||||||
| <field name="res_model">estate.property.type</field> | ||||||
| <field name="view_mode">list,form</field> | ||||||
| </record> | ||||||
|
|
||||||
| <record id="estate_property_view_tree" model="ir.ui.view"> | ||||||
| <field name="name">estate.property.list</field> | ||||||
| <field name="model">estate.property</field> | ||||||
| <field name="arch" type="xml"> | ||||||
| <list string="Title"> | ||||||
| <field name="name" /> | ||||||
| <field name="description" /> | ||||||
| <field name="bedrooms" /> | ||||||
| <field name="living_area" /> | ||||||
| <field name="expected_price" /> | ||||||
| <field name="selling_price" /> | ||||||
| <field name="date_availability" /> | ||||||
| </list> | ||||||
| </field> | ||||||
| </record> | ||||||
|
|
||||||
| <record id="estate_property_view_form" model="ir.ui.view"> | ||||||
| <field name="name">estate.property.form</field> | ||||||
| <field name="model">estate.property</field> | ||||||
| <field name="arch" type="xml"> | ||||||
| <form string="Estate Property"> | ||||||
| <sheet> | ||||||
| <div class="oe_title mb32"> | ||||||
| <h1> | ||||||
| <field name="name" class="mb16" /> | ||||||
| </h1> | ||||||
| </div> | ||||||
| <group class="d-flex justify-content-between"> | ||||||
| <group> | ||||||
| <field name="postcode" class="mb16" /> | ||||||
| </group> | ||||||
|
|
||||||
| <group> | ||||||
| <field name="expected_price" class="mb16" /> | ||||||
| </group> | ||||||
| </group> | ||||||
|
|
||||||
| <group class="d-flex justify-content-between mb32"> | ||||||
| <group> | ||||||
| <field name="date_availability" class="mb16" /> | ||||||
| </group> | ||||||
|
|
||||||
| <group> | ||||||
| <field name="selling_price" class="mb16" /> | ||||||
| </group> | ||||||
|
|
||||||
| <group> | ||||||
| <field name="tag_ids" widget="many2many_tags" /> | ||||||
| </group> | ||||||
|
|
||||||
| <group> | ||||||
| <field name="tag_ids" widget="many2many_tags" /> | ||||||
| </group> | ||||||
|
Comment on lines
+67
to
+73
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. why render the |
||||||
| </group> | ||||||
|
|
||||||
| <notebook> | ||||||
| <page string="Description"> | ||||||
| <group class="d-flex flex-column"> | ||||||
| <group> | ||||||
| <field name="description" class="mb4" /> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="bedrooms" class="mb4" /> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="living_area" class="mb4" /> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="facades" class="mb4" /> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="garage" class="mb4" /> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="garden" class="mb4" /> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="garden_area" class="mb4" /> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="garden_orientation" class="mb4" /> | ||||||
| </group> | ||||||
|
Comment on lines
+79
to
+102
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. why make a new group for each field ? |
||||||
| </group> | ||||||
| </page> | ||||||
| <page string="Sales"> | ||||||
| <group> | ||||||
| <field name="salesperson_id" /> | ||||||
| <field name="buyer_id" /> | ||||||
| </group> | ||||||
| </page> | ||||||
| </notebook> | ||||||
| </sheet> | ||||||
| </form> | ||||||
| </field> | ||||||
| </record> | ||||||
|
|
||||||
| <record id="estate_property_view_search" model="ir.ui.view"> | ||||||
| <field name="name">estate.property.search</field> | ||||||
| <field name="model">estate.property</field> | ||||||
| <field name="arch" type="xml"> | ||||||
| <search string="Search Properties"> | ||||||
| <field name="name" string="Title" /> | ||||||
| <field name="postcode" string="Postcode" /> | ||||||
| <field name="expected_price" string="Postcode" /> | ||||||
|
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.
Suggested change
Small copy-paste error. |
||||||
| <field name="bedrooms" string="Bedrooms" /> | ||||||
| <field name="living_area" string="Living Area" /> | ||||||
|
|
||||||
| <filter | ||||||
| name="active" | ||||||
| string="Available" | ||||||
| domain="[ | ||||||
| ('active', '=', True) | ||||||
| ]" | ||||||
| /> | ||||||
|
|
||||||
| <group> | ||||||
| <filter | ||||||
| name="postcode" | ||||||
| string="Postcode" | ||||||
| context="{'group_by': 'postcode'}" | ||||||
| /> | ||||||
| </group> | ||||||
| </search> | ||||||
| </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.
This file should be removed. Editor-specific settings do not belong in the source code of an Odoo module.