diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 1fe46a3ce2..0000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Restart Server", - "type": "debugpy", - "request": "launch", - "program": "/home/odoo/odoo_firsttest/odoo18/odoo-bin", - "args": ["--addons-path=/home/odoo/odoo_firsttest/odoo18/addons/,/home/odoo/odoo_firsttest/enterprise/,/home/odoo/odoo_firsttest/tutorials", - "-d", - "rd-demo", - "-u", - "estate" - ], - "console": "integratedTerminal" - } - ] -} \ No newline at end of file diff --git a/README.md b/README.md index 0666fd2bfa..89e6a2b229 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Odoo tutorials -Test changes - This repository hosts the code for the bases and solutions of the [official Odoo tutorials](https://www.odoo.com/documentation/17.0/developer/tutorials.html). diff --git a/estate/__init__.py b/estate/__init__.py index 9a7e03eded..0650744f6b 100644 --- a/estate/__init__.py +++ b/estate/__init__.py @@ -1 +1 @@ -from . import models \ No newline at end of file +from . import models diff --git a/estate/__manifest__.py b/estate/__manifest__.py index 36d0e05d43..4205ec36d9 100644 --- a/estate/__manifest__.py +++ b/estate/__manifest__.py @@ -1,7 +1,11 @@ { 'name': "Awesome Estate", 'depends': ['base'], - 'installable': True, 'application': True, - 'data':['security/ir.model.access.csv'] -} \ No newline at end of file + 'data':[ + 'security/ir.model.access.csv', + + 'views/estate_property_views.xml', + 'views/estate_menu_views.xml' + ] +} diff --git a/estate/models/__init__.py b/estate/models/__init__.py index f4c8fd6db6..5e1963c9d2 100644 --- a/estate/models/__init__.py +++ b/estate/models/__init__.py @@ -1 +1 @@ -from . import estate_property \ No newline at end of file +from . import estate_property diff --git a/estate/models/estate_property.py b/estate/models/estate_property.py index d7bd021e9b..4b4b9b79e2 100644 --- a/estate/models/estate_property.py +++ b/estate/models/estate_property.py @@ -1,22 +1,45 @@ # -*- coding: utf-8 -*- from odoo import fields, models +from dateutil.relativedelta import relativedelta class EstateProperty(models.Model): - _name = "estate.property" + _name = 'estate.property' _description = "Estate Properties" name = fields.Char(required=True) description = fields.Text() postcode = fields.Char() - date_availability = fields.Date() + date_availability = fields.Date(copy=False, default= lambda _self: fields.Date.today()+relativedelta(months=3)) expected_price = fields.Float(required=True) - selling_price = fields.Float() - bedrooms = fields.Integer() + selling_price = fields.Float(readonly=True, copy=False) + bedrooms = fields.Integer(default=2) living_area = fields.Integer() facades = fields.Integer() garage = fields.Boolean() garden = fields.Boolean() garden_area = fields.Integer() - garden_orientation = fields.Selection([('north','North'), ('south','South'), ('east', 'East'), ('west', 'West')], string = 'Garden Orientation') + garden_orientation = fields.Selection( + [ + ('north', "North"), + ('south', "South"), + ('east', "East"), + ('west', "West"), + ], + string="Garden Orientation", + ) + + active = fields.Boolean(default=True) + state = fields.Selection( + [ + ('new', "New"), + ('offer_received', "Offer Received"), + ('offer_accepted', "Offer Accepted"), + ('sold', "Sold"), + ('cancelled', "Cancelled"), + ], + required=True, + copy=False, + default='new' + ) \ No newline at end of file diff --git a/estate/security/ir.model.access.csv b/estate/security/ir.model.access.csv index 07669bf00e..85de405deb 100644 --- a/estate/security/ir.model.access.csv +++ b/estate/security/ir.model.access.csv @@ -1,2 +1,2 @@ id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink -estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,0,0,0 \ No newline at end of file +estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1 diff --git a/estate/views/estate_menu_views.xml b/estate/views/estate_menu_views.xml new file mode 100644 index 0000000000..043c489a7f --- /dev/null +++ b/estate/views/estate_menu_views.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/estate/views/estate_property_views.xml b/estate/views/estate_property_views.xml new file mode 100644 index 0000000000..f6b32d6b5d --- /dev/null +++ b/estate/views/estate_property_views.xml @@ -0,0 +1,12 @@ + + + + + + Estate Property + estate.property + list,form + + + +