@ -0,0 +1,47 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
Advanced Property Management |
||||
|
============================ |
||||
|
* Manage your properties by selling, renting and bidding |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
- www.odoo.com/documentation/15.0/setup/install.html |
||||
|
- Install our custom addon |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (LGPL v3). |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developer: (V15) Mohamed Dilshad Tk, Contact: |
||||
|
odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
For support and more information, please visit https://www.cybrosys.com |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import controllers |
||||
|
from . import models |
||||
|
from . import wizards |
@ -0,0 +1,68 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': "Advanced Property Management", |
||||
|
'version': '15.0.1.0.0', |
||||
|
'category': 'Industries', |
||||
|
'summary': """Manage your properties by selling, renting and bidding""", |
||||
|
'description': """The module makes it simple for you to manage |
||||
|
your properties""", |
||||
|
'author': "Cybrosys Techno Solutions", |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://cybrosys.com', |
||||
|
'depends': ['base', 'mail', 'sale_management', 'website', |
||||
|
'base_geolocalize'], |
||||
|
'data': [ |
||||
|
'security/advanced_property_management_groups.xml', |
||||
|
'security/property_security.xml', |
||||
|
'security/ir.model.access.csv', |
||||
|
'data/ir_sequence_data.xml', |
||||
|
'data/advanced_property_management_data.xml', |
||||
|
'data/ir_cron_data.xml', |
||||
|
'views/property_property_views.xml', |
||||
|
'views/property_facility_views.xml', |
||||
|
'views/property_tag_views.xml', |
||||
|
'views/property_search_pannel_views.xml', |
||||
|
'views/property_templates.xml', |
||||
|
'views/property_commision_views.xml', |
||||
|
'views/property_sale_views.xml', |
||||
|
'views/property_rental_views.xml', |
||||
|
'views/res_partner_views.xml', |
||||
|
'views/rental_bill_views.xml', |
||||
|
'views/property_auction_views.xml', |
||||
|
'reports/property_sale_report.xml', |
||||
|
'reports/property_report.xml', |
||||
|
'wizards/property_sale_report_views.xml', |
||||
|
], |
||||
|
'assets': { |
||||
|
'web.assets_frontend': [ |
||||
|
'advanced_property_management/static/src/js/property_website.js', |
||||
|
'advanced_property_management/static/src/js/property_item.js', |
||||
|
], |
||||
|
}, |
||||
|
'images': ['static/description/banner.png'], |
||||
|
'license': 'LGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': True, |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import advanced_property_management |
@ -0,0 +1,107 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
import werkzeug.utils |
||||
|
from odoo import fields, http |
||||
|
from odoo.http import request |
||||
|
|
||||
|
|
||||
|
class PropertyController(http.Controller): |
||||
|
"""A controller class that shows the related functions to the property""" |
||||
|
|
||||
|
@http.route('/property', auth='user', website=True) |
||||
|
def property(self): |
||||
|
""" Returns the property_view for the route """ |
||||
|
return request.render('advanced_property_management.property_view', { |
||||
|
'property_ids': request.env['property.property'].sudo().search([]) |
||||
|
}) |
||||
|
|
||||
|
@http.route('/property/<int:property_id>', auth='user', website=True) |
||||
|
def property_item(self, property_id): |
||||
|
""" Shows each corresponding properties view in property_view_item """ |
||||
|
return request.render('advanced_property_management.property_view_item', |
||||
|
{ |
||||
|
'property_id': request.env[ |
||||
|
'property.property'].sudo().browse( |
||||
|
property_id), |
||||
|
}) |
||||
|
|
||||
|
@http.route('/map/<latitude>/<longitude>', type='http', auth='user') |
||||
|
def redirect_map(self, latitude, longitude): |
||||
|
""" Returns the Google map location for the corresponding latitude |
||||
|
and longitude """ |
||||
|
return werkzeug.utils.redirect( |
||||
|
"https://www.google.com/maps/@%s,%s,115m/data=!3m1!1e3" % ( |
||||
|
latitude, longitude)) |
||||
|
|
||||
|
@http.route('/property/auction/', type='json', auth='user') |
||||
|
def auction(self): |
||||
|
"""Returns properties in three different states""" |
||||
|
auction_ids = request.env['property.auction'].sudo().search([ |
||||
|
('state', '!=', 'draft') |
||||
|
]) |
||||
|
context = { |
||||
|
'confirmed': [], |
||||
|
'started': [], |
||||
|
'ended': [], |
||||
|
} |
||||
|
for auction_id in auction_ids: |
||||
|
participants = sorted(auction_id.participant_ids, |
||||
|
key=lambda x: x.bid_amount, reverse=True) |
||||
|
data = { |
||||
|
'id': auction_id.id, |
||||
|
'name': auction_id.property_id.name, |
||||
|
'code': auction_id.auction_seq, |
||||
|
'image': auction_id.property_id.image, |
||||
|
'start': auction_id.start_time, |
||||
|
'start_price': auction_id.bid_start_price, |
||||
|
'last': participants[0].bid_amount if participants else 0, |
||||
|
'end': auction_id.end_time, |
||||
|
'winner': auction_id.auction_winner_id.name, |
||||
|
'final_rate': auction_id.final_price, |
||||
|
'total_participant': len(auction_id.participant_ids.ids) |
||||
|
} |
||||
|
if auction_id.state == 'confirmed': |
||||
|
context['confirmed'].append(data) |
||||
|
elif auction_id.state == 'started': |
||||
|
context['started'].append(data) |
||||
|
elif auction_id.state == 'ended': |
||||
|
context['ended'].append(data) |
||||
|
response = http.Response( |
||||
|
template='advanced_property_management.auction_view', |
||||
|
qcontext=context) |
||||
|
return response.render() |
||||
|
|
||||
|
@http.route('/property/auction/<int:prop_id>/bid', type='json', |
||||
|
auth='user') |
||||
|
def auction_bid_submit(self, prop_id, **kw): |
||||
|
"""Return success when auction is submitted""" |
||||
|
auction_id = request.env['property.auction'].sudo().browse(int(prop_id)) |
||||
|
auction_id.write({ |
||||
|
'participant_ids': [ |
||||
|
fields.Command.create({ |
||||
|
'partner_id': request.env.user.partner_id.id, |
||||
|
'bid_time': fields.Datetime.now(), |
||||
|
'bid_amount': float(kw.get('bid_amount')) |
||||
|
}) |
||||
|
] |
||||
|
}) |
||||
|
return {'message': 'success'} |
@ -0,0 +1,12 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<!-- Property menu --> |
||||
|
<record id="menu_property_form" model="website.menu"> |
||||
|
<field name="name">Property</field> |
||||
|
<field name="url">/property</field> |
||||
|
<field name="parent_id" ref="website.main_menu" /> |
||||
|
<field name="sequence" type="int">22</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,16 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<!-- Property rental cron action --> |
||||
|
<record id="ir_cron_property_rental_action" model="ir.cron"> |
||||
|
<field name="name">Property Rental</field> |
||||
|
<field name="model_id" ref="model_property_rental"/> |
||||
|
<field name="state">code</field> |
||||
|
<field name="code">model.action_check_rental()</field> |
||||
|
<field name="user_id" ref="base.user_root"/> |
||||
|
<field name="interval_number">1</field> |
||||
|
<field name="interval_type">days</field> |
||||
|
<field name="numbercall">-1</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,45 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<!-- Property Sequence --> |
||||
|
<record id="property_sequence" model="ir.sequence"> |
||||
|
<field name="name">Property sequence</field> |
||||
|
<field name="code">property.property</field> |
||||
|
<field name="active">TRUE</field> |
||||
|
<field name="prefix">PI/</field> |
||||
|
<field name="number_increment">1</field> |
||||
|
<field name="number_next">1</field> |
||||
|
<field name="padding">4</field> |
||||
|
</record> |
||||
|
<!-- Property sale Sequence --> |
||||
|
<record id="property_sale_sequence" model="ir.sequence"> |
||||
|
<field name="name">Property Sale Sequence</field> |
||||
|
<field name="code">property.sale</field> |
||||
|
<field name="active">TRUE</field> |
||||
|
<field name="prefix">PS/</field> |
||||
|
<field name="number_increment">1</field> |
||||
|
<field name="number_next">1</field> |
||||
|
<field name="padding">4</field> |
||||
|
</record> |
||||
|
<!-- Property rental Sequence --> |
||||
|
<record id="property_rental_sequence" model="ir.sequence"> |
||||
|
<field name="name">Property Rent sequence</field> |
||||
|
<field name="code">property.rent</field> |
||||
|
<field name="active">TRUE</field> |
||||
|
<field name="prefix">RNT/</field> |
||||
|
<field name="number_increment">1</field> |
||||
|
<field name="number_next">1</field> |
||||
|
<field name="padding">4</field> |
||||
|
</record> |
||||
|
<!-- Property auction Sequence --> |
||||
|
<record id="auction_sequence" model="ir.sequence"> |
||||
|
<field name="name">Property Auction sequence</field> |
||||
|
<field name="code">property.auction</field> |
||||
|
<field name="active">TRUE</field> |
||||
|
<field name="prefix">AUC</field> |
||||
|
<field name="number_increment">1</field> |
||||
|
<field name="number_next">1</field> |
||||
|
<field name="padding">4</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,7 @@ |
|||||
|
## Module <advanced_property_management> |
||||
|
|
||||
|
#### 18.04.2024 |
||||
|
#### Version 15.0.1.0.0 |
||||
|
#### ADD |
||||
|
|
||||
|
- Initial commit for Advanced Property Management |
@ -0,0 +1,36 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import account_move |
||||
|
from . import property_area_measure |
||||
|
from . import property_auction |
||||
|
from . import property_auction_line |
||||
|
from . import property_commission |
||||
|
from . import property_facility |
||||
|
from . import property_image |
||||
|
from . import property_nearby_connectivity |
||||
|
from . import property_property |
||||
|
from . import property_rental |
||||
|
from . import property_sale |
||||
|
from . import property_tag |
||||
|
from . import product_product |
||||
|
from . import rental_bill |
||||
|
from . import res_partner |
@ -0,0 +1,37 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class AccountMove(models.Model): |
||||
|
"""A class that inherits the already existing model account move to add |
||||
|
the related property sale and rental records""" |
||||
|
_inherit = 'account.move' |
||||
|
|
||||
|
property_order_id = fields.Many2one('property.sale', |
||||
|
string="Property Order ID", |
||||
|
help='The corresponding property ' |
||||
|
'sale order') |
||||
|
property_rental_id = fields.Many2one('property.rental', |
||||
|
string='Property Rental ID', |
||||
|
help='The corresponding property ' |
||||
|
'rental order') |
@ -0,0 +1,32 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class Product(models.Model): |
||||
|
"""Inherits the Product Template model for adding properties field""" |
||||
|
_inherit = 'product.template' |
||||
|
|
||||
|
rel_property_id = fields.Many2one('property.property', |
||||
|
string='Property', |
||||
|
help="The property to be added to the " |
||||
|
"template") |
@ -0,0 +1,45 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class PropertyAreaMeasure(models.Model): |
||||
|
"""A class for the model property.area.measure to represent |
||||
|
the area of each sections""" |
||||
|
_name = 'property.area.measure' |
||||
|
_description = 'Property Area Measurement' |
||||
|
|
||||
|
name = fields.Char(string='Section', required=True, |
||||
|
help='Name of the room or section') |
||||
|
length = fields.Float(string='Length(ft)', help='The length of the room') |
||||
|
width = fields.Float(string='Width(ft)', help='The width of the room') |
||||
|
height = fields.Float(string='Height(ft)', help='The height of the room') |
||||
|
area = fields.Float(string='Area(ft²)', compute='_compute_area', |
||||
|
help='The total area of the room') |
||||
|
property_id = fields.Many2one('property.property', string='Property', |
||||
|
help='The corresponding property') |
||||
|
|
||||
|
@api.depends('length', 'width', 'height') |
||||
|
def _compute_area(self): |
||||
|
""" The total area of the room for each record is calculated """ |
||||
|
for rec in self: |
||||
|
rec.area = rec.length * rec.width |
@ -0,0 +1,144 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from datetime import datetime |
||||
|
|
||||
|
from odoo import api, fields, models, _ |
||||
|
from odoo.exceptions import ValidationError |
||||
|
|
||||
|
|
||||
|
class PropertyAuction(models.Model): |
||||
|
"""A class to represent the model property auction""" |
||||
|
_name = 'property.auction' |
||||
|
_description = 'Property Auction' |
||||
|
_rec_name = 'auction_seq' |
||||
|
|
||||
|
auction_seq = fields.Char(string='Reference', readonly=True, |
||||
|
required=True, copy=False, default='New') |
||||
|
property_id = fields.Many2one( |
||||
|
'property.property', required=True, |
||||
|
string='Property', |
||||
|
domain="[('state','=','available'), ('sale_rent','=','for_auction')]", |
||||
|
help='Related property for auction') |
||||
|
responsible_id = fields.Many2one('res.users', required=True, |
||||
|
string='Responsible User', |
||||
|
help='The responsible person for ' |
||||
|
'managing the auction') |
||||
|
bid_start_price = fields.Monetary(string='Bid Start Price', |
||||
|
help='The starting bid price for ' |
||||
|
'the property') |
||||
|
final_price = fields.Monetary(string='Final Price', readonly=True, |
||||
|
help='The final price of the property') |
||||
|
state = fields.Selection(selection=[ |
||||
|
('draft', 'Draft'), |
||||
|
('confirmed', 'Confirmed'), |
||||
|
('started', 'Started'), |
||||
|
('ended', 'Ended'), |
||||
|
('canceled', 'Canceled') |
||||
|
], default='draft', string='State', |
||||
|
help="* The \'Draft\' status is used when the auction is at draft.\n" |
||||
|
"* The \'Confirmed\'status is used when the auction is confirmed\n" |
||||
|
"* The \'Started\' status is used when the auction is started.\n" |
||||
|
"* The \'Ended\' status is used when the auction is ended.\n" |
||||
|
"* The \'Cancelled\' status is used when user cancel the auction.") |
||||
|
participant_ids = fields.One2many('property.auction.line', |
||||
|
'auction_id', |
||||
|
string='Participants') |
||||
|
start_time = fields.Datetime(string='Start Time', |
||||
|
help='The starting time of the auction', |
||||
|
required=True) |
||||
|
end_time = fields.Datetime(string='End time', |
||||
|
help='The ending time of the auction', |
||||
|
required=True) |
||||
|
auction_winner_id = fields.Many2one('res.partner', |
||||
|
readonly=True, |
||||
|
string='Auction Winner', |
||||
|
help='The winner of the auction is ' |
||||
|
'selected according to the bids') |
||||
|
sold = fields.Boolean(string='Sold', default=False, |
||||
|
help='Whether the property is sold or not') |
||||
|
company_id = fields.Many2one('res.company', string='Company', |
||||
|
default=lambda self: self.env.company) |
||||
|
currency_id = fields.Many2one('res.currency', 'Currency', |
||||
|
related='company_id.currency_id', |
||||
|
required=True) |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
"""Supering the create function inorder to set the auction_seq number |
||||
|
""" |
||||
|
if vals.get('auction_seq', 'New') == 'New': |
||||
|
vals['auction_seq'] = self.env['ir.sequence'].next_by_code( |
||||
|
'property.auction') or 'New' |
||||
|
res = super(PropertyAuction, self).create(vals) |
||||
|
return res |
||||
|
|
||||
|
@api.constrains('start_time', 'end_time') |
||||
|
def check_start_time_end_time(self): |
||||
|
"""Checks the start and end datetime difference""" |
||||
|
current_date_time = datetime.now() |
||||
|
if (not self.start_time > current_date_time < self.end_time or |
||||
|
not self.start_time < self.end_time): |
||||
|
raise ValidationError(_('Please provide a valid date and time')) |
||||
|
|
||||
|
def action_confirm(self): |
||||
|
"""Changes state to confirmed""" |
||||
|
self.state = 'confirmed' |
||||
|
|
||||
|
def action_start(self): |
||||
|
"""Changes state to started""" |
||||
|
self.state = 'started' |
||||
|
|
||||
|
def action_end(self): |
||||
|
"""Set state to ended and set values to fields auction_winner_id, |
||||
|
final_price, end_time""" |
||||
|
selected_line = \ |
||||
|
sorted(self.participant_ids, key=lambda x: x.bid_amount, |
||||
|
reverse=True)[ |
||||
|
0] |
||||
|
self.auction_winner_id = selected_line.partner_id.id |
||||
|
self.final_price = selected_line.bid_amount |
||||
|
self.end_time = fields.Datetime.now() |
||||
|
self.state = 'ended' |
||||
|
|
||||
|
def action_cancel(self): |
||||
|
"""Changes state to canceled""" |
||||
|
self.state = 'canceled' |
||||
|
|
||||
|
def action_create_sale_order(self): |
||||
|
"""Creates a property sale record""" |
||||
|
self.env['property.sale'].create({ |
||||
|
'property_id': self.property_id.id, |
||||
|
'partner_id': self.auction_winner_id.id, |
||||
|
'order_date': fields.Date.today(), |
||||
|
'sale_price': self.final_price, |
||||
|
}) |
||||
|
self.sold = True |
||||
|
|
||||
|
def action_view_sale_order(self): |
||||
|
"""View all the property sale from the auction""" |
||||
|
return { |
||||
|
'name': 'Property Sale: ' + self.auction_seq, |
||||
|
'view_mode': 'tree,form', |
||||
|
'res_model': 'property.sale', |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'domain': [('property_id', '=', self.property_id.id)] |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class PropertyAuctionLine(models.Model): |
||||
|
"""A class for the model property.auction.line to represent |
||||
|
the participants of the auction""" |
||||
|
_name = 'property.auction.line' |
||||
|
_description = 'Auction Line' |
||||
|
|
||||
|
partner_id = fields.Many2one('res.partner', string='Bidder', |
||||
|
help='The person who is bidding for the ' |
||||
|
'property') |
||||
|
bid_time = fields.Datetime(string='Bid Time', |
||||
|
help='The date and time when the bid was placed') |
||||
|
currency_id = fields.Many2one('res.currency', 'Currency', |
||||
|
default=lambda self: self.env.user.company_id |
||||
|
.currency_id, |
||||
|
required=True) |
||||
|
bid_amount = fields.Monetary(string='bid amount', |
||||
|
help='The amount which is bid') |
||||
|
auction_id = fields.Many2one('property.auction', |
||||
|
string='Property Auction', |
||||
|
help='The corresponding property auction') |
@ -0,0 +1,41 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class PropertyCommission(models.Model): |
||||
|
"""A class for the model property commission to represent |
||||
|
the commission type for property""" |
||||
|
_name = 'property.commission' |
||||
|
_description = 'Property Commission' |
||||
|
|
||||
|
name = fields.Char(string='Commission Name', |
||||
|
help="Name of commission plan", required=True) |
||||
|
commission_type = fields.Selection([('fixed', 'Fixed'), |
||||
|
('percentage', 'Percentage')], |
||||
|
string='Commission Type', required=True, |
||||
|
help='The type of the commission either ' |
||||
|
'fixed or a percentage') |
||||
|
commission = fields.Float(string='Commission Rate', |
||||
|
help="Commission calculating value.") |
||||
|
company_id = fields.Many2one('res.company', string='Company', |
||||
|
default=lambda self: self.env.company) |
@ -0,0 +1,33 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class PropertyFacility(models.Model): |
||||
|
"""A class for the model property facilities to represent |
||||
|
the related facilities for a property""" |
||||
|
_name = 'property.facility' |
||||
|
_description = 'Property Facility' |
||||
|
_rec_name = 'facility' |
||||
|
|
||||
|
facility = fields.Text(string='Facility', required=True, |
||||
|
help='Facilities of the property') |
@ -0,0 +1,39 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class PropertyImages(models.Model): |
||||
|
"""A class for the model property image to represent |
||||
|
the related images for a property""" |
||||
|
_name = 'property.image' |
||||
|
_description = 'Property Images' |
||||
|
|
||||
|
name = fields.Char(string='Name', required=True, |
||||
|
help='Name for the given image') |
||||
|
description = fields.Text(string='Description', |
||||
|
help='A brief description of the image given') |
||||
|
image = fields.Binary(string='Image', required=True, |
||||
|
help='The properties image') |
||||
|
property_id = fields.Many2one('property.property', |
||||
|
string='Property', |
||||
|
help='Related property') |
@ -0,0 +1,43 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class PropertyNearbyConnectivity(models.Model): |
||||
|
"""A class for the model property.nearby.connectivity to represent |
||||
|
the nearby connectives for a property""" |
||||
|
_name = 'property.nearby.connectivity' |
||||
|
_description = 'Property Nearby Connectivity' |
||||
|
|
||||
|
name = fields.Char(string="Name", required=True, |
||||
|
help='Name of the nearby connectivity for the property') |
||||
|
direction = fields.Selection([('north', 'North'), ('south', 'South'), |
||||
|
('east', 'East'), ('west', 'West')], |
||||
|
string='Direction', |
||||
|
help='To which direction is the nearby ' |
||||
|
'connectivity') |
||||
|
kilometer = fields.Float(string="Kilometer", required=True, |
||||
|
help='The distance between the property and ' |
||||
|
'nearby connectivity in kilometers') |
||||
|
property_id = fields.Many2one('property.property', |
||||
|
string="Property Name", |
||||
|
help='The related property') |
@ -0,0 +1,261 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models, _ |
||||
|
|
||||
|
|
||||
|
class Property(models.Model): |
||||
|
"""A class for the model property to represent the property""" |
||||
|
|
||||
|
_name = "property.property" |
||||
|
_description = "Property" |
||||
|
_inherit = ["mail.thread", "mail.activity.mixin"] |
||||
|
|
||||
|
name = fields.Char( |
||||
|
string="Name", required=True, copy=False, help="Name of the Property") |
||||
|
code = fields.Char( |
||||
|
string="Reference", |
||||
|
readonly=True, |
||||
|
copy=False, |
||||
|
default=lambda self: _("New"), |
||||
|
help="Sequence/code for the property",) |
||||
|
property_type = fields.Selection( |
||||
|
[ |
||||
|
("land", "Land"), |
||||
|
("residential", "Residential"), |
||||
|
("commercial", "Commercial"), |
||||
|
("industry", "Industry"), |
||||
|
], |
||||
|
string="Type", |
||||
|
required=True, |
||||
|
help="The type of the property") |
||||
|
state = fields.Selection( |
||||
|
[ |
||||
|
("draft", "Draft"), |
||||
|
("available", "Available"), |
||||
|
("rented", "Rented"), |
||||
|
("sold", "Sold"), |
||||
|
], |
||||
|
required=True, |
||||
|
string="Status", |
||||
|
default="draft", |
||||
|
help="* The 'Draft' status is used when the property is in draft.\n" |
||||
|
"* The 'Available' status is used when the property is " |
||||
|
"available or confirmed\n" |
||||
|
"* The 'Rented' status is used when the property is rented.\n" |
||||
|
"* The 'sold' status is used when the property is sold.\n") |
||||
|
street = fields.Char(string="Street", required=True, help="The street name") |
||||
|
street2 = fields.Char(string="Street2", help="The street2 name") |
||||
|
zip = fields.Char(string="Zip", change_default=True, help="Zip code for the place") |
||||
|
city = fields.Char(string="City", help="The name of the city") |
||||
|
country_id = fields.Many2one( |
||||
|
"res.country", |
||||
|
string="Country", |
||||
|
ondelete="restrict", |
||||
|
required=True, |
||||
|
help="The name of the country") |
||||
|
state_id = fields.Many2one( |
||||
|
"res.country.state", |
||||
|
string="State", |
||||
|
ondelete="restrict", |
||||
|
tracking=True, |
||||
|
domain="[('country_id', '=?', country_id)]", |
||||
|
help="The name of the state") |
||||
|
latitude = fields.Float( |
||||
|
string="Latitude", |
||||
|
digits=(16, 5), |
||||
|
help="The latitude of where the property is " "situated") |
||||
|
longitude = fields.Float( |
||||
|
string="Longitude", |
||||
|
digits=(16, 5), |
||||
|
help="The longitude of where the property is " "situated") |
||||
|
company_id = fields.Many2one( |
||||
|
"res.company", |
||||
|
string="Property Management Company", |
||||
|
default=lambda self: self.env.company) |
||||
|
currency_id = fields.Many2one( |
||||
|
"res.currency", string="Currency", |
||||
|
related="company_id.currency_id") |
||||
|
image = fields.Binary(string="Image", help="Image of the property") |
||||
|
construct_year = fields.Char( |
||||
|
string="Construct Year", size=4, help="Year of construction of" |
||||
|
" the property") |
||||
|
license_no = fields.Char( |
||||
|
string="License No.", help="License number of the property") |
||||
|
landlord_id = fields.Many2one( |
||||
|
"res.partner", string="LandLord", help="The owner " |
||||
|
"of the property") |
||||
|
description = fields.Text( |
||||
|
string="Description", help="A brief description about the property") |
||||
|
responsible_id = fields.Many2one( |
||||
|
"res.users", |
||||
|
string="Responsible Person", |
||||
|
help="The responsible person for " "this property", |
||||
|
default=lambda self: self.env.user) |
||||
|
type_residence = fields.Char( |
||||
|
string="Type of Residence", help="The type of the residence") |
||||
|
total_floor = fields.Integer( |
||||
|
string="Total Floor", |
||||
|
default=1, |
||||
|
help="The total number of floor in " "the property") |
||||
|
bedroom = fields.Integer( |
||||
|
string="Bedrooms", help="Number of bedrooms in the property") |
||||
|
bathroom = fields.Integer( |
||||
|
string="Bathrooms", help="Number of bathrooms in the property") |
||||
|
parking = fields.Integer( |
||||
|
string="Parking", |
||||
|
help="Number of cars or bikes that can be parked " "in the property",) |
||||
|
furnishing = fields.Selection( |
||||
|
[ |
||||
|
("no_furnished", "Not Furnished"), |
||||
|
("half_furnished", "Partially Furnished"), |
||||
|
("furnished", "Fully Furnished"), |
||||
|
], |
||||
|
string="Furnishing", |
||||
|
help="Whether the residence is fully furnished or partially/half " |
||||
|
"furnished or not at all furnished") |
||||
|
land_name = fields.Char(string="Land Name", help="The name of the land") |
||||
|
land_area = fields.Char( |
||||
|
string="Area In Hector", help="The area of the land in hector") |
||||
|
shop_name = fields.Char(string="Shop Name", help="The name of the shop") |
||||
|
industry_name = fields.Char(string="Industry Name", help="The name " |
||||
|
"of the industry") |
||||
|
usage = fields.Char( |
||||
|
string="Used For", help="For what purpose is this property used for") |
||||
|
location = fields.Char(string="Location", help="The location of the" |
||||
|
" property") |
||||
|
property_image_ids = fields.One2many( |
||||
|
"property.image", "property_id", |
||||
|
string="Property Images") |
||||
|
area_measurement_ids = fields.One2many( |
||||
|
"property.area.measure", "property_id", |
||||
|
string="Area Measurement") |
||||
|
total_sq_feet = fields.Float( |
||||
|
string="Total Square Feet", |
||||
|
compute="_compute_total_sq_feet", |
||||
|
help="The total area square feet of the " "property") |
||||
|
facility_ids = fields.Many2many( |
||||
|
"property.facility", string="Facilities", |
||||
|
help="Facilities of the property") |
||||
|
nearby_connectivity_ids = fields.One2many( |
||||
|
"property.nearby.connectivity", "property_id", |
||||
|
string="Nearby Connectives") |
||||
|
property_tags = fields.Many2many( |
||||
|
"property.tag", string="Property Tags", help="Tags for " |
||||
|
"the property") |
||||
|
attachment_id = fields.Many2one("ir.attachment", |
||||
|
string="Attachment") |
||||
|
sale_rent = fields.Selection( |
||||
|
[ |
||||
|
("for_sale", "For Sale"), |
||||
|
("for_tenancy", "For Tenancy"), |
||||
|
("for_auction", "For Auction"), |
||||
|
], string="Sale | Rent", required=True) |
||||
|
unit_price = fields.Monetary( |
||||
|
string="Sales Price", help="Selling price of the Property.") |
||||
|
sale_id = fields.Many2one( |
||||
|
"property.sale", |
||||
|
string="Sale Order", |
||||
|
help="The corresponding property sale", tracking=True) |
||||
|
rent_month = fields.Monetary( |
||||
|
string="Rent/Month", help="Rent price per month", tracking=True) |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
"""Generating sequence number at the time of creation of record""" |
||||
|
if vals.get("code", "New") == "New": |
||||
|
vals["code"] = ( |
||||
|
self.env["ir.sequence"].next_by_code("property.property") or |
||||
|
"New") |
||||
|
res = super(Property, self).create(vals) |
||||
|
self.env['product.template'].create({ |
||||
|
'name': res.name, |
||||
|
'rel_property_id': res.id, |
||||
|
'list_price': res.unit_price, |
||||
|
}) |
||||
|
return res |
||||
|
|
||||
|
def _compute_total_sq_feet(self): |
||||
|
"""Calculates the total square feet of the property""" |
||||
|
for rec in self: |
||||
|
rec.total_sq_feet = sum(rec.mapped("area_measurement_ids").mapped("area")) |
||||
|
|
||||
|
@api.model |
||||
|
def _geo_localize(self, street="", zip="", city="", state="", country=""): |
||||
|
"""Generate Latitude and Longitude based on address""" |
||||
|
geo_obj = self.env["base.geocoder"] |
||||
|
search = geo_obj.geo_query_address( |
||||
|
street=street, zip=zip, city=city, state=state, country=country |
||||
|
) |
||||
|
result = geo_obj.geo_find(search, force_country=country) |
||||
|
if result is None: |
||||
|
search = geo_obj.geo_query_address(city=city, state=state, country=country) |
||||
|
result = geo_obj.geo_find(search, force_country=country) |
||||
|
return result |
||||
|
|
||||
|
@api.onchange("street", "zip", "city", "state_id", "country_id") |
||||
|
def _onchange_address(self): |
||||
|
"""Writing Latitude and Longitude to the record""" |
||||
|
for rec in self.with_context(lang="en_US"): |
||||
|
result = rec._geo_localize( |
||||
|
rec.street, rec.zip, rec.city, rec.state_id.name, rec.country_id.name |
||||
|
) |
||||
|
if result: |
||||
|
rec.write( |
||||
|
{ |
||||
|
"latitude": result[0], |
||||
|
"longitude": result[1], |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
def action_get_map(self): |
||||
|
"""Redirects to google map to show location based on latitude |
||||
|
and longitude""" |
||||
|
return { |
||||
|
"type": "ir.actions.act_url", |
||||
|
"name": "View Map", |
||||
|
"target": "self", |
||||
|
"url": "/map/%s/%s" % (self.latitude, self.longitude), |
||||
|
} |
||||
|
|
||||
|
def action_available(self): |
||||
|
"""Set the state to available""" |
||||
|
self.state = "available" |
||||
|
|
||||
|
def action_property_sale_view(self): |
||||
|
"""View Sale order Of the Property""" |
||||
|
return { |
||||
|
"name": "Property Sale: " + self.code, |
||||
|
"view_mode": "tree,form", |
||||
|
"res_model": "property.sale", |
||||
|
"type": "ir.actions.act_window", |
||||
|
"res_id": self.sale_id.id, |
||||
|
} |
||||
|
|
||||
|
def action_property_rental_view(self): |
||||
|
"""View rental order Of the Property""" |
||||
|
return { |
||||
|
"name": "Property Rental: " + self.code, |
||||
|
"view_mode": "tree,form", |
||||
|
"res_model": "property.rental", |
||||
|
"type": "ir.actions.act_window", |
||||
|
"domain": [("property_id", "=", self.id)], |
||||
|
} |
@ -0,0 +1,158 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models, _ |
||||
|
from odoo.exceptions import ValidationError |
||||
|
|
||||
|
|
||||
|
class PropertyRental(models.Model): |
||||
|
"""A class for the model property rental to represent |
||||
|
the rental order of a property""" |
||||
|
_name = 'property.rental' |
||||
|
_description = 'Property Rent' |
||||
|
_inherit = ['mail.thread', 'mail.activity.mixin'] |
||||
|
|
||||
|
name = fields.Char(string='Reference', readonly=True, |
||||
|
required=True, copy=False, default='New', |
||||
|
help='The reference code/sequence of the property ' |
||||
|
'rental') |
||||
|
property_id = fields.Many2one( |
||||
|
'property.property', string='Property', |
||||
|
required=True, |
||||
|
help='The property to be rented', |
||||
|
domain="[('state','=','available'),('sale_rent','=','for_tenancy')]") |
||||
|
owner_id = fields.Many2one('res.partner', string='Land Lord', |
||||
|
related='property_id.landlord_id', store=True, |
||||
|
help='The owner / land lord of the property') |
||||
|
rent_price = fields.Monetary(string='Rent Price', |
||||
|
related='property_id.rent_month', |
||||
|
help='The Rental price per month of the ' |
||||
|
'property') |
||||
|
renter_id = fields.Many2one('res.partner', string='Renter', required=True, |
||||
|
help='The customer who is renting the property') |
||||
|
state = fields.Selection( |
||||
|
[('draft', 'Draft'), ('in_contract', 'In Contract'), |
||||
|
('expired', 'Expired'), ('cancel', 'Cancelled')], |
||||
|
required=True, default='draft', string='Status', tracking=True, |
||||
|
help="* The \'Draft\' status is used when the rental is in draft.\n" |
||||
|
"* The \'In Contract\' status is used when the property is rented " |
||||
|
"and is in contract\n" |
||||
|
"* The \'Expired\' status is used when the property rented " |
||||
|
"contract has expired.\n" |
||||
|
"* The \'Cancelled\' status is used when the property rental " |
||||
|
"is cancelled.\n") |
||||
|
start_date = fields.Date(string='Start Date', required=True, |
||||
|
help='The starting date of the rent') |
||||
|
end_date = fields.Date(string='End Date', required=True, |
||||
|
help='The Ending date of the rent') |
||||
|
invoice_count = fields.Integer(strinf='Invoice Count', |
||||
|
compute='_compute_invoice_count', |
||||
|
help='The Invoices related to this rental') |
||||
|
rental_bills_ids = fields.One2many('rental.bill', 'rental_id') |
||||
|
invoice_date = fields.Date(string='Invoice Date', |
||||
|
help='The latest Invoiced Date') |
||||
|
next_invoice = fields.Date(string='Next Invoice', |
||||
|
compute='_compute_next_invoice', |
||||
|
help='The next invoicing date') |
||||
|
company_id = fields.Many2one('res.company', |
||||
|
string="Property Management Company", |
||||
|
default=lambda self: self.env.company) |
||||
|
currency_id = fields.Many2one('res.currency', string='Currency', |
||||
|
related='company_id.currency_id') |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
"""Setting the sequence when record is created""" |
||||
|
if vals.get('name', 'New') == 'New': |
||||
|
vals['name'] = self.env['ir.sequence'].next_by_code( |
||||
|
'property.rent') or 'New' |
||||
|
res = super(PropertyRental, self).create(vals) |
||||
|
return res |
||||
|
|
||||
|
def _compute_invoice_count(self): |
||||
|
"""Calculates the Invoice count for the property""" |
||||
|
self.invoice_count = self.env['account.move'].search_count( |
||||
|
[('property_rental_id', '=', self.id)]) |
||||
|
|
||||
|
def _compute_next_invoice(self): |
||||
|
"""Computes the next_invoice date""" |
||||
|
if self.invoice_date and fields.Date.today() < self.end_date: |
||||
|
self.next_invoice = fields.Date.add(self.invoice_date, months=1) |
||||
|
else: |
||||
|
self.next_invoice = False |
||||
|
|
||||
|
def action_cancel(self): |
||||
|
""" Changes the record stage to cancel """ |
||||
|
self.property_id.state = 'available' |
||||
|
self.state = 'cancel' |
||||
|
|
||||
|
def action_create_contract(self): |
||||
|
"""Creates an invoice for contract. Checks if the customer |
||||
|
is blacklisted.""" |
||||
|
if self.renter_id.blacklisted: |
||||
|
raise ValidationError( |
||||
|
_('The Customer %r is Blacklisted.', self.renter_id.name)) |
||||
|
self.env['account.move'].create({ |
||||
|
'move_type': 'out_invoice', |
||||
|
'partner_id': self.renter_id.id, |
||||
|
'property_rental_id': self.id, |
||||
|
'invoice_line_ids': [fields.Command.create({ |
||||
|
'name': self.property_id.name, |
||||
|
'price_unit': self.rent_price, |
||||
|
'currency_id': self.env.user.company_id.currency_id.id, |
||||
|
})] |
||||
|
}) |
||||
|
self.invoice_date = fields.Date.today() |
||||
|
self.property_id.state = 'rented' |
||||
|
self.state = 'in_contract' |
||||
|
|
||||
|
def action_view_invoice(self): |
||||
|
"""Views all the related invoice in tree view related to the records""" |
||||
|
return { |
||||
|
'name': _('Invoices'), |
||||
|
'view_mode': 'tree,form', |
||||
|
'res_model': 'account.move', |
||||
|
'target': 'current', |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'domain': [('property_rental_id', '=', self.id), |
||||
|
('move_type', '=', 'out_invoice')] |
||||
|
} |
||||
|
|
||||
|
@api.model |
||||
|
def action_check_rental(self): |
||||
|
"""Scheduled action to create the next invoice for rent |
||||
|
else set it as expired.""" |
||||
|
records = self.env['property.rental'].search( |
||||
|
[('state', '=', 'in_contract')]) |
||||
|
for rec in records: |
||||
|
if not rec.next_invoice: |
||||
|
rec.state = 'expired' |
||||
|
if fields.Date.today() == rec.next_invoice: |
||||
|
self.env['account.move'].create({ |
||||
|
'move_type': 'out_invoice', |
||||
|
'property_rental_id': rec.id, |
||||
|
'invoice_line_ids': [fields.Command.create({ |
||||
|
'name': rec.property_id.name, |
||||
|
'price_unit': rec.rent_price, |
||||
|
'currency_id': rec.env.user.company_id.currency_id.id, |
||||
|
})] |
||||
|
}) |
||||
|
rec.invoice_date = fields.Date.today() |
@ -0,0 +1,183 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models, _ |
||||
|
from odoo.exceptions import ValidationError |
||||
|
|
||||
|
|
||||
|
class PropertySale(models.Model): |
||||
|
"""A class for the model property sale to represent |
||||
|
the sale order of a property""" |
||||
|
_name = 'property.sale' |
||||
|
_description = 'Sale of the Property' |
||||
|
_inherit = ['mail.thread', 'mail.activity.mixin'] |
||||
|
_order = 'name desc' |
||||
|
|
||||
|
name = fields.Char(string='Reference', readonly=True, |
||||
|
copy=False, default='New', |
||||
|
help='The reference code/sequence of the property sale') |
||||
|
property_id = fields.Many2one( |
||||
|
'property.property', required=True, |
||||
|
domain="[('state', '=', 'available'), ('sale_rent', '=', 'for_sale')]", |
||||
|
string="Property Name", |
||||
|
help='The property to be sold') |
||||
|
partner_id = fields.Many2one('res.partner', string="Customer", |
||||
|
required=True, |
||||
|
help='The customer who is buying the property') |
||||
|
order_date = fields.Date(string="Order Date", |
||||
|
help='The order date of property') |
||||
|
state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirm')], |
||||
|
default='draft', string="State", tracking=True) |
||||
|
invoice_id = fields.Many2one('account.move', readonly=True, |
||||
|
string="Invoice", |
||||
|
help='The invoice reference for the property') |
||||
|
invoiced = fields.Boolean(string='Invoiced', |
||||
|
help='Is the property sale invoiced') |
||||
|
billed = fields.Boolean(string='Commission Billed', |
||||
|
help='Is the commission given for this property ' |
||||
|
'sale') |
||||
|
sale_price = fields.Monetary(string="Sale Price", readonly=False, |
||||
|
related='property_id.unit_price', |
||||
|
help='The price of the property') |
||||
|
any_broker = fields.Boolean(string='Any Broker', |
||||
|
help="Enable if this sale have a Broker") |
||||
|
broker_id = fields.Many2one('res.partner', string="Broker name", |
||||
|
help='The broker for this property sale') |
||||
|
commission_plan_id = fields.Many2one('property.commission', |
||||
|
string="Commission Plan", |
||||
|
help="Select the Commission Plan for " |
||||
|
"the broker") |
||||
|
commission_type = fields.Char( |
||||
|
compute='_compute_commission_and_commission_type', |
||||
|
string="Commission Type", |
||||
|
help='The type of the commission') |
||||
|
commission = fields.Monetary( |
||||
|
string='Commission', compute='_compute_commission_and_commission_type', |
||||
|
help='THe amount of commission') |
||||
|
company_id = fields.Many2one('res.company', |
||||
|
string="Property Management Company", |
||||
|
default=lambda self: self.env.company) |
||||
|
currency_id = fields.Many2one('res.currency', 'Currency', |
||||
|
related='company_id.currency_id', |
||||
|
required=True) |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
"""Generate Reference for the sale order""" |
||||
|
if vals.get('name', _('New')) == _('New'): |
||||
|
vals['name'] = self.env['ir.sequence'].next_by_code( |
||||
|
'property.sale') or 'New' |
||||
|
res = super(PropertySale, self).create(vals) |
||||
|
return res |
||||
|
|
||||
|
@api.depends('commission_plan_id', 'sale_price') |
||||
|
def _compute_commission_and_commission_type(self): |
||||
|
"""Calculate commission based on commission plan and sale price""" |
||||
|
for rec in self: |
||||
|
rec.commission_type = rec.commission_plan_id.commission_type |
||||
|
if rec.commission_plan_id.commission_type == 'fixed': |
||||
|
rec.commission = rec.commission_plan_id.commission |
||||
|
else: |
||||
|
rec.commission = (rec.sale_price * |
||||
|
rec.commission_plan_id.commission / 100) |
||||
|
|
||||
|
def create_invoice(self): |
||||
|
"""Generate Invoice Based on the Monetary Values and return |
||||
|
Invoice Form View""" |
||||
|
self.invoiced = True |
||||
|
invoice = self.env['account.move'].create({ |
||||
|
'company_id': self.env.user.company_id.id, |
||||
|
'partner_id': self.partner_id.id, |
||||
|
'move_type': 'out_invoice', |
||||
|
'property_order_id': self.id, |
||||
|
'invoice_line_ids': [fields.Command.create({ |
||||
|
'name': self.property_id.name, |
||||
|
'price_unit': self.sale_price, |
||||
|
'currency_id': self.env.user.company_id.currency_id.id, |
||||
|
})] |
||||
|
}) |
||||
|
return { |
||||
|
'name': _('Invoice'), |
||||
|
'view_mode': 'form', |
||||
|
'res_model': 'account.move', |
||||
|
'target': 'current', |
||||
|
'res_id': invoice.id, |
||||
|
'type': 'ir.actions.act_window', |
||||
|
} |
||||
|
|
||||
|
def commission_bill(self): |
||||
|
"""Generate Bills Based on the Monetary Values and return |
||||
|
Bills Form View""" |
||||
|
self.billed = True |
||||
|
invoice = self.env['account.move'].create({ |
||||
|
'company_id': self.env.user.company_id.id, |
||||
|
'partner_id': self.broker_id.id, |
||||
|
'move_type': 'in_invoice', |
||||
|
'property_order_id': self.id, |
||||
|
'invoice_line_ids': [fields.Command.create({ |
||||
|
'name': self.property_id.name, |
||||
|
'price_unit': self.commission, |
||||
|
'currency_id': self.env.user.company_id.currency_id.id, |
||||
|
})] |
||||
|
}) |
||||
|
return { |
||||
|
'name': _('Commission Bill'), |
||||
|
'view_mode': 'form', |
||||
|
'res_model': 'account.move', |
||||
|
'target': 'current', |
||||
|
'res_id': invoice.id, |
||||
|
'type': 'ir.actions.act_window', |
||||
|
} |
||||
|
|
||||
|
def action_view_invoice(self): |
||||
|
"""Return Invoices Tree View""" |
||||
|
return { |
||||
|
'name': _('Invoices'), |
||||
|
'view_mode': 'tree,form', |
||||
|
'res_model': 'account.move', |
||||
|
'target': 'current', |
||||
|
'context': {'create': False}, |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'domain': [('property_order_id', '=', self.id), |
||||
|
('move_type', '=', 'out_invoice')] |
||||
|
} |
||||
|
|
||||
|
def action_view_commission_bill(self): |
||||
|
"""Return Bills Tree View""" |
||||
|
return { |
||||
|
'name': _('Commission Bills'), |
||||
|
'view_mode': 'tree,form', |
||||
|
'res_model': 'account.move', |
||||
|
'target': 'current', |
||||
|
'context': {'create': False}, |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'domain': [('property_order_id', '=', self.id), |
||||
|
('move_type', '=', 'in_invoice')] |
||||
|
} |
||||
|
|
||||
|
def action_confirm(self): |
||||
|
"""Confirm the sale order and Change necessary fields""" |
||||
|
if self.partner_id.blacklisted: |
||||
|
raise ValidationError( |
||||
|
_('The Customer %r is Blacklisted.', self.partner_id.name)) |
||||
|
self.state = 'confirm' |
||||
|
self.property_id.state = 'sold' |
||||
|
self.property_id.sale_id = self.id |
@ -0,0 +1,32 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class PropertyTag(models.Model): |
||||
|
"""A class for the model property tags to represent |
||||
|
the related tags for a property""" |
||||
|
_name = 'property.tag' |
||||
|
_description = 'Property Tag' |
||||
|
_rec_name = 'tag' |
||||
|
|
||||
|
tag = fields.Char(string='Tag', required=True, help='Name of the tag') |
@ -0,0 +1,40 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class RentalBill(models.Model): |
||||
|
"""A class for the model rental bills to represent |
||||
|
the related bills for a property rental""" |
||||
|
_name = 'rental.bill' |
||||
|
_description = 'Rental Bill' |
||||
|
|
||||
|
company_id = fields.Many2one('res.company', string='Company', |
||||
|
default=lambda self: self.env.company) |
||||
|
bill_no = fields.Char(string='Bill Number', required=True, |
||||
|
help='The bill number of the bill') |
||||
|
name = fields.Char(string='Name', required=True, |
||||
|
help='The name of the bill') |
||||
|
amount = fields.Float(string='Amount', |
||||
|
help='The amount listed in the bill') |
||||
|
rental_id = fields.Many2one('property.rental', string='Property Rental', |
||||
|
help='The corresponding Property Rental') |
@ -0,0 +1,39 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class ResPartner(models.Model): |
||||
|
"""A class that inherits the already existing model res partner""" |
||||
|
_inherit = 'res.partner' |
||||
|
|
||||
|
blacklisted = fields.Boolean(string='Blacklisted', default=False, |
||||
|
help='Is this contact a blacklisted contact ' |
||||
|
'or not') |
||||
|
|
||||
|
def action_add_blacklist(self): |
||||
|
"""Sets the field blacklisted to True""" |
||||
|
self.blacklisted = True |
||||
|
|
||||
|
def action_remove_blacklist(self): |
||||
|
"""Sets the field blacklisted to False""" |
||||
|
self.blacklisted = False |
@ -0,0 +1,156 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Report action for brochure --> |
||||
|
<record id="action_property_brochure" model="ir.actions.report"> |
||||
|
<field name="name">Property Brochure</field> |
||||
|
<field name="model">property.property</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">advanced_property_management.property_brochure</field> |
||||
|
<field name="report_file">advanced_property_management.property_brochure</field> |
||||
|
<field name="print_report_name">'Property Brochure - %s' %(object.name)</field> |
||||
|
<field name="binding_model_id" ref="model_property_property"/> |
||||
|
<field name="binding_type">report</field> |
||||
|
</record> |
||||
|
<!-- Template for brochure --> |
||||
|
<template id="property_brochure"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-call="web.external_layout"> |
||||
|
<div class="page"> |
||||
|
<t t-foreach="docs" t-as="data"> |
||||
|
<img t-attf-src="data:image/png;base64,{{data['image']}}" |
||||
|
style="max-height: 300px; max-width: 400px;"/> |
||||
|
<br/> |
||||
|
<br/> |
||||
|
<span style="font-size:25px;"> |
||||
|
<strong> |
||||
|
<t t-esc="data['name']"/> |
||||
|
</strong> |
||||
|
</span> |
||||
|
<br/> |
||||
|
<span t-if="data['street']"><t t-esc="data['street']"/>, |
||||
|
</span> |
||||
|
<span t-if="data['street2']"><t |
||||
|
t-esc="data['street2']"/>, |
||||
|
<br/> |
||||
|
</span> |
||||
|
<span t-if="data['city']"><t t-esc="data['city']"/>, |
||||
|
</span> |
||||
|
<span t-if="data['zip']"> |
||||
|
<t t-esc="data['zip']"/> |
||||
|
<br/> |
||||
|
</span> |
||||
|
<span t-if="data['state_id']"><t |
||||
|
t-esc="data['state_id'].name"/>, |
||||
|
</span> |
||||
|
<span t-if="data['country_id']"> |
||||
|
<t t-esc="data['country_id'].name"/> |
||||
|
<br/> |
||||
|
</span> |
||||
|
<br/> |
||||
|
<br/> |
||||
|
<span id="about_property"> |
||||
|
<strong style="font-size:20px;">About Property |
||||
|
</strong> |
||||
|
<table class="table table-borderless"> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<strong>Latitude</strong> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="data['latitude']"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<strong>Longitude</strong> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="data['longitude']"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<strong>Constructed Year</strong> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="data['construct_year']"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<strong>License Number</strong> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="data['license_no']"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<strong>Property Type</strong> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="data['property_type']"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<strong>Property Measurement</strong> |
||||
|
</td> |
||||
|
<td><t t-esc="data['total_sq_feet']"/>(ft²) |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
<br/> |
||||
|
<br/> |
||||
|
</span> |
||||
|
<span t-if="data['facility_ids']"> |
||||
|
<strong style="font-size:20px;">Property |
||||
|
Facilities |
||||
|
</strong> |
||||
|
<ul class="list-group" |
||||
|
t-foreach="data['facility_ids']" t-as="rec"> |
||||
|
<li class="list-group-item list-group-item-info"> |
||||
|
<t t-esc="rec['facility']"/> |
||||
|
</li> |
||||
|
</ul> |
||||
|
<br/> |
||||
|
<br/> |
||||
|
</span> |
||||
|
<span t-if="data['nearby_connectivity_ids']"> |
||||
|
<strong style="font-size:20px;">Nearby Connectives |
||||
|
</strong> |
||||
|
<ul class="list-group" |
||||
|
t-foreach="data['nearby_connectivity_ids']" |
||||
|
t-as="rec"> |
||||
|
<li class="list-group-item list-group-item-warning"> |
||||
|
<t t-esc="rec['name']"/> |
||||
|
--> |
||||
|
<t t-esc="rec['kilometer']"/> |
||||
|
Kilometers |
||||
|
</li> |
||||
|
</ul> |
||||
|
<br/> |
||||
|
<br/> |
||||
|
</span> |
||||
|
<span id="property_images" |
||||
|
t-if="data['property_image_ids']"> |
||||
|
<strong style="font-size:20px;">Property Images |
||||
|
</strong> |
||||
|
<div class="card-group" |
||||
|
t-foreach="data['property_image_ids']" |
||||
|
t-as="rec"> |
||||
|
<div class="card"> |
||||
|
<img t-attf-src="data:image/png;base64,{{rec['image']}}" |
||||
|
style="max-height: 200px; max-width: 300px;"/> |
||||
|
<div class="card-body"> |
||||
|
<h5 class="card-title"> |
||||
|
<t t-esc="rec['name']"/> |
||||
|
</h5> |
||||
|
<p class="card-text"> |
||||
|
<t t-esc="rec['description']"/> |
||||
|
</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
<br/> |
||||
|
</div> |
||||
|
</span> |
||||
|
</t> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
</odoo> |
@ -0,0 +1,76 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- Report action for property sale --> |
||||
|
<record id="property_sale_report_action_report" model="ir.actions.report"> |
||||
|
<field name="name">Property Sale Report</field> |
||||
|
<field name="model">property.sale.report</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">advanced_property_management.property_sale_report_template</field> |
||||
|
<field name="report_file">advanced_property_management.property_sale_report_template</field> |
||||
|
</record> |
||||
|
|
||||
|
<!-- Report template for Property sale --> |
||||
|
<template id="property_sale_report_template"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-call="web.external_layout"> |
||||
|
<h1>Property Sale Report</h1> |
||||
|
<t t-if="from_date"> |
||||
|
<div> |
||||
|
<strong>Date From :</strong> |
||||
|
<span t-esc="from_date"/> |
||||
|
</div> |
||||
|
</t> |
||||
|
<t t-if="to_date"> |
||||
|
<div> |
||||
|
<strong>Date To :</strong> |
||||
|
<span t-esc="to_date"/> |
||||
|
</div> |
||||
|
</t> |
||||
|
<t t-if="partner_name"> |
||||
|
<div> |
||||
|
<strong>Partner Name :</strong> |
||||
|
<span t-esc="partner_name"/> |
||||
|
</div> |
||||
|
</t> |
||||
|
<t t-if="property_name"> |
||||
|
<div> |
||||
|
<strong>Property Name :</strong> |
||||
|
<span t-esc="property_name"/> |
||||
|
</div> |
||||
|
</t> |
||||
|
<table class="table"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>SL.no</th> |
||||
|
<th>Customer</th> |
||||
|
<th>Property Name</th> |
||||
|
<th>Create Date</th> |
||||
|
<th>State</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<t t-set="i" t-value="0"/> |
||||
|
<tbody> |
||||
|
<tr t-foreach="datas" t-as="line"> |
||||
|
<td> |
||||
|
<t t-set="i" t-value="i + 1"/> |
||||
|
<span t-esc="i"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-esc="line['customer']"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-esc="line['name']"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-esc="line['create_date']"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span t-esc="line['state']"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
</odoo> |
@ -0,0 +1,22 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<!-- Property Management group category --> |
||||
|
<record model="ir.module.category" id="property_access"> |
||||
|
<field name="name">Property Management</field> |
||||
|
<field name="description">access right for Property Management module</field> |
||||
|
<field name="sequence">1</field> |
||||
|
</record> |
||||
|
<!-- Property agent group --> |
||||
|
<record id="group_property_agent" model="res.groups"> |
||||
|
<field name="name">Property Agent</field> |
||||
|
<field name="category_id" ref="property_access"/> |
||||
|
</record> |
||||
|
<!-- Property manager group --> |
||||
|
<record id="group_property_manager" model="res.groups"> |
||||
|
<field name="name">Property Manager</field> |
||||
|
<field name="category_id" ref="property_access"/> |
||||
|
<field name="implied_ids" eval="[(4, ref('group_property_agent'))]"/> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
|
@ -0,0 +1,37 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<!-- Property company rule --> |
||||
|
<record id="property_property_company_rule" model="ir.rule"> |
||||
|
<field name="name">property multi company rule</field> |
||||
|
<field name="model_id" ref="model_property_property"/> |
||||
|
<field name="domain_force">['|', ('company_id', '=', False), |
||||
|
('company_id', '=', company_id)] |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- Property sale company rule --> |
||||
|
<record id="property_sale_company_rule" model="ir.rule"> |
||||
|
<field name="name">property sale multi company rule</field> |
||||
|
<field name="model_id" ref="model_property_sale"/> |
||||
|
<field name="domain_force">['|', ('company_id', '=', False), |
||||
|
('company_id', '=', company_id)] |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- Property rental company rule --> |
||||
|
<record id="property_rental_company_rule" model="ir.rule"> |
||||
|
<field name="name">property rental multi company rule</field> |
||||
|
<field name="model_id" ref="model_property_rental"/> |
||||
|
<field name="domain_force">['|', ('company_id', '=', False), |
||||
|
('company_id', '=', company_id)] |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- Property auction company rule --> |
||||
|
<record id="property_auction_company_rule" model="ir.rule"> |
||||
|
<field name="name">multi company rule</field> |
||||
|
<field name="model_id" ref="model_property_auction"/> |
||||
|
<field name="domain_force">['|', ('company_id', '=', False), |
||||
|
('company_id', '=', company_id)] |
||||
|
</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 967 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 515 KiB |
After Width: | Height: | Size: 156 KiB |
After Width: | Height: | Size: 163 KiB |
After Width: | Height: | Size: 153 KiB |
After Width: | Height: | Size: 158 KiB |
After Width: | Height: | Size: 172 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 103 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 342 KiB |
After Width: | Height: | Size: 139 KiB |
After Width: | Height: | Size: 139 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 113 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 446 KiB |
After Width: | Height: | Size: 165 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 172 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 278 KiB |