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 d55d464 commit 6d1449f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
6 changes: 5 additions & 1 deletion estate/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
'views/estate_property_views.xml',
'views/estate_menus.xml',
],
'license': 'LGPL-3',
'license': "LGPL-3",
# data files containing optionally loaded demonstration data
'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>
14 changes: 14 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ class EstateProperty(models.Model):
string='State',
selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', "Cancelled")]
)
<<<<<<< HEAD
=======

property_type_id = fields.Many2one("estate.property.type", string="Property Type")
buyer_id = fields.Many2one("res.partner", string="Buyer", copy=False)
salesman_id = fields.Many2one("res.users", string="Salesman", default=lambda self: self.env.user)

tag_ids = fields.Many2many("estate.property.tag", string="Tags")

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

def action_cancel(self):
pass
>>>>>>> 8ba186df ([IMP] estate: Add a server action for better UX)

0 comments on commit 6d1449f

Please sign in to comment.