Skip to content

Commit

Permalink
Add estate property tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
mpurnell1 committed Sep 30, 2024
1 parent 80f830f commit 4d2f980
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Estate", # The name that will appear in the App list
"version": "17.0.0.16", # Version
"version": "17.0.0.17", # Version
"application": True, # This line says the module is an App, and not a module
"depends": ["base"], # dependencies
"data": [
Expand Down
10 changes: 5 additions & 5 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ class EstateProperty(models.Model):
_description = 'Real Estate Property'

# Custom fields
name = fields.Char(required=True)
name = fields.Char(string="Title", required=True)
description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date(copy=False, default=add(fields.Date.today(), days=90))
date_availability = fields.Date(string="Available From", copy=False, default=add(fields.Date.today(), days=90))
expected_price = fields.Float(required=True)
selling_price = fields.Float(readonly=True, copy=False)
bedrooms = fields.Integer(default=2)
living_area = fields.Integer()
living_area = fields.Integer(string="Living Area (sqm)")
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
Expand All @@ -22,9 +22,9 @@ class EstateProperty(models.Model):

# Reserved fields
active = fields.Boolean(default=True)
state = fields.Selection([
state = fields.Selection(string="Status", default='new', copy=False, selection=[
('new', 'New'),
('received', 'Offer Received'),
('accepted', 'Offer Accepted'),
('sold', 'Sold'),
('canceled', 'Canceled')], string="Status", default='new', copy=False)
('canceled', 'Canceled')])
16 changes: 16 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,20 @@
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>

<record id="estate_property_view_tree" model="ir.ui.view">
<field name="name">estate.property.tree</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<tree string="Property">
<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"/>
</tree>
</field>
</record>
</odoo>

0 comments on commit 4d2f980

Please sign in to comment.