-
Couldn't load subscription status.
- Fork 2.6k
[ADD] estate: created a new module #1013
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
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 @@ | ||
| from . import models |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| 'name': 'Real Estate', | ||
| 'depends': ['base'], | ||
| 'data': [ | ||
| 'security/ir.model.access.csv', | ||
| 'views/estate_property_views.xml', | ||
| 'views/estate_menus.xml' | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import estate_property |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,45 @@ | ||||||
| from odoo import models, fields | ||||||
| from dateutil.relativedelta import relativedelta | ||||||
|
|
||||||
|
|
||||||
| class estateproperty(models.Model): | ||||||
| _name = "estate.property" | ||||||
| _description = "Real Estate Property" | ||||||
|
|
||||||
| name = fields.Char(required=True) | ||||||
| description = fields.Text("Description") | ||||||
| postcode = fields.Char("Postcode") | ||||||
| date_availability = fields.Date("Availability Date", default=fields.Date.today()+relativedelta(months=3)) | ||||||
|
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
|
||||||
| expected_price = fields.Float("Expected Price", required=True) | ||||||
| selling_price = fields.Float("Selling Price", readonly=True) | ||||||
| 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 (sqm)") | ||||||
|
Comment on lines
+10
to
+20
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. Please adapt these changes that were suggested to you earlier. You don't have to write a string if it's the same as the technical name. |
||||||
| garden_orientation = fields.Selection( | ||||||
| selection=[ | ||||||
| ("north", "North"), | ||||||
| ("south", "South"), | ||||||
| ("east", "East"), | ||||||
| ("west", "West"), | ||||||
| ], | ||||||
| string="Garden Orientation", | ||||||
| ) | ||||||
| state = fields.Selection( | ||||||
| [ | ||||||
| ("new", "New"), | ||||||
| ("offer_received", "Offer Received"), | ||||||
| ("offer_accepted", "Offer Accepted"), | ||||||
| ("sold", "Sold"), | ||||||
| ("cancelled", "Cancelled"), | ||||||
| ], | ||||||
| string="Status", | ||||||
| required=True, | ||||||
| copy=False, | ||||||
| default="new", | ||||||
| ) | ||||||
| active = fields.Boolean(string="Active", default=True) | ||||||
|
|
||||||
|
|
||||||
|
Comment on lines
+44
to
+45
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. One empty line is sufficient. |
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
| estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <odoo> | ||
| <menuitem id="test_menu_root" name="real_estate"> | ||
| <menuitem id="menu_estate_advertisements" name="Advertisements"> | ||
| <menuitem id="menu_estate_property_action" action="action_estate_property" /> | ||
| </menuitem> | ||
| </menuitem> | ||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| <odoo> | ||
| <record id="action_estate_property" model="ir.actions.act_window"> | ||
| <field name="name">Properties</field> | ||
| <field name="res_model">estate.property</field> | ||
| <field name="view_mode">list,form</field> | ||
| <field name="help" type="html"> | ||
| <p class="o_view_nocontent_smiling_face"> | ||
| Create a new property | ||
| </p> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_view_list" model="ir.ui.view"> | ||
| <field name="name">estate.property.view.list</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <list string="lists"> | ||
| <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" /> | ||
| </list> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="view_estate_property_view_form" model="ir.ui.view"> | ||
| <field name="name">estate.property.view.form</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="form"> | ||
| <sheet> | ||
| <group> | ||
| <group> | ||
| <field name="name" /> | ||
| <field name="postcode" /> | ||
| <field name="date_availability" /> | ||
| </group> | ||
| <group> | ||
| <field name="expected_price" /> | ||
| <field name="selling_price" /> | ||
| <field name="bedrooms" /> | ||
| <field name="living_area" /> | ||
| <field name="facades" /> | ||
| <field name="garage" /> | ||
| <field name="garden" /> | ||
| <field name="garden_area" /> | ||
| <field name="garden_orientation" /> | ||
| </group> | ||
| </group> | ||
| <notebook> | ||
| <page string="Discription"> | ||
| <field name="description"></field> | ||
| </page> | ||
| </notebook> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_view_search" model="ir.ui.view"> | ||
| <field name="name">estate.property.view.search</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <search string="search"> | ||
| <field name="name" /> | ||
| <field name="postcode" /> | ||
| <field name="expected_price" /> | ||
| <filter | ||
| string="Available" | ||
| name="available_properties" | ||
| domain="['|', ('state', '=', 'New'), ('state', '=', 'Offer Received')]" /> | ||
| <filter string="Postcode" name="group_by_postcode" | ||
| context="{'group_by': 'postcode'}" /> | ||
| </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.
Class name should be in camel case 'EstateProperty`.