diff --git a/.gitignore b/.gitignore index b6e47617de1..ccb1ceaef60 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,8 @@ dmypy.json # Pyre type checker .pyre/ + +# Ignore README files +README +README.* +README.md diff --git a/README.md b/README.md deleted file mode 100644 index a0158d919ee..00000000000 --- a/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Odoo tutorials - -This repository hosts the code for the bases of the modules used in the -[official Odoo tutorials](https://www.odoo.com/documentation/latest/developer/tutorials.html). - -It has 3 branches for each Odoo version: one for the bases, one for the -[Discover the JS framework](https://www.odoo.com/documentation/latest/developer/tutorials/discover_js_framework.html) -tutorial's solutions, and one for the -[Master the Odoo web framework](https://www.odoo.com/documentation/latest/developer/tutorials/master_odoo_web_framework.html) -tutorial's solutions. For example, `17.0`, `17.0-discover-js-framework-solutions` and -`17.0-master-odoo-web-framework-solutions`. diff --git a/estate/__init__.py b/estate/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/estate/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/estate/__manifest__.py b/estate/__manifest__.py new file mode 100644 index 00000000000..2af03883276 --- /dev/null +++ b/estate/__manifest__.py @@ -0,0 +1,27 @@ +{ + 'name': 'Real Estate', + 'version': '1.0', + 'license': 'LGPL-3', + 'summary': 'Real estate advertisement management', + 'description': """ + Real Estate tutorial module. + """, + 'author': 'Parth Sawant', + 'depends': ['base'], + 'category': 'Real Estate', + 'data': [ + 'security/ir.model.access.csv', + 'views/estate_property_views.xml', + 'views/estate_property_type_views.xml', + 'views/estate_property_tags_views.xml', + 'views/estate_property_offer_views.xml', + 'views/estate_menus.xml', + + ], + 'demo': [ + 'demo/demo.xml', + 'demo/demo_tag.xml', + 'demo/demo_type.xml', + ], + 'application': True, +} diff --git a/estate/demo/demo.xml b/estate/demo/demo.xml new file mode 100644 index 00000000000..bb573f6c141 --- /dev/null +++ b/estate/demo/demo.xml @@ -0,0 +1,195 @@ + + + Modern Downtown Apartment + Sleek apartment in the heart of the city + 10001 + 2025-06-01 + 250000 + 245000 + 2 + 85 + 1 + False + False + 0 + north + + + + Suburban Family Home + Spacious home with a large backyard + 20002 + 2025-07-15 + 450000 + 440000 + 4 + 180 + 3 + True + True + 120 + south + + + + Cozy Studio Near University + Compact studio ideal for students + 30003 + 2025-05-01 + 95000 + 90000 + 1 + 35 + 1 + False + False + 0 + east + + + + Luxury Beachfront Villa + Stunning villa with direct beach access + 40004 + 2025-09-01 + 1200000 + 1150000 + 5 + 350 + 4 + True + True + 500 + south + + + + Countryside Cottage + Charming cottage surrounded by nature + 50005 + 2025-08-01 + 175000 + 170000 + 2 + 90 + 2 + False + True + 200 + west + + + + City Center Penthouse + Exclusive penthouse with panoramic views + 60006 + 2025-10-01 + 850000 + 820000 + 3 + 210 + 2 + True + False + 0 + north + + + + Industrial Loft Conversion + Trendy loft in a converted warehouse + 70007 + 2025-06-15 + 320000 + 310000 + 2 + 130 + 1 + False + False + 0 + east + + + + Hillside Bungalow + Peaceful bungalow with valley views + 80008 + 2025-07-01 + 290000 + 280000 + 3 + 110 + 2 + True + True + 80 + west + + + + Gated Community Townhouse + Secure townhouse in a premium gated complex + 90009 + 2025-11-01 + 530000 + 515000 + 3 + 150 + 2 + True + True + 60 + south + + + + Riverside Duplex + Beautiful duplex with riverside views + 10010 + 2025-08-15 + 390000 + 375000 + 4 + 160 + 3 + True + True + 90 + east + + + + Mountain Cabin Retreat + Rustic cabin with stunning mountain views + 11011 + 2025-09-15 + 210000 + 200000 + 2 + 75 + 1 + False + True + 150 + south + + + + + Historic Downtown Loft + Unique loft in a historic building + 12012 + 2025-10-15 + 280000 + 270000 + 1 + 95 + 2 + False + False + 0 + north + + + diff --git a/estate/demo/demo_tag.xml b/estate/demo/demo_tag.xml new file mode 100644 index 00000000000..78428084600 --- /dev/null +++ b/estate/demo/demo_tag.xml @@ -0,0 +1,43 @@ + + + + Cozy + + + + Modern + + + + Luxury + + + + Renovated + + + + New Build + + + + Sea View + + + + City Center + + + + Quiet Neighborhood + + + + Pet Friendly + + + + Gated Community + + + \ No newline at end of file diff --git a/estate/demo/demo_type.xml b/estate/demo/demo_type.xml new file mode 100644 index 00000000000..6d4f8a99ec9 --- /dev/null +++ b/estate/demo/demo_type.xml @@ -0,0 +1,31 @@ + + + + Apartment + + + + House + + + + Villa + + + + Studio + + + + Land + + + + Commercial + + + + Industrial + + + \ No newline at end of file diff --git a/estate/models/__init__.py b/estate/models/__init__.py new file mode 100644 index 00000000000..2f1821a39c1 --- /dev/null +++ b/estate/models/__init__.py @@ -0,0 +1,4 @@ +from . import estate_property +from . import estate_property_type +from . import estate_property_tag +from . import estate_property_offer diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py new file mode 100644 index 00000000000..f07137a79de --- /dev/null +++ b/estate/models/estate_property.py @@ -0,0 +1,82 @@ +from dateutil.relativedelta import relativedelta + +from odoo import api,fields,models + + +class EstateProperty(models.Model): + _name = 'estate.property' + _description = 'Real Estate Property' + + name = fields.Char(string="Property Name", required=True, help='Enter the name of the property') + image = fields.Image(string="Property Image", max_width=1024, max_height=1024) + description = fields.Text(string="Property Description", help='Enter a description of the property') + postcode = fields.Char(string="Postcode", help='Enter the postcode of the property') + date_availability = fields.Date( + string="Availability Date", + help='Enter the date when the property becomes available', + copy=False, + default=lambda self : fields.Date.today() + relativedelta(months=3) + ) + expected_price = fields.Float(string="Expected Price", required=True, help='Enter the expected price of the property') + selling_price = fields.Float(string="Selling Price", help='Enter the selling price of the property', readonly=True, copy=False) + bedrooms = fields.Integer(string="Number of Bedrooms", help='Enter the number of bedrooms in the property', default=2) + living_area = fields.Integer(string="Living Area", help='Enter the living area of the property in square meters') + facades = fields.Integer(string="Number of Facades", help='Enter the number of facades of the property') + garage = fields.Boolean(string="Garage", help='Check if the property has a garage') + garden = fields.Boolean(string="Garden", help='Check if the property has a garden') + garden_area = fields.Integer(string="Garden Area", help='Enter the area of the garden in square meters') + garden_orientation = fields.Selection( + selection=[ + ('north', "North"), + ('south', "South"), + ('east', "East"), + ('west', "West"), + ], + string="Garden Orientation", + help='Select the orientation of the garden' + ) + active = fields.Boolean(string="Active", default=True, help='Set to False to archive the property') + state = fields.Selection( + selection=[ + ('new', "New Offer"), + ('offer_received', "Offer Received"), + ('offer_accepted', "Offer Accepted"), + ('sold', "Sold"), + ('canceled', "Canceled") + ], + string="Status", + required=True, + copy=False, + default='new', + help='Current status of the property' + ) + property_type_id = fields.Many2one('estate.property.type', string="Property Type") + buyer_id = fields.Many2one('res.partner', string="Buyer", copy=False) + seller_id = fields.Many2one('res.users', string="Salesperson", default=lambda self:self.env.user) + + tag_ids = fields.Many2many('estate.property.tag', string="Property Tags") + offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offers") + + total_area = fields.Integer(string="Total Area", compute="_compute_total_area", help="Total area of the property including living area and garden area", store=True ) + best_price = fields.Float(string="Best Offer", compute="_compute_best_price", help="Best offer received for the property", store=True) + + + + @api.depends("living_area","garden_area") + def _compute_total_area(self): + for record in self: + record.total_area = record.living_area + record.garden_area + + @api.depends("offer_ids.price") + def _compute_best_price(self): + for record in self: + record.best_price = max(record.offer_ids.mapped('price')) if record.offer_ids else 0 + + @api.onchange("garden") + def _onchange_garden(self): + if self.garden == True: + self.garden_area = 10 + self.garden_orientation ='north' + else: + self.garden_area = 0 + self.garden_orientation = False diff --git a/estate/models/estate_property_offer.py b/estate/models/estate_property_offer.py new file mode 100644 index 00000000000..6cac8667250 --- /dev/null +++ b/estate/models/estate_property_offer.py @@ -0,0 +1,37 @@ +from odoo import api,fields, models +from datetime import timedelta + +class EstatePropertyOffer(models.Model): + _name = 'estate.property.offer' + _description = 'Estate Property Offer' + + price = fields.Float(string="Price") + + status = fields.Selection( + selection=[ + ('accepted', "Accepted"), + ('refused', "Refused"), + ], + string="Status", + copy=False + ) + + partner_id = fields.Many2one('res.partner', required=True, string="Partner") + property_id = fields.Many2one('estate.property', required=True, string="Property") + + validity = fields.Integer(string="Validity (days)", default=7, help='Number of days the offer is valid for') + + date_deadline = fields.Date(string="Deadline", compute="_compute_date_deadline", inverse="_inverse_date_deadline", help="Deadline for the offer based on the validity period") + + @api.depends("validity","create_date") + def _compute_date_deadline(self): + for record in self: + start = record.create_date.date() if record.create_date else fields.Date.today() + record.date_deadline = start + timedelta(days=record.validity) + + def _inverse_date_deadline(self): + for record in self: + start = record.create_date.date() if record.create_date else fields.Date.today() + record.validity = (record.date_deadline - start).days + + \ No newline at end of file diff --git a/estate/models/estate_property_tag.py b/estate/models/estate_property_tag.py new file mode 100644 index 00000000000..cc16de2e5e3 --- /dev/null +++ b/estate/models/estate_property_tag.py @@ -0,0 +1,8 @@ +from odoo import fields, models + + +class EstatePropertyTag(models.Model): + _name = 'estate.property.tag' + _description = 'Property Tag' + + name = fields.Char(string="Name", required=True) diff --git a/estate/models/estate_property_type.py b/estate/models/estate_property_type.py new file mode 100644 index 00000000000..4b881c7e2af --- /dev/null +++ b/estate/models/estate_property_type.py @@ -0,0 +1,8 @@ +from odoo import fields, models + + +class EstatePropertyType(models.Model): + _name = 'estate.property.type' + _description = 'Estate Property Type' + + name = fields.Char(string="Name", required=True) diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv new file mode 100644 index 00000000000..bd49f55738d --- /dev/null +++ b/estate/security/ir.model.access.csv @@ -0,0 +1,6 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_estate_property,estate.access_estate_property,model_estate_property,base.group_user,1,1,1,1 +access_estate_property_type,estate.access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1 +access_estate_property_tags,estate.access_estate_property_tags,model_estate_property_tag,base.group_user,1,1,1,1 + +access_estate_property_offer,estate.access_estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1 diff --git a/estate/static/description/icon1.png b/estate/static/description/icon1.png new file mode 100644 index 00000000000..3bc328b8c7c Binary files /dev/null and b/estate/static/description/icon1.png differ diff --git a/estate/static/description/index.html b/estate/static/description/index.html new file mode 100644 index 00000000000..b0eea988291 --- /dev/null +++ b/estate/static/description/index.html @@ -0,0 +1,3 @@ +
+

This is a custom Real Estate application built following the official Odoo Server Framework 101 tutorial.

+
\ No newline at end of file diff --git a/estate/views/estate_menus.xml b/estate/views/estate_menus.xml new file mode 100644 index 00000000000..933789bac30 --- /dev/null +++ b/estate/views/estate_menus.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/estate/views/estate_property_offer_views.xml b/estate/views/estate_property_offer_views.xml new file mode 100644 index 00000000000..3eb2da09658 --- /dev/null +++ b/estate/views/estate_property_offer_views.xml @@ -0,0 +1,31 @@ + + + estate.property.offer.list + estate.property.offer + + + + + + + + + + + + + estate.property.offer.form + estate.property.offer + +
+ + + + + + +
+
+
+
+ diff --git a/estate/views/estate_property_tags_views.xml b/estate/views/estate_property_tags_views.xml new file mode 100644 index 00000000000..9d0c0a42b58 --- /dev/null +++ b/estate/views/estate_property_tags_views.xml @@ -0,0 +1,33 @@ + + + + estate.property.tag.list + estate.property.tag + + + + + + + + + estate.property.tag.form + estate.property.tag + +
+ + + + + +
+
+
+ + + Property Tags + estate.property.tag + list,form + +
+ diff --git a/estate/views/estate_property_type_views.xml b/estate/views/estate_property_type_views.xml new file mode 100644 index 00000000000..a32f9be7745 --- /dev/null +++ b/estate/views/estate_property_type_views.xml @@ -0,0 +1,34 @@ + + + + estate.property.type.list + estate.property.type + + + + + + + + + estate.property.type.form + estate.property.type + +
+ + + + + +
+
+
+ + + Property Types + estate.property.type + list,form + +
+ + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml new file mode 100644 index 00000000000..d479e547c62 --- /dev/null +++ b/estate/views/estate_property_views.xml @@ -0,0 +1,130 @@ + + + estate.property.list + estate.property + + + + + + + + + + + + + + + + + + + + estate.property.form + estate.property + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + estate.property.view.search + estate.property + + + + + + + + + + + + + + + + + + + + + + + + Properties + estate.property + list,form + {'search_default_affordable_or_new_big': 1} + +
+ +