-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Technical Training - alnav #1413
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
f28308d
cdd3405
c5c3d74
5e35e5e
8142e1b
2dde396
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,17 @@ | ||
| { | ||
| "name": "Real Estate", | ||
| "version": "1.0", | ||
| "depends": ["base"], | ||
| "author": "Odoo S.A.", | ||
| "category": "Productivity", | ||
| "description": """ | ||
| Our brand new real estate app! | ||
| """, | ||
| "application": True, | ||
| "data": [ | ||
| "security/ir.model.access.csv", | ||
| "views/estate_property_views.xml", | ||
| "views/estate_menus.xml", | ||
| ], | ||
| "license": "OPL-1", | ||
| } |
| 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,50 @@ | ||
| from datetime import datetime | ||
|
|
||
| from dateutil.relativedelta import relativedelta | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class Property(models.Model): | ||
|
msho-odoo marked this conversation as resolved.
|
||
| _name = "estate.property" | ||
| _description = "Real Estate Property" | ||
|
|
||
| name = fields.Char("Property Name", required=True) | ||
| description = fields.Text("Property Description") | ||
| postcode = fields.Char("Postcode") | ||
|
|
||
| date_availability = fields.Date("Available Date", copy=False, default=lambda _x: datetime.now() + relativedelta(months=+3)) | ||
|
|
||
| expected_price = fields.Float("Expected Price") | ||
| selling_price = fields.Float("Selling Price", copy=False, readonly=True) | ||
|
|
||
| bedrooms = fields.Integer("Number of Bedrooms", default=2) | ||
| living_area = fields.Integer("Living Area") | ||
| facades = fields.Integer("Number of Facades") | ||
|
|
||
| has_garage = fields.Boolean("Has a Garage") | ||
| has_garden = fields.Boolean("Has a Garden") | ||
| garden_area = fields.Integer("Garden Area") | ||
| garden_orientation = fields.Selection( | ||
| string="Garden Orientation", | ||
| selection=[ | ||
| ("north", "North"), | ||
| ("south", "South"), | ||
| ("east", "East"), | ||
| ("west", "West"), | ||
| ], | ||
| ) | ||
|
msho-odoo marked this conversation as resolved.
|
||
|
|
||
| state = fields.Selection( | ||
| string="Property State", | ||
| selection=[ | ||
| ("new", "New"), | ||
| ("offer_received", "Offer Received"), | ||
| ("offer_accepted", "Offer Accepted"), | ||
| ("sold", "Sold"), | ||
| ("cancelled", "Cancelled"), | ||
| ], | ||
| default="new", | ||
|
msho-odoo marked this conversation as resolved.
|
||
| ) | ||
|
|
||
| active = fields.Boolean(default=True) | ||
| 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 | ||
| access_estate_property_model,access_estate_property_model,model_estate_property,base.group_user,1,1,1,1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <menuitem id="estate_main_menu_button" name="Real_Estate"> | ||
| <menuitem id="estate_app_top_bar_property_model_button" name="Advertisements"> | ||
|
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. I wouldn't add |
||
| <menuitem id="estate_app_property_model_action" action="estate_property_model_action"/> | ||
| </menuitem> | ||
| </menuitem> | ||
| </odoo> | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,96 @@ | ||||||
| <?xml version="1.0"?> | ||||||
| <odoo> | ||||||
|
|
||||||
| <record id="estate_property_model_search_view" model="ir.ui.view"> | ||||||
| <field name="name">Property Lookup</field> | ||||||
| <field name="model">estate.property</field> | ||||||
| <field name="arch" type="xml"> | ||||||
| <search string="Properties"> | ||||||
| <field name="name"/> | ||||||
| <field name="postcode"/> | ||||||
| <field name="expected_price"/> | ||||||
| <field name="bedrooms"/> | ||||||
| <field name="living_area"/> | ||||||
| <field name="facades"/> | ||||||
| <separator/> | ||||||
| <filter string="Available" name="active" domain="[('active', '=', True)]"/> | ||||||
| <filter string="New" name="active" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]"/> | ||||||
|
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. Usually, we write the
Suggested change
|
||||||
| <group> | ||||||
| <filter string="Postcode" name="postcode" context="{'group_by':'postcode', 'residual_visible':True}"/> | ||||||
| </group> | ||||||
| </search> | ||||||
| </field> | ||||||
| </record> | ||||||
|
|
||||||
| <record id="estate_property_model_list_view" model="ir.ui.view"> | ||||||
|
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
just to align with the naming guidelines |
||||||
| <field name="name">Properties</field> | ||||||
| <field name="model">estate.property</field> | ||||||
| <field name="arch" type="xml"> | ||||||
| <list string="Properties"> | ||||||
| <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="estate_property_model_form_view" model="ir.ui.view"> | ||||||
| <field name="name">Properties</field> | ||||||
| <field name="model">estate.property</field> | ||||||
| <field name="arch" type="xml"> | ||||||
| <form string="Property"> | ||||||
| <sheet> | ||||||
| <field name="name" style="font-size:20pt;"/> | ||||||
|
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. in-line styling is not encouraged, you can use the tag |
||||||
| <group> | ||||||
| <group> | ||||||
| <field name="postcode"/> | ||||||
| <field name="date_availability"/> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="expected_price"/> | ||||||
| <field name="selling_price"/> | ||||||
| </group> | ||||||
| </group> | ||||||
| <notebook> | ||||||
| <page string="Information"> | ||||||
| <group> | ||||||
| <field name="description"/> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="bedrooms"/> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="living_area"/> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="facades"/> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="has_garage"/> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="has_garden"/> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="garden_area"/> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="garden_orientation"/> | ||||||
| </group> | ||||||
| </page> | ||||||
| </notebook> | ||||||
| </sheet> | ||||||
| </form> | ||||||
| </field> | ||||||
| </record> | ||||||
|
|
||||||
| <record id="estate_property_model_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.
No need to leave empty lines after each import line.
If you must, you can leave a line between the external import lines and the odoo import line, but that's just a nitpick from me