Skip to content

Commit

Permalink
End of first day
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinVermeulen committed Oct 21, 2024
1 parent 9475bc3 commit 99e7cbb
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 8 deletions.
2 changes: 2 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# data files always loaded at installation
'data': [
'views/estate_property_view.xml',
'views/estate_property_type_view.xml',
'views/estate_property_offer_view.xml',
'views/estate_menus.xml',
'security/ir.model.access.csv',
],
Expand Down
4 changes: 3 additions & 1 deletion estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import estate_property
from . import estate_property
from . import estate_property_type
from . import estate_property_offer
9 changes: 7 additions & 2 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class EstateProperty(models.Model):
_description = 'Estate Properties'
_order='create_date desc'

name = fields.Char("Name", required=True)
name = fields.Char("Title", required=True)
description = fields.Text("Description")
postcode = fields.Char("Postcode")
date_available = fields.Date("Date Available", copy=False, default=fields.Date.today() + relativedelta(days=90))
Expand All @@ -36,4 +36,9 @@ class EstateProperty(models.Model):
copy=False,
required=True,
default="new"
)
)
partner_id = fields.Many2one("res.partner", string="Buyer", copy=False)
user_id = fields.Many2one("res.users", string="Salesperson", default=lambda self: self.env.uid)
property_type_id = fields.Many2one("estate.property.type", string="Property Type")
tag_ids=fields.Many2many('estate.property.tag', string="Tags")
offer_ids = fields.One2many('estate.property.offer', 'property_id', string="Offers")
14 changes: 14 additions & 0 deletions estate/models/estate_property_offer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from odoo import models, fields


class EstatePropertyOffer(models.Model):
_name = 'estate.property.offer'
_description = 'An offer for a property'

price = fields.Float("Price")
status = fields.Selection(string="Status",
selection=[("accepted", "Accepted"),
("refused", "Refused")],
copy=False)
partner_id = fields.Many2one('res.partner', string="Partner", required=True)
property_id = fields.Many2one('estate.property', string="Property", required=True)
15 changes: 15 additions & 0 deletions estate/models/estate_property_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from odoo import models, fields

class EstatePropertyType(models.Model):
_name = 'estate.property.type'
_description = 'Type of a property'

name = fields.Char(string='Name', required=True)
description = fields.Text(string='Description')

class EstatePropertyTag(models.Model):
_name = 'estate.property.tag'
_description = 'Type of a property'

name = fields.Char(string='Name', required=True)
description = fields.Text(string='Description')
3 changes: 3 additions & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
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
estate.access_estate_property_type,access_estate_property,estate.model_estate_property_type,base.group_user,1,1,1,1
estate.access_estate_property_tag,access_estate_property_tag,estate.model_estate_property_tag,base.group_user,1,1,1,1
estate.access_estate_property_offer,access_estate_property_offer,estate.model_estate_property_offer,base.group_user,1,1,1,1
6 changes: 5 additions & 1 deletion estate/views/estate_menus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<odoo>
<menuitem id="estate_menu_root" name="Estate">
<menuitem id="estate_first_level_menu" name="Advertisement">
<menuitem id="Properties" action="estate_property_model_action"/>
<menuitem id="properties" action="estate_property_model_action"/>
</menuitem>
<menuitem id="estate_setting_menu" name="Settings">
<menuitem id="property_type_menu" action="estate_property_type_model_action"/>
<menuitem id="property_tag_menu" action="estate_property_tag_model_action"/>
</menuitem>
</menuitem>
</odoo>
49 changes: 49 additions & 0 deletions estate/views/estate_property_offer_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<odoo>
<record id="estate_property_offer_view_form" model="ir.ui.view">
<field name="name">estate.property.offer.form</field>
<field name="model">estate.property.offer</field>
<field name="arch" type="xml">
<form string="Property Offer">
<header>
</header>
<sheet>
<div class="oe_title">
<div class="oe_edit_only">
<label for="price"/>
</div>
<h1>
<field name="price" string="Price"/>
</h1>
</div>
<div>
<group>
<field name="status"/>
<field name="partner_id"/>
<field name="property_id"/>
</group>
</div>
</sheet>
</form>
</field>
</record>

<record id="estate_property_offer_view_list" model="ir.ui.view">
<field name="name">estate.property.offer.view.list</field>
<field name="model">estate.property.offer</field>
<field name="arch" type="xml">
<list string="Property Offer List">
<field name="property_id"/>
<field name="price"/>
<field name="status"/>
<field name="partner_id"/>
</list>
</field>
</record>

<!-- <record id="estate_property_offer_model_action" model="ir.actions.act_window">-->
<!-- <field name="name">Property Offer</field>-->
<!-- <field name="res_model">estate.property.offer</field>-->
<!-- <field name="view_mode">list,form</field>-->
<!-- </record>-->
</odoo>
89 changes: 89 additions & 0 deletions estate/views/estate_property_type_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0"?>
<odoo>
<!-- Types -->
<record id="estate_property_type_view_form" model="ir.ui.view">
<field name="name">estate.property.type.form</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<form string="Property">
<header>
</header>
<sheet>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/>
</div>
<h1>
<field name="name" string="Name"/>
</h1>
</div>
<div>
<group>
<field name="description"/>
</group>
</div>
</sheet>
</form>
</field>
</record>

<record id="estate_property_type_view_list" model="ir.ui.view">
<field name="name">estate.property.type.view.list</field>
<field name="model">estate.property.type</field>
<field name="arch" type="xml">
<list string="Property Type List">
<field name="name"/>
</list>
</field>
</record>

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

<!-- Tags-->
<record id="estate_property_tag_view_form" model="ir.ui.view">
<field name="name">estate.property.tag.form</field>
<field name="model">estate.property.tag</field>
<field name="arch" type="xml">
<form string="Property">
<header>
</header>
<sheet>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/>
</div>
<h1>
<field name="name" string="Name"/>
</h1>
</div>
<div>
<group>
<field name="description"/>
</group>
</div>
</sheet>
</form>
</field>
</record>

<record id="estate_property_tag_view_list" model="ir.ui.view">
<field name="name">estate.property.tag.view.list</field>
<field name="model">estate.property.tag</field>
<field name="arch" type="xml">
<list string="Property Tag List">
<field name="name"/>
</list>
</field>
</record>

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

</odoo>
90 changes: 86 additions & 4 deletions estate/views/estate_property_view.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,100 @@
<?xml version="1.0"?>
<odoo>
<record id="estate_property_view_tree" model="ir.ui.view">
<field name="name">estate.property.view.tree</field>
<!-- SEARCH VIEW -->
<record id="estate_property_view_search" model="ir.ui.view">
<field name="name">estate_property.view.search</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="Search Opportunities">
<field name="name"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<filter name="New" domain="[('state', '=', 'new')]"/>
<filter name="Available" domain="[('state', '=', 'available')]"/>
<filter name="Postcode" domain="[('postcode', '!=', False)]" context="{'group_by':'postcode'}"/>
</search>
</field>
</record>

<!-- FORM VIEW-->
<record id="estate_property_view_form" model="ir.ui.view">
<field name="name">estate.property.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form string="Property">
<header>
</header>
<sheet>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/>
</div>
<h1>
<field name="name" string="Name"/>
</h1>
<field name="tag_ids" widget="many2many_tags"/>
</div>
<div>
<group>
<group>
<field name="property_type_id"/>
<field name="postcode" string="Post code"/>
<field name="date_available"/>
</group>
<group>
<field name="expected_price"/>
<field name="selling_price"/>
</group>
</group>
</div>
<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" invisible="(not garden)"/>
<field name="garden_orientation" invisible="(not garden)"/>
</group>
</page>
<page string="Offers" name="offer_ids">
<field name="offer_ids"/>
</page>
<page string="Other Info">
<group>
<field name="user_id"/>
<field name="partner_id"/>
</group>
</page>
</notebook>
</sheet>
<chatter/>


</form>
</field>
</record>

<!-- LIST VIEW-->
<record id="estate_property_view_list" model="ir.ui.view">
<field name="name">estate.property.view.list</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<tree string="Property List">
<list string="Property List">
<field name="name"/>
<field name="postcode"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="date_available"/>
</tree>
</list>
</field>
</record>

Expand Down

0 comments on commit 99e7cbb

Please sign in to comment.