Skip to content

Commit

Permalink
[IMP] estate: Add a server action for better UX
Browse files Browse the repository at this point in the history
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
  • Loading branch information
aboo-odoo committed Oct 22, 2024
1 parent 953b39a commit 8533f13
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@

],
'license': "LGPL-3",
'demo': [
"demo/demo.xml",
],
}
13 changes: 13 additions & 0 deletions estate/demo/demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="model_estate_property_action_cancel" model="ir.actions.server">
<field name="name">Mass cancel</field>
<field name="model_id" ref="estate.model_estate_property"/>
<field name="binding_model_id" ref="estate.model_estate_property"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.action_cancel()</field>
</record>
</data>
</odoo>
5 changes: 5 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ class Property(models.Model):
tag_ids = fields.Many2many("estate.property.tag", string="Tags")

offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offers")

def action_cancel(self):
state = self.state
if state != 'cancelled':
self.state = 'cancelled'

0 comments on commit 8533f13

Please sign in to comment.