Skip to content

Commit

Permalink
[ADD] models: add realtions between models
Browse files Browse the repository at this point in the history
-add the Real Estate Property Type table.
-add the buyer and the salesperson.
-introduce property tag and offers
  • Loading branch information
apri-odoo committed Feb 10, 2025
1 parent ea01b0d commit 7b5e9b5
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 19 deletions.
3 changes: 2 additions & 1 deletion estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
'name': 'Estate',
'name': 'Real Estate',
'version':'1.0',
'depends': ['base'],
'description': """This is a base version of the Estate module for real estate management.""",
'license': 'LGPL-3',
'data': [
'security/ir.model.access.csv',
'views/estate_property_type_views.xml',
'views/estate_property_views.xml',
'views/estate_menu.xml',
],
Expand Down
1 change: 1 addition & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import estate_property
from . import estate_property_type
10 changes: 6 additions & 4 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ class EstateProperty(models.Model):
_name = "estate.property"
_description = "Real Estate Property"

name = fields.Char(required=True)
# active field define here
active = fields.Boolean(string="Active",default=True)
name = fields.Char(string="Property Name",required=True)

active = fields.Boolean(string="Active", default=True)
description = fields.Text()
postcode = fields.Char(string="Postcode")

Expand Down Expand Up @@ -45,4 +45,6 @@ class EstateProperty(models.Model):
('sold','Sold'),
('cancelled','Cancelled')
],string='State',default="new",copy=False)


# Relations Between Models
property_type_id = fields.Many2one("estate.property.type" ,string="Property Type")
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(string="Name",required=True)

1 change: 1 addition & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
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
13 changes: 5 additions & 8 deletions estate/views/estate_menu.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<!-- Menu Items -->
<menuitem id="menu_estate_property" name="Real Estate"/>
<!-- Dashbord menu's -->
<menuitem id="advertisement" name="Advertisement" parent="menu_estate_property"/>
<menuitem id="property_action_menu" name="Properties" parent="advertisement" action="action_estate_property"/>

<menuitem id="buy" name="Buy" parent="menu_estate_property"/>
<menuitem id="buy_sub" name="Buy Sub" parent="buy" action="action_estate_property"/>

<menuitem id="rent" name="Rent" parent="menu_estate_property"/>
<menuitem id="rent_sub" name="Rent Sub" parent="rent" action="action_estate_property"/>

<menuitem id="setting" name="Setting" parent="menu_estate_property"/>
<menuitem id="setting_sub" name="Property Types" parent="setting" action="action_estate_property_type"/>
</odoo>
33 changes: 33 additions & 0 deletions estate/views/estate_property_type_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Action Definition -->
<record id="action_estate_property_type" model="ir.actions.act_window">
<field name="name">Estate Property Type</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form,kanban</field>
</record>
<!-- List view -->
<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>
<field name="name"/>
</list>
</field>
</record>
<!-- Form view -->
<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>
<sheet>
<group>
<field name="name"/>
</group>
</sheet>
</form>
</field>
</record>
</odoo>
11 changes: 5 additions & 6 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
</field>
</record>

<!-- Menu Items -->
<menuitem id="menu_estate_property" name="Real Estate "/>
<!-- List view -->
<record id="estate_property_view_tree" model="ir.ui.view">
<record id="estate_property_view_list" model="ir.ui.view">
<field name="name">Property</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list>
<field name="property_type_id"/>
<field name="name" string="Title"/>
<field name="postcode" string="Postcode"/>
<field name="bedrooms" string="Bedrooms"/>
Expand All @@ -40,11 +39,10 @@
<sheet>
<group>
<group>
<group>
<h1>
<field name="name"/>
</h1>
</group>
<field name="property_type_id"/>
<newLine/>
<group>
<field name="postcode"/>
Expand Down Expand Up @@ -88,7 +86,8 @@
<field name="bedrooms" string="Bedrooms" />
<field name="living_area" string="Living Area (sqm)" />
<field name="facades" string="Facades" />
<filter name="state" string="Available" domain="['|',('state', '=', 'new'), ('state' , '=' , 'offer_accept')]"/>
<!-- <filter name="state" string="Available" domain="['|',('state', '=' , 'new'), ('state' , '=' , 'offer_accept')]"/> -->
<filter name="state" string="Available" domain="[('state', 'in', ['new', 'offer_accept'])]"/>
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
<filter name="group_by_postcode" string="Postcode" context="{'group_by': 'postcode'}" />
</search>
Expand Down

0 comments on commit 7b5e9b5

Please sign in to comment.