Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
18 changes: 18 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
'name': "Estate",
'version': '1.0',
'depends': ['base'],
'author': "frbin",
'category': 'Tutorials',
'description': "Soon to be the best module ever",
'application': True,
'license': 'LGPL-3',
'data': [
'security/ir.model.access.csv',
'views/estate_property_type_views.xml',
'views/estate_property_tag_views.xml',
'views/estate_property_offer_views.xml',
'views/estate_property_views.xml',
'views/estate_menu_views.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_tag
from . import estate_property_offer
from . import estate_property_type
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 datetime import date

from dateutil.relativedelta import relativedelta

from odoo import fields, models


class EstateProperty(models.Model):
_name = 'estate.property'
_description = 'Real Estate Property'

name = fields.Char('Property Name', required=True)
description = fields.Text()
type_id = fields.Many2one('estate.property.type', 'Property Type')
notes = fields.Html()
active = fields.Boolean(default=True)

tag_ids = fields.Many2many("estate.property.tag", string="Tags")
offer_ids = fields.One2many('estate.property.offer', 'property_id', string="Offers")
buyer_id = fields.Many2one("res.partner", string="Buyer")
salesperson_id = fields.Many2one("res.users", string="Salesman", default=lambda self: self.env.user)
date_available = fields.Datetime(
"Available From",
copy=False,
default=date.today() + relativedelta(months=3),
)
postcode = fields.Char()
expected_price = fields.Float()
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_orientation = fields.Selection(
selection=[('north', 'North'), ('east', 'East'), ('south', 'South'), ('west', 'West')],
)
state = fields.Selection(
selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')],
required=True,
default='new',
copy=False
)
15 changes: 15 additions & 0 deletions estate/models/estate_property_offer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from odoo import models, fields


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

price = fields.Float(required=True)
status = fields.Selection(
selection=[('accepted', 'Accepted'), ('refused', 'Refused'), ('pending', 'Pending')],
default='pending',
)

partner_id = fields.Many2one('res.partner', string="Partner")
property_id = fields.Many2one('estate.property', string="Property")
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 = "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 models, fields


class EstatePropertyType(models.Model):
_name = 'estate.property.type'
_description = '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,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_estate_property_tag,estate.property.tag,model_estate_property_tag,base.group_user,1,1,1,1
access_estate_property_offer,estate.property.offer,model_estate_property_offer,base.group_user,1,1,1,1
33 changes: 33 additions & 0 deletions estate/views/estate_menu_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem
id="estate_menu_root"
name="Estate">
</menuitem>
<!-- Properties menu -->
<menuitem
id="estate_first_level_menu"
name="Properties"
parent="estate_menu_root"/>

<menuitem
id="estate_property_menu_action"
action="estate_property_action"
parent="estate_first_level_menu"/>

<!-- Settings menu -->
<menuitem
id="estate_settings_menu"
name="Settings"
parent="estate_menu_root"/>

<menuitem
id="estate_property_type_menu_action"
action="estate_property_type_action"
parent="estate_settings_menu"/>
<menuitem
id="estate_property_tag_menu_action"
action="estate_property_tag_action"
parent="estate_settings_menu"/>

</odoo>
36 changes: 36 additions & 0 deletions estate/views/estate_property_offer_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<odoo>
<record id="estate_property_offer_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="Offers">
<field name="price"/>
<field name="status"/>
<field name="partner_id"/>
</list>
</field>
</record>

<record id="estate_property_offer_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>
<sheet>
<group>
<field name="price"/>
<field name="status"/>
<field name="partner_id"/>
</group>
</sheet>
</form>
</field>
</record>

<record id="estate_property_offer_action" model="ir.actions.act_window">
<field name="name">Offers</field>
<field name="res_model">estate.property.offer</field>
<field name="view_mode">list,form</field>
</record>
</odoo>
8 changes: 8 additions & 0 deletions estate/views/estate_property_tag_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<odoo>
<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>
</record>
</odoo>
8 changes: 8 additions & 0 deletions estate/views/estate_property_type_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<odoo>
<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>
</record>
</odoo>
96 changes: 96 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0"?>
<odoo>
<record id="estate_property_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="Estates" edit="false">
<field name="name"/>
<field name="postcode"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="date_available"/>
</list>
</field>
</record>

<record id="estate_property_form" model="ir.ui.view">
<field name="name">estate.property.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_title">
<h1 class="mb32">
<field name="name" class="mb16" placeholder="Name..." required="True"/>
</h1>
</div>
<group>
<group>
<field name="postcode" string="Postcode"/>
<field name="date_available"/>
<field name="state"/>
<field name="tag_ids" widget="many2many_tags"/>
</group>
<group>
<field name="type_id"/>
<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="Offers">
<field name="offer_ids"/>
</page>
<page string="Other info">
<group>
<field name="salesperson_id"/>
<field name="buyer_id"/>
</group>
</page>
<page name="notes" string="Notes">
<field name="notes"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<record id="estate_property_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="Test">
<field name="name"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<filter string="Available 2" name="state" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]"/>
<filter string="Postcode" name="postcode_group_by" context="{'group_by': 'postcode'}"/>
</search>
</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>
</record>
</odoo>

Choose a reason for hiding this comment

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

ditto