Skip to content

Commit 9119b6c

Browse files
aboo-odooproose
authored andcommitted
[IMP] estate: Add a server action for better UX
Problem --------- Users may want to cancel several houses and flats at once, currently this is not possible; they have to do it one by one. Objective --------- Add a way to cancel several estates in one go. Solution --------- Add a server action in the demo data so that it is available for new users. Old users can create the same server action on their database. task-123456
1 parent 27e01ee commit 9119b6c

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

estate/__manifest__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
'installable': True,
1818
'application': True,
1919
'auto_install': False,
20-
'license': 'AGPL-3'
20+
'license': 'AGPL-3',
21+
'demo': [
22+
"demo/demo.xml",
23+
],
2124
}

estate/demo/demo.xml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<odoo>
3+
<data>
4+
<record id="model_estate_property_action_cancel" model="ir.actions.server">
5+
<field name="name">Mass cancel</field>
6+
<field name="model_id" ref="estate.model_estate_property"/>
7+
<field name="binding_model_id" ref="estate.model_estate_property"/>
8+
<field name="binding_view_types">list</field>
9+
<field name="state">code</field>
10+
<field name="code">action = records.action_cancel()</field>
11+
</record>
12+
</data>
13+
</odoo>

estate/models/property.py

+5
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,8 @@ def _onchange_garden(self):
6363
else:
6464
self.garden_orientation = None
6565
self.garden_area = 0
66+
67+
def action_cancel(self):
68+
state = self.state
69+
if state != 'cancelled':
70+
self.state = 'cancelled'

0 commit comments

Comments
 (0)