Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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

Choose a reason for hiding this comment

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

Missing newline

15 changes: 15 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
'name': "Estate",
'version': '1.0',
'depends': ['base'],
'author': "GACI Jugurtha (jugac)",
'application': True,
'data': [
'security/ir.model.access.csv',
'views/estate_property_views.xml',
'views/estate_property_type_views.xml',
'views/estate_property_tag_views.xml',
'views/estate_property_offer_views.xml',
'views/estate_menus.xml',
]
}
5 changes: 5 additions & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import estate_property
from . import estate_type
from . import estate_tags
from . import estate_offer

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

class EstateProperty(models.Model):
_name = "estate.property.offer"
_description = "Estate property offers"


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

# relations
partner_id = fields.Many2one("res.partner", required=True)
property_id = fields.Many2one("estate.property", required=True)
52 changes: 52 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from odoo import models, fields

class EstateProperty(models.Model):
_name = "estate.property"
_description = "Table that stores the estate properties"

Choose a reason for hiding this comment

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

Suggested change
_description = "Table that stores the estate properties"
_description = "Estate Property"

_description is the human-readable name of the model, not an actual description. It' a misnomer.



name = fields.Char(required=True)
description = fields.Text()
notes = fields.Html()
postcode = fields.Char()

date_availability = fields.Date(
string="Available From",
copy=False,
default=lambda self: fields.Date.add(fields.Date.today(), months=3)
)

expected_price = fields.Float(required=True)
selling_price = fields.Float(readonly=False, copy=False)

bedrooms = fields.Integer(default=2)
living_area = fields.Integer(string="Living Area (sqm)")
facades = fields.Integer()
garage = fields.Boolean()

garden = fields.Boolean()
garden_area = fields.Integer()
garden_orientation = fields.Selection(
selection=[
('north', 'North'),
('south', 'South'),
('east', 'East'),
('west', 'West')
]
)

active = fields.Boolean(default=True)
state = fields.Selection(
selection=[
('new', 'New'),
('received', 'Received'),
('accepted', 'Accepted')
]
)
Comment on lines 46 to 53

Choose a reason for hiding this comment

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

Suggested change
state = fields.Selection(
selection=[
('new', 'New'),
('received', 'Received'),
('accepted', 'Accepted')
]
)
state = fields.Selection(
selection=[
('new', 'New'),
('received', 'Received'),
('accepted', 'Accepted')
], required=True, default='new'
)

state should always be set, and new by default


# relations
property_type_id = fields.Many2one("estate.property.type")
buyer_id = fields.Many2one("res.partner")
salesman_id = fields.Many2one("res.users")
tag_ids = fields.Many2many("estate.property.tag")
offer_ids = fields.One2many("estate.property.offer", "partner_id")

Choose a reason for hiding this comment

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

Missing newline

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

class EstateProperty(models.Model):
_name = "estate.property.tag"
_description = "Estate property tags"


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

class EstateProperty(models.Model):
_name = "estate.property.type"
_description = "Estate property types"


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_group_user,estate.group.user,model_estate_property,base.group_user,1,1,1,1
access_estate_type_group_user,estate.type.group.user,model_estate_property_type,base.group_user,1,1,1,1
access_estate_tag_group_user,estate.tag.group.user,model_estate_property_tag,base.group_user,1,1,1,1
access_estate_offer_group_user,estate.offer.group.user,model_estate_property_offer,base.group_user,1,1,1,1
17 changes: 17 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<menuitem id="estate_menu_root" name="Real Estate">

<menuitem id="menu_estate_home" name="Advertisements">
<menuitem id="estate_property_menu" action="estate_property_action"/>
</menuitem>

<menuitem id="menu_estate_settings" name="Settings">
<menuitem id="estate_property_type_menu" action="estate_property_type_action"/>
<menuitem id="estate_property_tag_menu" action="estate_property_tag_action"/>
</menuitem>

</menuitem>
</data>
</odoo>

Choose a reason for hiding this comment

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

Missing newline

28 changes: 28 additions & 0 deletions estate/views/estate_property_offer_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<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="Estate offer">
<field name="price"/>
<field name="partner_id"/>
<field name="status"/>
</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 string="Estate offer">
<field name="price"/>
<field name="partner_id"/>
<field name="status"/>
</form>
</field>
</record>
</data>
</odoo>

Choose a reason for hiding this comment

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

Missing newline

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

<record id="estate_property_tag_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="Estate tag">
<field name="name"/>
</list>
</field>
</record>

<record id="estate_property_tag_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="Estate tag">
<field name="name"/>
</form>
</field>
</record>
</data>
</odoo>

Choose a reason for hiding this comment

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

Missing newline

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

<record id="estate_property_type_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="Estate type">
<field name="name"/>
</list>
</field>
</record>

<record id="estate_property_type_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="Estate type">
<field name="name"/>
</form>
</field>
</record>
</data>
</odoo>

Choose a reason for hiding this comment

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

Missing newline

104 changes: 104 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="estate_property_action" model="ir.actions.act_window">
<field name="name">Create new estate</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>

<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="Estate proprties">
<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_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="Estate property">
<sheet>
<h1> <field name="name"/> </h1>
<group>
<group>
<field name="tag_ids" widget="many2many_tags"/>
<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"/> </group>
<group> <field name="bedrooms"/> </group>
<group> <field name="living_area"/> </group>
<group> <field name="facades"/> </group>
<group> <field name="garage"/> </group>
<group> <field name="garden"/> </group>
<group> <field name="garden_area"/> </group>
<group> <field name="garden_orientation"/> </group>
</page>
Comment on lines 52 to 64

Choose a reason for hiding this comment

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

Suggested change
<page string="Description">
<group> <field name="description"/> </group>
<group> <field name="bedrooms"/> </group>
<group> <field name="living_area"/> </group>
<group> <field name="facades"/> </group>
<group> <field name="garage"/> </group>
<group> <field name="garden"/> </group>
<group> <field name="garden_area"/> </group>
<group> <field name="garden_orientation"/> </group>
</page>
<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>

Use only one group per block of fields

<page name="notes" string="Notes">
<field name="notes"/>
</page>

<page string="Offers">
<field name="offer_ids">
<list string="Estate offers">
<group>
<field name="price"/>
</group>
<group>
<field name="partner_id"/>
</group>
<group>
<field name="status"/>
</group>
</list>
Comment on lines 72 to 80

Choose a reason for hiding this comment

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

Suggested change
<list string="Estate offers">
<group>
<field name="price"/>
</group>
<group>
<field name="partner_id"/>
</group>
<group>
<field name="status"/>
</group>
</list>
<list string="Estate offers">
<field name="price"/>
<field name="partner_id"/>
<field name="status"/>
</list>

No groups needed in a list view

</field>
</page>
<page string="Other infos">
<group> <field name="salesman_id"/> </group>
<group> <field name="buyer_id"/> </group>
<group> <field name="buyer_id"/> </group>

Choose a reason for hiding this comment

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

Same here, only one group needed

</page>
</notebook>
</sheet>
</form>
</field>
</record>

<!-- SEARCH -->

<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="Search estates">
<field name="name"/>
<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', 'in', ['new', 'received'])]"/>
<filter string="Postcode" name="postcode" context="{'group_by':'postcode'}"/>
</search>
</field>
</record>

</odoo>

Choose a reason for hiding this comment

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

Missing newline