Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Odoo tutorials
# Odoo tutorials - renol technical training

This repository hosts the code for the bases of the modules used in the
[official Odoo tutorials](https://www.odoo.com/documentation/latest/developer/tutorials.html).
Expand Down
1 change: 1 addition & 0 deletions estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
11 changes: 11 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
'name': "Real Estate Management",
'depends': ['base'],
'author': "Olivier Renson",
'application': True,
'data': [
'security/ir.model.access.csv',
'views/estate_property_views.xml',
'views/estate_menus.xml',
]
}
1 change: 1 addition & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import estate_property
44 changes: 44 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from odoo import models, fields
from datetime import date
from dateutil.relativedelta import relativedelta

class EstateProperty(models.Model):
_name = "estate_property"
_description = "A new model to store real estate properties"

name = fields.Char(required=True)
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(copy=False, default=date.today()+relativedelta(months=3))
expected_price = fields.Float(required=True)
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(
string="Garden Orientation",
selection=[
('north', 'North'),
('south', 'South'),
('east', 'East'),
('west', 'West')
],
)
active = fields.Boolean(default=True)
state = fields.Selection(
string="Status",
selection=[
('new', 'New'),
('offer_received', 'Offer Received'),
('offer_accepted', 'Offer Accepted'),
('sold', 'Sold'),
('canceled', 'Canceled')
],
default='new',
required=True,
copy=False,
)

2 changes: 2 additions & 0 deletions estate/security/ir.model.access.csv
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,access_estate,model_estate_property,base.group_user,1,1,1,1
10 changes: 10 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<odoo>

<menuitem id="estate_menu_root" name="Real Estate">
<menuitem id="estate_first_level_menu" name="First Level Menu">
<menuitem id="estate_model_menu_action" action="estate_property_action"/>
</menuitem>
</menuitem>

</odoo>
93 changes: 93 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0"?>
<odoo>

<record id="estate_property_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_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="Estate 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_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 string="Estate 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="available"
domain="['|',('state', '=', 'new'), ('state', '=', 'offer_received')]"/>
<filter string="Not Available" name="not_available"
domain="['!','|',('state', '=', 'new'), ('state', '=', 'offer_received')]"/>
<group>
<filter string="Postcode" name="postcode"
context="{'group_by':'postcode', 'residual_visible':True}"/>
</group>
</search>
</field>
</record>

<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="Estate Property">
<sheet>
<div class="oe_title">
<h1 class="mt16 mb32">
<field name="name" placeholder="e.g. My Beautiful Property"/>
</h1>
</div>
<group class="mb32">
<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" string="Living Area (m²)"/>
<field name="facades"/>
<field name="garage"/>
<field name="garden"/>
<field name="garden_area"/>
<!-- <field name="garden_orientation"/> -->
</group>
</page>
<page string="Other Information">
Empty for now ...
</page>
</notebook>
</sheet>
</form>
</field>
</record>

</odoo>