Skip to content

Commit 89126d5

Browse files
committed
[IMP] estate: Implemented Kanban View
-Added Kanban view for properties and updated menu structure
1 parent b6acb37 commit 89126d5

File tree

3 files changed

+53
-12
lines changed

3 files changed

+53
-12
lines changed

Estate/models/estate_property_type.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,3 @@ def _compute_offer_count(self):
2424
for property in property_type.property_ids:
2525
offer_count += len(property.offer_ids)
2626
property_type.offer_count = offer_count
27-
28-
@api.constrains('name')
29-
def _check_type_name_unique(self):
30-
for record in self:
31-
existing_type = self.search([('name', '=', record.name)])
32-
if existing_type:
33-
raise ValidationError(f"The property type name '{record.name}' must be unique.")

Estate/views/estate_menus.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
name="List"
1515
parent="estate_property_menu"
1616
action="action_estate_property"/>
17-
17+
<menuitem id="estate_property_kanban_menu"
18+
name="Kanban"
19+
parent="estate_property_menu"
20+
action="estate_property_action_kanban"/>
1821
<menuitem id="estate_property_form_menu"
1922
name="Form"
2023
parent="estate_property_menu"

Estate/views/estate_property_views.xml

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<record id="action_estate_property" 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="help" type="html">
88
<p class="o_view_nocontent_smiling_face">
99
Create a new property
@@ -52,9 +52,6 @@
5252
</group>
5353
</group>
5454
<notebook>
55-
<!-- <page string="Description">
56-
<field name="description" placeholder="Add property description..."/>
57-
</page> -->
5855
<page string="Details">
5956
<form>
6057
<group>
@@ -113,4 +110,52 @@
113110
</search>
114111
</field>
115112
</record>
113+
114+
<record id="estate_property_kanban_view" model="ir.ui.view">
115+
<field name="name">estate.property.kanban</field>
116+
<field name="model">estate.property</field>
117+
<field name="arch" type="xml">
118+
<kanban default_group_by="property_type_id" records_draggable="False" groups_draggable="False">
119+
<field name="name"/>
120+
<field name="expected_price"/>
121+
<field name="state"/>
122+
<field name="best_price"/>
123+
<field name="selling_price"/>
124+
<field name="tag_ids"/>
125+
<templates>
126+
<t t-name="card">
127+
<div>
128+
<div>
129+
<field class="h2" name="name"/>
130+
</div>
131+
<div>
132+
Expected Price: <field name="expected_price"/>
133+
</div>
134+
<div>
135+
<p t-if="record.state.raw_value === 'offer_received'">
136+
Best Price: <field name="best_price"/>
137+
</p>
138+
</div>
139+
<div>
140+
<p t-if="record.state.raw_value === 'sold'">
141+
Selling Price: <field name="selling_price"/>
142+
</p>
143+
</div>
144+
<div>
145+
<field name="tag_ids"/>
146+
</div>
147+
</div>
148+
</t>
149+
</templates>
150+
</kanban>
151+
</field>
152+
</record>
153+
154+
<record id="estate_property_action_kanban" model="ir.actions.act_window">
155+
<field name="name">Properties(Kanban)</field>
156+
<field name="res_model">estate.property</field>
157+
<field name="view_mode">kanban,form</field>
158+
<field name="view_id" ref="estate_property_kanban_view"/>
159+
<field name="search_view_id" ref="estate_property_search_view"/>
160+
</record>
116161
</odoo>

0 commit comments

Comments
 (0)