Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
31 changes: 31 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
'name': "Estate",

'summary': """
Starting module for "Estate"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think Starting module for "Estate" in the summary and description are really appropriate here.

""",

'description': """
Starting module for "Estate"
""",

'author': "Odoo",
'website': "https://www.odoo.com",

# Categories can be used to filter modules in modules listing

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove those comments here and under from the manifest file.

# Check https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/data/ir_module_category_data.xml
# for the full list
'category': 'Tutorials',
'version': '0.1',

# any module necessary for this one to work correctly
'depends': ['base', 'web'],
'data': [
'views/estate_property_views.xml',
'views/estate_menus.xml',
'security/ir.model.access.csv',
],
'application': True,
'installable': True,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default when application is set, installable is set to true automatically.

'license': 'AGPL-3'
}
1 change: 1 addition & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import estate
22 changes: 22 additions & 0 deletions estate/models/estate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from odoo import fields, models

class Estate(models.Model):
_name = 'estate.property'
_description = 'Estate Property'

name = fields.Char('Property Name', required=True)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use double quotes for strings that will be shown on the view. So instead of 'Property Name' it is better to do "Property Name".

description = fields.Text('Description')
postcode = fields.Char('Postcode')
date_availability = fields.Date('Availability')
expected_price = fields.Float('Expected Price', required=True)
selling_price = fields.Float('Selling Price')
bedrooms = fields.Integer('# Bedrooms')
living_area = fields.Integer('Living Area')
facades = fields.Integer('Facades')
garage = fields.Boolean('Garage', default=True)
garden = fields.Boolean('Garden', default=True)
garden_area = fields.Integer('Garden Area')
garden_orientation = fields.Selection(
string='Type',
selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')],
required=True)
2 changes: 2 additions & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_estate_model,access_estate_model,model_estate_property,base.group_user,1,1,1,1
8 changes: 8 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem id="estate_menu_root" name="Estate">
<menuitem id="estate_menu_advertisements" name="Advertisements">
<menuitem id="estate_menu_properties" name="Properties" action="estate_property_action"/>
</menuitem>
</menuitem>
</odoo>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to always add a final new line 😄

8 changes: 8 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="estate_property_action" model="ir.actions.act_window">
<field name="name">View Records</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>
</odoo>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too