Skip to content

Commit 81b6f77

Browse files
committed
[IMP] estate: added chatter and action helper.
Task related to chatter and action helper are completed.
1 parent 4d02f7e commit 81b6f77

File tree

4 files changed

+28
-24
lines changed

4 files changed

+28
-24
lines changed

estate/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"category": "Estate/Brokerage",
55
"summary": "create a estate property",
66
"website": "https://www.odoo.com",
7-
"depends": ["base"],
7+
"depends": ["base","mail"],
88
"installable": True,
99
"application": True,
1010
"license": "LGPL-3",

estate/models/estate_property.py

+19-17
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class EstateProperty(models.Model):
99
_name = "estate.property"
1010
_description = "Real Estate Property"
1111
_order = 'id desc'
12+
_inherit = ['mail.thread', 'mail.activity.mixin']
1213

1314
name = fields.Char(required=True)
1415
description = fields.Text(string="Description")
@@ -38,7 +39,7 @@ class EstateProperty(models.Model):
3839
('offer_accepted', 'Offer Accepted'),
3940
('sold', 'Sold'),
4041
('cancelled', 'Cancelled'),
41-
], default='new', string="Status", copy=False)
42+
], default='new', string="Status", copy=False, tracking=True, group_expand='_group_expand_states')
4243
property_type_id = fields.Many2one('estate.property.type', string="Property Type",
4344
options={'no_create': True, 'no_edit': True})
4445
buyer_id = fields.Many2one('res.partner', string="Buyer",copy=False)
@@ -76,6 +77,7 @@ class EstateProperty(models.Model):
7677
)
7778

7879

80+
7981

8082
@api.onchange('garden')
8183
def _onchange_garden(self):
@@ -147,21 +149,21 @@ def _compute_offer_accepted(self):
147149

148150
@api.ondelete(at_uninstall=False)
149151
def _check_state_on_delete(self):
150-
for record in self:
151-
if record.state not in ('new', 'cancelled'):
152-
raise UserError(
153-
"You cannot delete a property unless it is in 'New' or 'Cancelled' state."
152+
for record in self:
153+
if record.state not in ('new', 'cancelled'):
154+
raise UserError(
155+
"You cannot delete a property unless it is in 'New' or 'Cancelled' state."
154156
)
155157

156-
# def action_helper_message(self):
157-
# # Logic to determine when to show the helper
158-
# if not self.search([]):
159-
# return {
160-
# 'type': 'ir.actions.client',
161-
# 'tag': 'display_notification',
162-
# 'params': {
163-
# 'title': 'No Properties Found',
164-
# 'message': 'Click the button to create your first property.',
165-
# 'type': 'warning',
166-
# }
167-
# }
158+
def action_helper_message(self):
159+
# Logic to determine when to show the helper
160+
if not self.search([]):
161+
return {
162+
'type': 'ir.actions.client',
163+
'tag': 'display_notification',
164+
'params': {
165+
'title': 'No Properties Found',
166+
'message': 'Click the button to create your first property.',
167+
'type': 'warning',
168+
}
169+
}

estate/models/estate_property_offer.py

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class EstatePropertyOffer(models.Model):
2828
inverse="_inverse_date_deadline",
2929
store=True
3030
)
31+
3132

3233
@api.depends('create_date', 'validity')
3334
def _compute_date_deadline(self):

estate/views/estate_property_views.xml

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
<field name="name">Properties</field>
55
<field name="res_model">estate.property</field>
66
<field name="view_mode">kanban,list,form</field>
7+
<field name ="help" type="html">
8+
<div class="o_kanban_view_nocontent_smiling_face">
9+
<p>No properties available. Start by creating one!</p>
10+
</div>
11+
</field>
712
<!-- <field name="search_view_id" ref="estate_property_view_search"/> -->
813
</record>
914
<record id='estate_property_view_kanban' model='ir.ui.view'>
@@ -28,12 +33,6 @@
2833
</div>
2934

3035
</t>
31-
<!-- <div class="o_kanban_view_content">
32-
<p>No properties available. Start by creating one!</p>
33-
<button type="action" class="btn btn-primary" name="%(estate_property_action)d">
34-
Create Property
35-
</button>
36-
</div> -->
3736
</templates>
3837
</kanban>
3938
</field>
@@ -58,6 +57,7 @@
5857
<field name="expected_price"/>
5958
<field name="selling_price"/>
6059
<field name="date_availability" optional="hide" invisible="1"/>
60+
6161
</list>
6262
</field>
6363
</record>
@@ -128,6 +128,7 @@
128128
</page>
129129
</notebook>
130130
</sheet>
131+
<chatter/>
131132
</form>
132133
</field>
133134
</record>

0 commit comments

Comments
 (0)