Skip to content

Commit e876115

Browse files
committed
[IMP] estate: Chapter 14 - Kanban view
1 parent d1ad400 commit e876115

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

estate/models/estate_property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _compute_total_area(self):
4949
def _compute_best_price(self):
5050
for record in self:
5151
if record.offer_ids:
52-
record.best_price = max(self.offer_ids.mapped("price"))
52+
record.best_price = max(record.offer_ids.mapped("price"))
5353
else:
5454
record.best_price = 0.0
5555

estate/views/estate_property_views.xml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<record id="estate_property_action" model="ir.actions.act_window">
44
<field name="name">Properties</field>
55
<field name="res_model">estate.property</field>
6-
<field name="view_mode">list,form</field>
6+
<field name="view_mode">list,form,kanban</field>
77
<field name="context">{"search_default_state": True}</field>
88
</record>
99

@@ -79,6 +79,33 @@
7979
</field>
8080
</record>
8181

82+
<record id="estate_property_kanban" model="ir.ui.view">
83+
<field name="name">estate.property.kanban</field>
84+
<field name="model">estate.property</field>
85+
<field name="arch" type="xml">
86+
<kanban default_group_by="property_type_id" records_draggable="False">
87+
<field name="state"/>
88+
<templates>
89+
<t t-name="card">
90+
<div>
91+
<h2>
92+
<field name="name"/>
93+
</h2>
94+
Expected Price: <field name="expected_price"/>
95+
<div t-if="record.state.raw_value == 'received'">
96+
Best Offer: <field name="best_price"/><br/>
97+
</div>
98+
<div t-elif="record.state.raw_value == 'accepted'">
99+
Selling Price: <field name="selling_price"/><br/>
100+
</div>
101+
<field name="tag_ids" options="{'color_field': 'color'}"/>
102+
</div>
103+
</t>
104+
</templates>
105+
</kanban>
106+
</field>
107+
</record>
108+
82109
<record id="estate_property_search" model="ir.ui.view">
83110
<field name="name">estate.property.search</field>
84111
<field name="model">estate.property</field>

0 commit comments

Comments
 (0)