Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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

Choose a reason for hiding this comment

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

Same here.

18 changes: 18 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.


Choose a reason for hiding this comment

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

Those lines are not required anymore. You can still see it in a lot of manifests but it is because they have been created long time ago.

{
'name': 'Estate',
'version': '0.1',
'application': True,
'author': 'matho',
'depends': [
'base',
],
'data': [
'security/ir.model.access.csv',
'views/estate_property_views.xml',
'views/estate_menus.xml',
]
}

Choose a reason for hiding this comment

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

Same here.

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_property
Copy link

@alan-odoo alan-odoo Oct 21, 2025

Choose a reason for hiding this comment

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

The blank line at the end of the file is missing. All your files must have one 😃.

28 changes: 28 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from odoo import fields, models

Copy link

@alan-odoo alan-odoo Oct 21, 2025

Choose a reason for hiding this comment

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

One blank line is missing here. There must be two blank line above a class. It is in the pep8 😃 . This are the guidelines to have a clean python code.

class EstateProperty(models.Model):
_name = "estate.property"
_description = "ici je mets une phrase"

name = fields.Char(required=True)
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(default=fields.Date.add(fields.Date.today(), months=3), copy=False)
expected_price = fields.Float(required=True)
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(
string='Garden orientation',
selection=[('North', 'N'), ('South', 'S'),('East', 'E'),('West', 'W')],
help="Specify the orientation of the garden to know when you're gonna enjoy the sun")
state = fields.Selection(
selection=[('New','New'), ('Offer Received', 'Offer Received'),('Offer Accepted', 'Offer Accepted'),('Sold', 'Sold'),('Cancelled', 'Cancelled')],
default='New'
)
active = fields.Boolean(default=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
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1
9 changes: 9 additions & 0 deletions estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<odoo>
Copy link

@alan-odoo alan-odoo Oct 21, 2025

Choose a reason for hiding this comment

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

The file should be named estate_property_menus.xml as it must contains the name of your model which is estate.property.

<data>
<menuitem id="test_menu_root" name="Real Estate">
<menuitem id="test_first_level_menu" name="Advertisements">
<menuitem id="test_model_menu_action" action="mon_action"/>
Copy link

@alan-odoo alan-odoo Oct 21, 2025

Choose a reason for hiding this comment

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

The id should be estate_property_menu and the action should be estate_property_action.

</menuitem>
</menuitem>
</data>
</odoo>

Choose a reason for hiding this comment

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

Same here.

81 changes: 81 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<odoo>
<data>

<record id="mon_action" model="ir.actions.act_window">

Choose a reason for hiding this comment

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

The action should be estate_property_action as it must contain the name of the model.

<field name="name">Properties</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
<field name="search_view_id" ref="perso_recherche"/>
</record>

<record id="perso_colonnes" model="ir.ui.view">

Choose a reason for hiding this comment

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

The id should be estate_property_view_form. The naming for the view is <model_name>view<view_type>.

<field name="name">estate.property.view.list</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list string="Channel" >
<field name="name"/>
<field name="postcode"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="date_availability"/>
</list>
</field>

Choose a reason for hiding this comment

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

Be careful with the indentation 😃

</record>

<record id="perso_tab1" model="ir.ui.view">
<field name="name">estate.property.view.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form string="Test">
<sheet>
<h1>
<field name="name"/>
</h1>
<group>
<group>
<field name="postcode"/>
<field name="date_availability"/>
</group>
<group>
<field name="expected_price"/>
<field name="selling_price"/>
</group>
</group>
<notebook>
<page string="Description">
<group>
<field name="description"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<field name="garage"/>
<field name="garden"/>
<field name="garden_area"/>
<field name="garden_orientation"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
Comment on lines +87 to +90

Choose a reason for hiding this comment

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

Something fail with the indentation. It comes from the starting form tag. The code underneath is also impacted.


<record id="perso_recherche" model="ir.ui.view">

Choose a reason for hiding this comment

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

The id should be estate_property_search.

<field name="name">estate.property.view.search</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="Search something">
<field name="name"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
</search>
</field>
</record>

</data>
</odoo>

Choose a reason for hiding this comment

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

Same here.