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
20 changes: 20 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
'name': "Estate",
'version': '1.0',
'depends': ['base'],
'author': "Asurk",
'category': 'Real Estate/Brokerage',
'description': """
A module so that customers can bid on real estates
""",
'data': [
'security/ir.model.access.csv',
'views/estate_property_views.xml',
'views/estate_menus.xml'
],
'license': 'LGPL-3', # Default License
'application': True,
'installable': True,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What's the purpose of using 'installable': True?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

When installable is set to true , user can install the module from web interface

# data files always loaded at installation

}
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
46 changes: 46 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from odoo import fields, models, api
from odoo.exceptions import ValidationError


class EstateProperty(models.Model):

_name = 'estate.property'
_description = "A real estate model with many fields"
active = fields.Boolean(string="Active", default="Active")
bedrooms = fields.Integer(string="Bedrooms", default="2")
date_availability = fields.Datetime(
string="Available From", copy=False, default=lambda self: fields.Date.add(fields.Date.context_today(self), months=3))
description = fields.Text(string="Description")
expected_price = fields.Float(string="Expected Price", required=True)
facades = fields.Integer(string="Facades")
garden = fields.Boolean(string="Garden")
garden_area = fields.Integer(string="Garden Area (sqm)")
garden_orientation = fields.Selection(
string="Direction",
selection=[
('north', "North"),
('south', "South"),
('east', "East"),
('west', "West")
],
help="Type is used to specify the garden orientation"
)
garage = fields.Boolean(string="Garage")
living_area = fields.Integer(string="Living Area (sqm)")
name = fields.Char(string="Title", required=True, default="Unknown")
postcode = fields.Integer(string="Postcode")
selling_price = fields.Float(
string="Selling Price", readonly=True, copy=False)
state = fields.Selection([('new', "New"),
('offer_received', "Offer Received"),
('offer_accepted', "Offer Accepted"),
('sold', "Sold"),
('cancelled', "Cancelled")
],
default='new')

@api.constrains('expected_price')
def _check_price(self):
for rec in self:
if rec.expected_price <= 0:
raise ValidationError("Price must be positive")
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
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1
Binary file added estate/static/description/Real_Estate_Logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<odoo>

<menuitem id="real_estate_root" name="Real Estate" web_icon="estate,static/description/6888420.jpg" />

<menuitem id="real_estate_properties_menu" name="Properties" parent="real_estate_root"/>

<menuitem id="real_estate_menu_action" name="All Properties" parent="real_estate_properties_menu" action="test_property_action"/>
</odoo>
10 changes: 10 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<odoo>

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

</odoo>