-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] estate: implemented modifications in data and security
- Updated data files to reflect recent changes in property and offer models. - Enhanced security for estate-related models. - Added security rules to ensure proper access levels for different user roles.
- Loading branch information
Showing
41 changed files
with
817 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
from . import models | ||
from . import controllers | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import estate_property_controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from odoo import http | ||
|
||
|
||
class WebsiteProperty(http.Controller): | ||
|
||
@http.route("/properties", auth="public", website=True) | ||
def display_properties(self, page=1, **kwargs): | ||
page = int(page) | ||
items_per_page = 6 | ||
offset = (page - 1) * items_per_page | ||
total_properties = http.request.env["estate.property"].search_count([('state', '!=', 'sold'), ('state', '!=', 'canceled')]) | ||
total_page = (total_properties + items_per_page - 1) // items_per_page | ||
properties = http.request.env["estate.property"].search([('state', '!=', 'sold'), ('state', '!=', 'canceled')], limit=items_per_page, offset=offset) | ||
return http.request.render( | ||
"estate.property_page", {"properties": properties, 'page': page, 'total_page': total_page} | ||
) | ||
|
||
@http.route('/property/<model("estate.property"):each_property>', type='http', auth='public', website=True) | ||
def property_details(self, each_property, **kwargs): | ||
return http.request.render('estate.property_detail_page', { | ||
'property': each_property, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
id,name | ||
id1,Residential | ||
id2,Commercial | ||
id3,Industrial | ||
id4,Land |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
<odoo> | ||
<record id="demo_data_1" model="estate.property"> | ||
<field name="title">Big villa</field> | ||
<field name="state">new</field> | ||
<field name="description">A nice and big villa</field> | ||
<field name="postcode">12345</field> | ||
<field name="availability_date">2020-02-02</field> | ||
<field name="expected_price">100</field> | ||
<field name="bedrooms">6</field> | ||
<field name="living_area">100</field> | ||
<field name="garage">True</field> | ||
<field name="garden">True</field> | ||
<field name="garden_area">100000</field> | ||
<field name="facades">4</field> | ||
<field name="garden_orientation">south</field> | ||
<field name="property_type_id" ref="estate.id1"></field> | ||
</record> | ||
|
||
<record id="demo_data_2" model="estate.property"> | ||
<field name="title">BTrailer home</field> | ||
<field name="state">canceled</field> | ||
<field name="description">home in a trailer park</field> | ||
<field name="postcode">54321</field> | ||
<field name="availability_date">1970-01-01</field> | ||
<field name="expected_price">100</field> | ||
<field name="bedrooms">1</field> | ||
<field name="living_area">10</field> | ||
<field name="garage">False</field> | ||
<field name="facades">4</field> | ||
<field name="property_type_id" ref="estate.id1"></field> | ||
</record> | ||
|
||
<record id="demo_data_3" model="estate.property"> | ||
<field name="title">Luxury villa</field> | ||
<field name="state">new</field> | ||
<field name="description">A very nice villa</field> | ||
<field name="postcode">12345</field> | ||
<field name="availability_date">2020-02-02</field> | ||
<field name="expected_price">100</field> | ||
<field name="bedrooms">6</field> | ||
<field name="living_area">100</field> | ||
<field name="garage">True</field> | ||
<field name="garden">True</field> | ||
<field name="garden_area">100000</field> | ||
<field name="garden_orientation">south</field> | ||
<field name="facades">4</field> | ||
<field name="offer_ids" eval="[ | ||
Command.create({ | ||
'partner_id': ref('base.res_partner_2'), | ||
'price': 190000000, | ||
'validity': 14 | ||
}), | ||
]"/> | ||
<field name="property_type_id" ref="estate.id1"></field> | ||
</record> | ||
|
||
<record id="demo_estate_offer_1" model="estate.property.offer"> | ||
<field name="partner_id" ref="base.res_partner_1"/> | ||
<field name="property_id" ref="demo_data_1"/> | ||
<field name="price">100</field> | ||
<field name="validity" >14</field> | ||
|
||
</record> | ||
|
||
<record id="demo_estate_offer_2" model="estate.property.offer"> | ||
<field name="partner_id" ref="base.res_partner_2"/> | ||
<field name="property_id" ref="demo_data_1"/> | ||
<field name="price">150</field> | ||
<field name="validity">14</field> | ||
|
||
</record> | ||
|
||
<record id="demo_estate_offer_3" model="estate.property.offer"> | ||
<field name="partner_id" ref="base.res_partner_3"/> | ||
<field name="property_id" ref="demo_data_1"/> | ||
<field name="price">151</field> | ||
<field name="validity">14</field> | ||
<field name="date_deadline" eval="datetime.now()+ relativedelta(days = 14)"/> | ||
</record> | ||
</odoo> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
from . import estate_property, estate_property_type, estate_property_tag, estate_property_offer, res_users | ||
from . import estate_property | ||
from . import estate_property_type | ||
from . import estate_property_tag | ||
from . import estate_property_offer | ||
from . import res_users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<data> | ||
<record id="report_property_details" model="ir.actions.report"> | ||
<field name="name">Real Estate Property</field> | ||
<field name="model">estate.property</field> | ||
<field name="report_type">qweb-pdf</field> | ||
<field name="report_name">estate.report_property_offers</field> | ||
<field name="report_file">estate.report_property_offers</field> | ||
<field name="binding_model_id" ref="model_estate_property"/> | ||
<field name="binding_type">report</field> | ||
</record> | ||
|
||
<record id="report_user_properties" model="ir.actions.report"> | ||
<field name="name">User Real Estate Property</field> | ||
<field name="model">res.users</field> | ||
<field name="report_type">qweb-pdf</field> | ||
<field name="report_name">estate.report_property_offers_users</field> | ||
<field name="report_file">estate.report_property_offers_users</field> | ||
<field name="binding_model_id" ref="base.model_res_users"/> | ||
<field name="binding_type">report</field> | ||
</record> | ||
</data> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<template id="table_template"> | ||
<t t-if="property.offer_ids"> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Price</th> | ||
<th>Partner</th> | ||
<th>Validity(days)</th> | ||
<th>Deadline</th> | ||
<th>State</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<t t-set="offers" t-value="property.mapped('offer_ids')"/> | ||
<tr t-foreach="offers" t-as="offer"> | ||
<td> | ||
<span t-field="offer.price"/> | ||
</td> | ||
<td> | ||
<span t-field="offer.partner_id"/> | ||
</td> | ||
<td> | ||
<span t-field="offer.validity"/> | ||
</td> | ||
<td> | ||
<span t-field="offer.date_deadline"/> | ||
</td> | ||
<td> | ||
<span t-field="offer.status"/> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</t> | ||
<t t-else = ""> | ||
<strong> There are no offers for this properpty yet.</strong> | ||
</t> | ||
</template> | ||
|
||
<template id="report_property_offers"> | ||
<t t-foreach="docs" t-as="property"> | ||
<t t-call="web.html_container"> | ||
<t t-call="web.external_layout"> | ||
<div class="page"> | ||
<h2> | ||
<span t-field="property.title"/> | ||
</h2> | ||
<div> | ||
<strong>Salesman: </strong> | ||
<span t-field="property.seller_id"/> | ||
</div> | ||
<div> | ||
<strong>Expected Price: </strong> | ||
<span t-field="property.expected_price"/> | ||
</div> | ||
<div class="state"> | ||
<strong>Status: </strong> | ||
<span t-field="property.state"/> | ||
</div> | ||
<t t-call="estate.table_template"/> | ||
</div> | ||
</t> | ||
</t> | ||
</t> | ||
</template> | ||
|
||
<template id="report_property_offers_users"> | ||
<t t-foreach="docs" t-as="user"> | ||
<t t-call="web.html_container"> | ||
<t t-call="web.external_layout"> | ||
<div class="page"> | ||
<h2> | ||
<strong>Salesman: </strong> | ||
<span t-field="user.name"/> | ||
</h2> | ||
<t t-foreach="user.property_ids" t-as="property"> | ||
<div> | ||
|
||
<h2> | ||
<span t-field="property.title" /> | ||
</h2> | ||
</div> | ||
<div> | ||
<strong>Expected Price: </strong> | ||
<span t-field="property.expected_price"/> | ||
</div> | ||
<div> | ||
<strong>Status: </strong> | ||
<span t-field="property.state"/> | ||
</div> | ||
<t t-call="estate.table_template"/> | ||
</t> | ||
</div> | ||
</t> | ||
</t> | ||
</t> | ||
</template> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="estate_group_user" model="res.groups"> | ||
<field name="name">Agent</field> | ||
<field name="category_id" ref="base.module_category_real_estate_brokerage"/> | ||
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/> | ||
</record> | ||
|
||
<record id="estate_group_manager" model="res.groups"> | ||
<field name="name">Manager</field> | ||
<field name="category_id" ref="base.module_category_real_estate_brokerage"/> | ||
<field name="implied_ids" eval="[(4, ref('estate_group_user'))]"/> | ||
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/> | ||
</record> | ||
|
||
<record id="estate_property_user_access_rule" model="ir.rule"> | ||
<field name="name">Estate Property User Access Rule</field> | ||
<field name="model_id" ref="model_estate_property"/> | ||
<field name="groups" eval="[Command.link(ref('estate.estate_group_user'))]"/> | ||
<field name="domain_force">['|', ('seller_id', '=', user.id), ('seller_id', '=', False)]</field> | ||
</record> | ||
|
||
<record id="estate_property_manager_access_rule" model="ir.rule"> | ||
<field name="name">Estate Property User Access Rule</field> | ||
<field name="model_id" ref="model_estate_property"/> | ||
<field name="groups" eval="[Command.link(ref('estate.estate_group_manager'))]"/> | ||
</record> | ||
|
||
<record model="ir.rule" id="record_restricted_company_rule"> | ||
<field name="name">Restricted Record: multi-company</field> | ||
<field name="model_id" ref="model_estate_property"/> | ||
<field name="global" eval="True"/> | ||
<field name="domain_force"> | ||
[('company_id', 'in', company_ids)] | ||
</field> | ||
</record> | ||
</odoo> |
Oops, something went wrong.