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..6b00d13ca5f --- /dev/null +++ b/estate/__manifest__.py @@ -0,0 +1,18 @@ +{ + "name": "estate", + "website": "", + "category": "Tutorials", + "version": "0.1", + "application": True, + "installable": True, + "depends": ["base"], + "data": [ + "security/security.xml", + "security/ir.model.access.csv", + "views/estate_property_views.xml", + "views/estate_menus.xml", + ], + "assets": {}, + "author": "Odoo S.A.", + "license": "LGPL-3", +} diff --git a/estate/models/__init__.py b/estate/models/__init__.py new file mode 100644 index 00000000000..5e1963c9d2f --- /dev/null +++ b/estate/models/__init__.py @@ -0,0 +1 @@ +from . import estate_property diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py new file mode 100644 index 00000000000..5650d584826 --- /dev/null +++ b/estate/models/estate_property.py @@ -0,0 +1,44 @@ +from odoo import fields, models +from dateutil.relativedelta import relativedelta +from datetime import datetime + + +class EstateProperty(models.Model): + _name = "estate_property" + _description = "Estate Property" + name = fields.Char("Title", required=True) + description = fields.Text() + postcode = fields.Char() + date_availability = fields.Date( + copy=False, default=datetime.now() + relativedelta(months=3) + ) + expected_price = fields.Float(required=True) + selling_price = fields.Float(readonly=True, copy=False) + bedrooms = fields.Integer(default=2) + living_area = fields.Integer("Living Area (sqm)") + facades = fields.Integer() + garage = fields.Boolean() + garden = fields.Boolean() + garden_area = fields.Integer() + garden_orientation = fields.Selection( + string="Orientation", + selection=[ + ("north", "North"), + ("south", "South"), + ("east", "East"), + ("west", "West"), + ], + ) + active = fields.Boolean(default=True) + state = fields.Selection( + selection=[ + ("new", "New"), + ("offer_received", "Offer Received"), + ("offer_accepted", "Offer Accepted"), + ("sold", "Sold"), + ("cancelled", "Cancelled"), + ], + default="new", + required=True, + copy=False, + ) diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv new file mode 100644 index 00000000000..2fd19e204e0 --- /dev/null +++ b/estate/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1 +access_estate_property_readonly,access_estate_property_readonly,model_estate_property,group_readonly_user,1,0,0,0 \ No newline at end of file diff --git a/estate/security/security.xml b/estate/security/security.xml new file mode 100644 index 00000000000..9a3a82d065c --- /dev/null +++ b/estate/security/security.xml @@ -0,0 +1,10 @@ + + + + Complete User + + + Readonly User + + + \ 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..173b5299633 --- /dev/null +++ b/estate/views/estate_menus.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml new file mode 100644 index 00000000000..b933be1ab55 --- /dev/null +++ b/estate/views/estate_property_views.xml @@ -0,0 +1,101 @@ + + + + estate_property.list + estate_property + + + + + + + + + + + + + + + estate_property.search + estate_property + + + + + + + + + + + + + + + + estate_property.form + estate_property + +
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + Properties + estate_property + list,form + +
\ No newline at end of file