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
2 changes: 1 addition & 1 deletion awesome_dashboard/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
{
'name': "Awesome Dashboard",
'name': "Awesome Dashboard1",

'summary': """
Starting module for "Discover the JS framework, chapter 2: Build a dashboard"
Expand Down
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": "real estate",
"author": "Lokesh",
"version": "1.0.0",
"license": "LGPL-3",
# "depends": ["base"],
"application": True,
"installable": True,
"data": [
"security/ir.model.access.csv",
"views/estate_property_views.xml", # the order should be like this, first we need to define the views and then we need to define the action and then the menu if the order is not maintained then error will be thrown.
"views/estate_property_type_view.xml",
"views/estate_property_menu.xml",
],
"assets": {
"web.assets_backend": [
"estate/static/src/estate.css",
],
},
}
6 changes: 6 additions & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from . import (
estate_property,
estate_property_offers,
estate_property_tag,
estate_property_type,
)
55 changes: 55 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from datetime import datetime

from odoo import fields, models


class TestModel(models.Model):
today = datetime.now()

month = today.month + 3
year = today.year
day = today.day

if month > 12:
year = year + 1
month = month % 12

three_month_date = today.replace(year=year, month=month, day=day)

_name = "estate.property"
_description = "This is a dummy table"

name = fields.Char(translate=True, default="Unknown", required=True)
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(copy=False, default=three_month_date.date())
expected_price = fields.Float(required=True)
selling_price = fields.Float(readonly=True, copy=False)
bedrooms = fields.Integer()
living_area = fields.Integer()
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
garden_area = fields.Integer()
garden_orientation = fields.Selection(
[
("north", "North"),
("south", "South"),
("east", "East"),
("west", "West"),
],
string="Direction",
default="north",
)
active = fields.Boolean("Active", default=True)
property_type_id = fields.Many2one("estate.property.type", string="Property_type")
property_tag_ids = fields.Many2many(
"estate.property.tag",
string="Property_Tag",
)

buyer = fields.Many2one("res.partner", string="buyer", copy=False)
user_id = fields.Many2one(
"res.users", string="salesperson", default=lambda self: self.env.user
)
offer_ids = fields.One2many("estate.property.offers", "property_id")
11 changes: 11 additions & 0 deletions estate/models/estate_property_offers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from odoo import fields, models


class PropertyOffer(models.Model):
_name = "estate.property.offers"
_description = "this model is used to define the offers received to the property"

price = fields.Float()
status = fields.Selection([("accepted", "Accepted"), ("refused", "Refused")])
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 PropertyTag(models.Model):
_name = "estate.property.tag"
_description = "this model is used to define tags to the properties"

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


class PropertyType(models.Model):
_name = "estate.property.type"
_description = "this is used to define the types"

name = fields.Char(required=True, string="Type")
tags = fields.Char(string="tags")
6 changes: 6 additions & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_estate_property_user1,estate.property.user,model_estate_property,base.group_user,1,0,0,0
access_estate_property_user,estate.property.user,model_estate_property,base.group_system,1,1,1,1
access_estate_property_type_user,estate.property.type.user,model_estate_property_type,base.group_user,1,1,1,1
access_estate_property_tag_user,estate.property.tag.user,model_estate_property_tag,base.group_user,1,1,1,1
access_estate_property_offer_user,estate.property.offer.user,model_estate_property_offers,base.group_user,1,1,1,1
Empty file added estate/static/src/estate.css
Empty file.
25 changes: 25 additions & 0 deletions estate/views/estate_property_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem id="estate_property_menu_root" name="Real Estate"/>

<menuitem id="estate_menu_property"
parent="estate_property_menu_root"
name="Settings"
sequence="10"
/>
<menuitem id="estate_menu_settings"
parent="estate_menu_property"
name="Property Type"
action="estate_property_type_action"
/>
<menuitem id="estate_menu_advertisement"
parent="estate_property_menu_root"
name="Advertisement"
sequence="2"
/>
<menuitem id="estate_menu_properties"
parent="estate_menu_advertisement"
name="properties"
action="estate_property_action"
/>
</odoo>
22 changes: 22 additions & 0 deletions estate/views/estate_property_type_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>

<odoo>
<record id="estate_property_type_view" model="ir.ui.view" >
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<form string="property.type">
<sheet>
<label for="name"/>
<field name="name" string="Type"/>
</sheet>
</form>
</field>
</record>

<!-- action -->
<record id="estate_property_type_action" model="ir.actions.act_window">
<field name="name">Property Type</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form</field>
</record>
</odoo>
99 changes: 99 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="estate_property_view_form" model="ir.ui.view">
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form string="Property">
<sheet>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" placeholder="e.g. Modern Villa with Garden">title</field>
</h1>
<field name="property_tag_ids" widget="many2many_tags"/>
</div>
<group>
<group string="Pricing &amp; Availability">
<field name="postcode"/>
<field name="date_availability"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="property_type_id"/>
</group>
<group string="Property Specs">
<field name="bedrooms"/>
<field name="living_area" string="Living Area (m²)"/>
<field name="facades"/>
<field name="garage"/>
</group>
</group>
<notebook>
<page string="Description" name="description">
<field name="description" placeholder="Add property features, neighborhood details, etc."/>
</page>

<page string="Garden Details" name="garden_details">
<group>
<field name="garden"/>
<field name="garden_area" string="Garden Area (m²)" invisible="not garden"/>
<field name="garden_orientation" invisible="not garden"/>
</group>
</page>

<page string="Other info" name="other_info">
<group>
<field name="buyer" widget="many2one_avatar_user" />
<field name="user_id" widget="many2one_avatar_user" />
</group>
</page>
<page name="Offers">
<field name="offer_ids">
<list editable="bottom">
<field name="price"/>
<field name="partner_id"/>
<field name="status"/>
</list>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<record id="estate_property_search_views" model="ir.ui.view">
<field name="name" >estate property search view</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="tests">
<field name="expected_price"/>
<field name="name"/>
<filter name="expected_price" string="Expected Price" domain="[('expected_price','!=',0)]"/>
</search>
</field>
</record>

<record id="estate_property_views" model = "ir.ui.view">
<field name="name">estate property views</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list>
<field name="name" width="14.2%" />
<field name="postcode" width="14.2%" />
<field name="bedrooms" width="14.2%" />
<field name="living_area" width="14.2%" />
<field name="expected_price" width="14.2%" />
<field name="selling_price" width="14.2%" />
<field name="date_availability" string="Available From" width="14.2%"/>
<field name="property_type_id" string="Property Type" width="14.2%"/>
</list>
</field>
</record>

<!-- actions -->
<record id="estate_property_action" model="ir.actions.act_window">
<field name="name">Property</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>
</odoo>