Skip to content

Commit

Permalink
[IMP] estate: basic views and search added
Browse files Browse the repository at this point in the history
  • Loading branch information
stva-odoo committed Nov 19, 2024
1 parent 68a0e8d commit 0ccfd6c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
5 changes: 3 additions & 2 deletions estate/models/property.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from dateutil.relativedelta import relativedelta

from odoo import fields, models


def _default_date_availability():
def _default_date_availability(args):
return fields.Date.today() + relativedelta(months=3)


class EstateProperty(models.Model):
_name = 'estate.property'
_description = "Estate Property"
name = fields.Char(required=True)
name = fields.Char(required=True, string='Title')
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(copy=False,
Expand Down
48 changes: 38 additions & 10 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list>
<field name="name" string="Title"/>
<field name="postcode"/>
<field name="name"/>
<field name="postcode" width="100px"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="expected_price"/>
Expand Down Expand Up @@ -55,14 +55,20 @@
<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>
<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>
<group>
<field name="active"/>
<field name="state"/>
</group>
</group>
</page>
</notebook>
Expand All @@ -72,4 +78,26 @@
</field>
</record>

<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>
<field name="name"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>

<filter name="Available" domain="['|',('state', '=', 'New'),('state','=','Offer Received')]"/>

<group expand="1" string="Group By">
<filter string="Postcode" name="group_by_postcode"
context="{'group_by':'postcode'}"/>
</group>
</search>
</field>
</record>

</odoo>

0 comments on commit 0ccfd6c

Please sign in to comment.