Skip to content

Commit

Permalink
[IMP] estate: menus and estate_property fields added
Browse files Browse the repository at this point in the history
  • Loading branch information
aizu-odoo committed Nov 20, 2024
1 parent 84c4a5e commit 2414a72
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 34 deletions.
21 changes: 0 additions & 21 deletions .vscode/launch.json

This file was deleted.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
2 changes: 1 addition & 1 deletion estate/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import models
from . import models
10 changes: 7 additions & 3 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
'name': "Awesome Estate",
'depends': ['base'],
'installable': True,
'application': True,
'data':['security/ir.model.access.csv']
}
'data':[
'security/ir.model.access.csv',

'views/estate_property_views.xml',
'views/estate_menu_views.xml'
]
}
2 changes: 1 addition & 1 deletion estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import estate_property
from . import estate_property
33 changes: 28 additions & 5 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -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'
)

2 changes: 1 addition & 1 deletion estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -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
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1
10 changes: 10 additions & 0 deletions estate/views/estate_menu_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<menuitem id="estate_menu_root" name="Estate">
<menuitem id="estate_first_level_menu" name="Advertisements">
<menuitem id="estate_property_menu_action" name="Properties" action="estate.estate_property_action"/>
</menuitem>
</menuitem>

</odoo>
12 changes: 12 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>

<record id="estate_property_action" model="ir.actions.act_window">
<field name="name">Estate Property</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>

</data>
</odoo>

0 comments on commit 2414a72

Please sign in to comment.