Skip to content
Draft
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
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
16 changes: 16 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
'name': 'Estate',
'depends': ['base'],
'application': True,
'author': 'Xavier Zambrano',
'license': 'LGPL-3',
'data': [
'security/ir.model.access.csv',

'views/estate_property_offer_views.xml',
'views/estate_property_tag_views.xml',
'views/estate_property_type_views.xml',
'views/estate_property_views.xml',
'views/real_estate_menus.xml',
]
}
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 estate_property_tag
from . import estate_property_offer
35 changes: 35 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from odoo import fields, models

class EstateProperty(models.Model):
Comment on lines +1 to +3
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
from odoo import fields, models
class EstateProperty(models.Model):
from odoo import fields, models
class EstateProperty(models.Model):

_name = 'estate.property'
_description = 'Estate Property'

name = fields.Char('Title', required=True)
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date('Available From', copy=False, default=fields.Date.add(fields.Date.today(), 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('Living Area (sqm)')
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
garden_area = fields.Integer('Garden Area (sqm)')
garden_orientation = fields.Selection(
selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')],
help='The orientation of the garden'
)
state = fields.Selection(
string='Status',
selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')],
required=True,
copy=False,
default='new'
)
active = fields.Boolean(default=True)
property_type_id = fields.Many2one('estate.property.type')
buyer_id = fields.Many2one('res.partner', copy=False)
salesperson_id = fields.Many2one('res.users', string='Salesman', default=lambda self: self.env.user)
property_tag_ids = fields.Many2many('estate.property.tag')
property_offer_ids = fields.One2many('estate.property.offer', 'property_id')
11 changes: 11 additions & 0 deletions estate/models/estate_property_offer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from odoo import fields, models


class EstatePropertyOffer(models.Model):
_name = 'estate.property.offer'
_description = 'Estate Property Offer'

price = fields.Float()
status = fields.Selection(selection=[('accepted', 'Accepted'), ('refused', 'Refused')], copy=False)
partner_id = fields.Many2one('res.partner', required=True)
property_id = fields.Many2one('estate.property', required=True)
8 changes: 8 additions & 0 deletions estate/models/estate_property_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class EstatePropertyTag(models.Model):
_name = 'estate.property.tag'
_description = 'Estate Property Tag'

name = fields.Char(required=True)
8 changes: 8 additions & 0 deletions estate/models/estate_property_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models

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

name = fields.Char(required=True)

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_model,access_estate_property_model,model_estate_property,base.group_user,1,1,1,1
access_estate_property_type_model,access_estate_property_type_model,model_estate_property_type,base.group_user,1,1,1,1
access_estate_property_tag_model,access_estate_property_tag_model,model_estate_property_tag,base.group_user,1,1,1,1
access_estate_property_offer,access_estate_property_offer_model,model_estate_property_offer,base.group_user,1,1,1,1
32 changes: 32 additions & 0 deletions estate/views/estate_property_offer_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<odoo>

<record id="estate_property_offer_view_form" model="ir.ui.view">
<field name="name">estate.property.offer.form</field>
<field name="model">estate.property.offer</field>
<field name="arch" type="xml">
<form string="Property Offer">
<sheet>
<group>
<field name="price" />
<field name="partner_id" />
<field name="status" />
</group>
</sheet>
</form>
</field>
</record>

<record id="estate_property_offer_view_list" model="ir.ui.view">
<field name="name">estate.property.offer.list</field>
<field name="model">estate.property.offer</field>
<field name="arch" type="xml">
<list string="Property Offers">
<field name="price" />
<field name="partner_id" />
<field name="status" />
</list>
</field>
</record>

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

<record id="estate_property_tag_view_form" model="ir.ui.view">
<field name="name">estate.property.tag.form</field>
<field name="model">estate.property.tag</field>
<field name="arch" type="xml">
<form string="Property Tag">
<sheet>
<group>
<field name="name" />
</group>
</sheet>
</form>
</field>
</record>

<record id="estate_property_tag_view_list" model="ir.ui.view">
<field name="name">estate.property.tag.list</field>
<field name="model">estate.property.tag</field>
<field name="arch" type="xml">
<list string="Property Tags">
<field name="name" />
</list>
</field>
</record>

<record id="estate_property_tag_action" model="ir.actions.act_window">
<field name="name">Property Tags</field>
<field name="res_model">estate.property.tag</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new property tag
</p>
<p>
Let your customers know about your great Real Estate property tag options!
</p>
</field>
</record>

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

<record id="estate_property_type_view_form" model="ir.ui.view">
<field name="name">estate.property.type.form</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<form string="Property Type">
<sheet>
<div class="oe_title">
<h1 class="mb32">
<field name="name" class="mb16" />
</h1>
</div>
</sheet>
</form>
</field>
</record>

<record id="estate_property_type_view_list" model="ir.ui.view">
<field name="name">estate.property.type.list</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<list string="Property Types">
<field name="name" />
</list>
</field>
</record>

<record id="estate_property_type_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>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new property type
</p>
<p>
Let your customers know about your great Real Estate property types options!
</p>
</field>
</record>

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


<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 Properties">
<field name="name"/>
<field name="property_type_id" />
<field name="postcode" />
<field name="expected_price" />
<field name="bedrooms" />
<field name="living_area" />
<field name="facades" />
<filter string="Available Properties" name="available_properties" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]" />
<group>
<filter string="Postcode" name="postcode" context="{'group_by':'postcode'}"></filter>
</group>
</search>
</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>
<field name="active" invisible="1" />
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" invisible="active"/>
<div class="oe_title">
<h1>
<field name="name" class="mb16" />
</h1>
</div>

<field name="property_tag_ids" widget="many2many_tags" class="mb32" />

<group>
<group>
<field name="property_type_id" />
<field name="postcode" />
<field name="date_availability" />
</group>
<group>
<field name="expected_price" />
<field name="selling_price" />
</group>
</group>

<notebook>
<page string="Description" name="description">
<group>
<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>
</group>
</page>
<page string="Offers" name="offers">
<field name="property_offer_ids" />
</page>
<page string="Other Info" name="other_info">
<group>
<group>
<field name="salesperson_id" />
<field name="buyer_id" />
</group>
</group>
</page>
</notebook>
</sheet>
</form>
</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="Properties">
<field name="name" />
<field name="property_type_id" />
<field name="property_tag_ids" widget="many2many_tags" />
<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_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>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new property
</p>
<p>
Let your customers know about your great Real Estate options!
</p>
</field>
</record>

</odoo>
12 changes: 12 additions & 0 deletions estate/views/real_estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<odoo>
<menuitem id="estate_menu_root" name="Real Estate">
<menuitem id="estate_first_level_menu" name="Advertisements">
<menuitem id="estate_property_menu_action" action="estate_property_action"></menuitem>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
<menuitem id="estate_property_menu_action" action="estate_property_action"></menuitem>
<menuitem id="estate_property_menu_action" parent="estate.estate_first_level_menu" action="estate_property_action"></menuitem>

Note if it were put in a separate file

</menuitem>
<menuitem id="settings_first_level_menu" name="Settings">
<menuitem id="estate_property_type_menu_action" action="estate_property_type_action"></menuitem>
<menuitem id="estate_property_tag_menu_action" action="estate_property_tag_action"></menuitem>
</menuitem>
</menuitem>
</odoo>