-
Notifications
You must be signed in to change notification settings - Fork 573
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
aaha - Technical Training #49
Changes from 6 commits
7cd2bc6
24e4195
486b9b0
b3ee822
0cce113
4901bf4
3ff32c7
c93657b
be4e066
bdc1d92
18cc1ab
2c7b4aa
1bb90e3
ad69681
2e675d1
5ee0a94
af00da3
8905a0a
2c5b513
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,11 @@ | ||
# -*- coding: utf-8 -*- | ||
{ | ||
'name': 'Real Estate', | ||
'depends': ['base'], | ||
'application': True, | ||
'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,32 @@ | ||||||||||
from odoo import models, fields | ||||||||||
|
||||||||||
|
||||||||||
class EstateProperty(models.Model): | ||||||||||
_name = "estate.property" | ||||||||||
_description = "Real Estate Property" | ||||||||||
|
||||||||||
name = fields.Char(required=True, string="Title") | ||||||||||
description = fields.Text(string="Description") | ||||||||||
postcode = fields.Char(string="Postcode") | ||||||||||
date_availability = fields.Date(default=fields.Date.add(fields.Date.today(), days=90), copy=False, string="Available From") | ||||||||||
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. Not all months consist of 30 days, so to be more precise you can use
Suggested change
|
||||||||||
expected_price = fields.Float(required=True, string="Expected Price") | ||||||||||
selling_price = fields.Float(readonly=True, copy=False, string="Selling Price") | ||||||||||
bedrooms = fields.Integer(default=2, string="Bedrooms") | ||||||||||
living_area = fields.Integer(string="Living Area (sqm)") | ||||||||||
facades = fields.Integer(string="Facades") | ||||||||||
garage = fields.Boolean(string="Garage") | ||||||||||
garden = fields.Boolean(string="Garden") | ||||||||||
garden_area = fields.Integer(string="Garden Area (sqm)") | ||||||||||
garden_orientation = fields.Selection( | ||||||||||
string="Garden Orientation", | ||||||||||
selection=[("north", "North"), ("south", "South"), ("east", "East"), ("west", "West")], | ||||||||||
help="Type to detect orientation of the garden") | ||||||||||
active = fields.Boolean(default=True) | ||||||||||
state = fields.Selection( | ||||||||||
default='new', | ||||||||||
selection=[ | ||||||||||
('new', 'New'), | ||||||||||
('offer received', 'Offer Received'), | ||||||||||
('offer accepted', 'Offer Accepted'), | ||||||||||
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. By convention we use pyhon-like style.
Suggested change
|
||||||||||
('sold', 'Sold'), | ||||||||||
('canceled', 'Canceled')]) |
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,8 @@ | ||
<?xml version="1.0"?> | ||
<odoo> | ||
<menuitem id="estate_menu_root" name="Real Estate"> | ||
<menuitem id="estate_level_menu" name="Advertisements"> | ||
<menuitem id="estate_property_menu_action" name="Properties" action="estate_property_action"/> | ||
</menuitem> | ||
</menuitem> | ||
</odoo> |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,80 @@ | ||||||
<?xml version="1.0"?> | ||||||
<odoo> | ||||||
<record id="estate_property_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. usually we put actions after the views declaration |
||||||
<field name="name">Add Property</field> | ||||||
<field name="res_model">estate.property</field> | ||||||
<field name="view_mode">tree,form</field> | ||||||
</record> | ||||||
|
||||||
<record id="estate_property_view_tree" model="ir.ui.view"> | ||||||
<field name="name">estate.property.tree</field> | ||||||
<field name="model">estate.property</field> | ||||||
<field name="arch" type="xml"> | ||||||
<tree string="Channel"> | ||||||
<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"/> | ||||||
</tree> | ||||||
</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="Property"> | ||||||
<sheet> | ||||||
<h2> | ||||||
<field name="name"/> | ||||||
</h2> | ||||||
<group> | ||||||
<group> | ||||||
<field name="postcode"/> | ||||||
<field name="date_availability"/> | ||||||
</group> | ||||||
<group> | ||||||
<field name="expected_price"/> | ||||||
<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"/> | ||||||
</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"/> | ||||||
<field name="postcode"/> | ||||||
<field name="expected_price"/> | ||||||
<field name="bedrooms"/> | ||||||
<field name="living_area"/> | ||||||
<field name="facades"/> | ||||||
<filter name="available" string="Available" 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. As an alternative way you can write:
Suggested change
|
||||||
<filter name="groupby_postcode" string="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.
Since recently it is not needed to add this line anymore.