Skip to content
Open
Show file tree
Hide file tree
Changes from 10 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
4 changes: 4 additions & 0 deletions estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import models


from odoo import api, SUPERUSER_ID
30 changes: 30 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
'name': "Real Estate",

'summary': """
Real Estate Tuto"
""",

'description': """
Starting tutorial real estate"
""",

'author': "Odoo",
'website': "https://www.odoo.com/",
'category': 'Tutorials',
'version': '0.1',
'application': True,
'depends': ['base'],

'data': [
'security/ir.model.access.csv',
'views/estate_property_views.xml',
'views/estate_menus.xml',
'views/estate_property_type_views.xml',

],
'assets': {

},
'license': 'AGPL-3'
}
4 changes: 4 additions & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import estate_property
from . import estate_property_type
from . import buyer
from . import salesperson
8 changes: 8 additions & 0 deletions estate/models/buyer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class Buyer(models.Model):
_name = 'buyer'
_description = 'The entity to buy the estate'

name = fields.Char('Buyer')
34 changes: 34 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from odoo import fields, models
from dateutil.relativedelta import relativedelta


class Estateproperty(models.Model):
_name = "estate.property"
_description = "Estate property"

name = fields.Char('Title', required=True)
description = fields.Text('Description', required=True)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string is generated from the variable name so no need to duplicate it here

postcode = fields.Char('Postcode', required=True)
date_availability = fields.Date('Available From', copy=False, default=fields.Datetime.now() + relativedelta(months=3))
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 (sqm)')
garden_orientation = fields.Selection(
string='Garden Orientation',
selection=[('north', 'North'), ('south', 'South'), ('west', 'West'), ('east', 'East')],
)
active = fields.Boolean('Active', default=True)
state = fields.Selection(
string='State',
selection=[('new', 'New'), ('offer received', 'Offer Received'), ('offer accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')],
help="Estate state",
default=('new')
)
property_type_id = fields.Many2one("estate.property.type", string="Type")
salesperson = fields.Many2one('salesperson', string='Salesperson')
buyer = fields.Many2one('buyer', string='Buyer')
10 changes: 10 additions & 0 deletions estate/models/estate_property_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class EstatePropertyType(models.Model):
_name = "estate.property.type"
_description = "Estate Property Type"

name = fields.Char('Type', required=True)
description = fields.Text('Description')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string is generated from the variable name so no need to duplicate it here


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a whitespace on the newline here

8 changes: 8 additions & 0 deletions estate/models/salesperson.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class Salesperson(models.Model):
_name = 'salesperson'
_description = 'The individual handling the sales for the estate'

name = fields.Char('Salesperson')
5 changes: 5 additions & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_estate_property,estate.property,model_estate_property,base.group_user,1,1,1,1
access_estate_property_type,estate.property.type,model_estate_property_type,base.group_user,1,1,1,1
access_buyer,buyer,model_buyer,base.group_user,1,1,1,1
access_salesperson,sales,model_salesperson,base.group_user,1,1,1,1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newline is missing here

11 changes: 11 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem id="estate_menu_root" name="Real Estate">
<menuitem id="estate_first_level_menu" name="Advertisements">
<menuitem id="estate_model_menu_action" action="estate_property_model_action"/>
</menuitem>
<menuitem id="estate_type_first_level_menu" name="Settings">
<menuitem id="estate_type_model_menu_action" action="estate_property_type_model_action"/>
</menuitem>
</menuitem>
</odoo>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline missing

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

<record id="estate_property_type_model_action" model="ir.actions.act_window">
<field name="name">Property Types</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form</field>
</record>

</odoo>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline missing

89 changes: 89 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<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>

<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="property">
<field name="name" string="Title"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<filter string="Available" name="available properties" domain="[ ('state', 'in', ['new', 'offer received']) ]"/>
<filter string="Postcode" name="postcode" context="{'group_by':'postcode', 'residual_visible':True}"/>
</search>
</field>
</record>

<record id="estate_property_view_list" model="ir.ui.view">
<field name="name">estate.property.list</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list 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"/>
</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="property">
<sheet>
<group>
<h1>
<field name="name"/>
</h1>
</group>
<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>
<page string="Other Info">
<group>
<field name="salesperson"/>
<field name="buyer"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>


</odoo>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline missing