[IMP] event_booth{_sale}: improves UX

Improve the filters & actions in booths to ease overview and reporting by:
1. adding and renaming some group by filters
2. adding a price column in the list view of booth event
3. adding a graph and a pivot table view (category/price)

Task-2808962

closes odoo/odoo#95441

Related: odoo/upgrade#3660
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
Pierre-Yves Dufays
2022-07-07 14:44:17 +02:00
committed by Aurélien Warnon
parent c59eac2fcb
commit 1be624d03c
7 changed files with 61 additions and 25 deletions
+27 -5
View File
@@ -166,19 +166,41 @@
<filter string="Unavailable" name="filter_booth_unavailable"
domain="[('state', '=', 'unavailable')]"/>
<group expand="0" string="Group By">
<filter string="Booth Type" name="group_by_booth_category_id" context="{'group_by': 'booth_category_id'}"/>
<filter name="group_by_state" context="{'group_by': 'state'}"/>
<filter name="group_by_partner_id" context="{'group_by': 'partner_id'}"/>
<filter name="group_by_booth_category_id" context="{'group_by': 'booth_category_id'}"/>
<filter string="Event" name="group_by_event_id" context="{'group_by': 'event_id'}"/>
</group>
</search>
</field>
</record>
<record id="event_booth_view_graph" model="ir.ui.view">
<field name="name">event.booth.view.graph</field>
<field name="model">event.booth</field>
<field name="arch" type="xml">
<graph string="Event booth" sample="1" type="pie">
<field name="booth_category_id"/>
</graph>
</field>
</record>
<record id="event_booth_view_pivot" model="ir.ui.view">
<field name="name">event.booth.view.pivot</field>
<field name="model">event.booth</field>
<field name="arch" type="xml">
<pivot string="Event booth" sample="1">
<field name="booth_category_id" type="row"/>
</pivot>
</field>
</record>
<record id="event_booth_action" model="ir.actions.act_window">
<field name="name">Booths</field>
<field name="res_model">event.booth</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_mode">kanban,tree,form,graph,pivot</field>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="context">{'search_default_group_by_state': 1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a Booth
@@ -191,9 +213,9 @@
<record id="event_booth_action_from_event" model="ir.actions.act_window">
<field name="name">Booths</field>
<field name="res_model">event.booth</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_mode">kanban,tree,form,graph,pivot</field>
<field name="domain">[('event_id', '=', active_id)]</field>
<field name="context">{'default_event_id': active_id}</field>
<field name="context">{'default_event_id': active_id, 'search_default_group_by_state': 1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a Booth
+1 -1
View File
@@ -4,7 +4,7 @@
{
'name': "Events Booths Sales",
'category': 'Marketing/Events',
'version': '1.0',
'version': '1.1',
'summary': "Manage event booths sale",
'description': """
Sell your event booths and track payments on sale orders.
@@ -8,7 +8,7 @@ class EventTypeBooth(models.Model):
_inherit = 'event.type.booth'
product_id = fields.Many2one(related='booth_category_id.product_id')
price = fields.Float(related='booth_category_id.price')
price = fields.Float(related='booth_category_id.price', store=True)
currency_id = fields.Many2one(related='booth_category_id.currency_id')
@api.model
@@ -40,14 +40,14 @@
</field>
</record>
<record id="event_booth_view_tree" model="ir.ui.view">
<field name="name">event.booth.view.tree.inherit.sale</field>
<record id="event_booth_view_tree_from_event" model="ir.ui.view">
<field name="name">event.booth.view.tree.from.event.inherit.sale</field>
<field name="model">event.booth</field>
<field name="inherit_id" ref="event_booth.event_booth_view_tree"/>
<field name="inherit_id" ref="event_booth.event_booth_view_tree_from_event"/>
<field name="arch" type="xml">
<field name="booth_category_id" position="after">
<field name="partner_id" position="after">
<field name="currency_id" invisible="1"/>
<field name="price" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="price" widget="monetary" options="{'currency_field': 'currency_id'}" sum="Total"/>
</field>
</field>
</record>
@@ -60,6 +60,31 @@
<xpath expr="//field[@name='name']" position="after">
<field name="sale_order_id"/>
</xpath>
<xpath expr="//search/group/filter[@name='group_by_booth_category_id']" position="after">
<filter name="is_paid" context="{'group_by': 'is_paid'}"/>
</xpath>
</field>
</record>
<record id="event_booth_view_graph" model="ir.ui.view">
<field name="name">event.booth.event.booth.view.graph.inherit.sale</field>
<field name="model">event.booth</field>
<field name="inherit_id" ref="event_booth.event_booth_view_graph"/>
<field name="arch" type="xml">
<xpath expr="//graph" position="inside">
<field name="price" type="measure"/>
</xpath>
</field>
</record>
<record id="event_booth_view_pivot" model="ir.ui.view">
<field name="name">event.booth.event.booth.view.pivot.inherit.sale</field>
<field name="model">event.booth</field>
<field name="inherit_id" ref="event_booth.event_booth_view_pivot"/>
<field name="arch" type="xml">
<xpath expr="//pivot" position="inside">
<field name="price" type="measure"/>
</xpath>
</field>
</record>
@@ -144,7 +144,7 @@ class TestEventPerformance(EventPerformanceCase):
has_social = 'social_menu' in self.env['event.event'] # otherwise view may crash in enterprise
# type and website
with freeze_time(self.reference_now), self.assertQueryCount(event_user=700): # tef only: 673 - com runbot: 604 - ent runbot: 700
with freeze_time(self.reference_now), self.assertQueryCount(event_user=700): # tef only: 601 - com runbot: 604 - ent runbot: 700
self.env.cr._now = self.reference_now # force create_date to check schedulers
with Form(self.env['event.event']) as event_form:
event_form.name = 'Test Event'
@@ -3,7 +3,7 @@
{
'name': 'Booths/Exhibitors Bridge',
'category': 'Marketing/Events',
'version': '1.0',
'version': '1.1',
'summary': 'Event Booths, automatically create a sponsor.',
'description': """
Automatically create a sponsor when renting a booth.
@@ -16,15 +16,4 @@
</field>
</record>
<record id="event_booth_view_search" model="ir.ui.view">
<field name="name">event.booth.view.search.inherit.website.event.booth.exhibitor</field>
<field name="model">event.booth</field>
<field name="inherit_id" ref="event_booth.event_booth_view_search"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='group_by_booth_category_id']" position="after">
<filter string="Sponsor" name="group_by_sponsor_id" context="{'group_by': 'sponsor_id'}"/>
</xpath>
</field>
</record>
</data></odoo>