[IMP] (website_)event_booth(_sale): polish ux design

PURPOSE

This commit is a first polish for event booth modules. It includes:
- wording
- add currency on price fields
- removing booths tab on event view

LINKS

Task-2635461
PR: odoo/odoo#77081
This commit is contained in:
Patrick Hoste
2021-10-04 15:30:26 +00:00
parent 2fab359e32
commit a2fe1cfb33
12 changed files with 32 additions and 35 deletions
+4 -4
View File
@@ -19,19 +19,19 @@
<ul t-if="booth.partner_id" name="contact_details">
<t t-set="contact_name" t-value="booth.contact_name"/>
<li t-if="contact_name">
<b>Name</b>: <span t-esc="contact_name"/>
<b>Renter Name</b>: <span t-esc="contact_name"/>
</li>
<t t-set="contact_email" t-value="booth.contact_email"/>
<li t-if="contact_email">
<b>Email</b>: <span t-esc="contact_email"/>
<b>Renter Email</b>: <span t-esc="contact_email"/>
</li>
<t t-set="contact_mobile" t-value="booth.contact_mobile"/>
<li t-if="contact_mobile">
<b>Mobile</b>: <span t-esc="contact_mobile"/>
<b>Renter Mobile</b>: <span t-esc="contact_mobile"/>
</li>
<t t-set="contact_phone" t-value="booth.contact_phone"/>
<li t-if="contact_phone">
<b>Phone</b>: <span t-esc="contact_phone"/>
<b>Renter Phone</b>: <span t-esc="contact_phone"/>
</li>
</ul>
</template>
@@ -78,14 +78,13 @@ class TestEventData(TestEventBoothCommon):
self.assertEqual(event.event_booth_ids[1].message_partner_ids, self.env['res.partner'])
# change event type to one using booths: include event type booths and keep reserved booths
event_form = Form(event)
event_form.event_type_id = event_type_wbooths
self.assertEqual(event_form.event_booth_count, 3)
with Form(event) as event_form:
event_form.event_type_id = event_type_wbooths
self.assertEqual(event.event_booth_count, 3)
self.assertEqual(
set(r['name'] for r in event_form.event_booth_ids._records),
set(r['name'] for r in event.event_booth_ids),
set(('Custom Standard Booth 2', 'Standard Booth', 'Premium Booth')),
'Should keep booths with reservation, remove unused ones and add type ones'
)
event_form.save()
self.assertEqual(event.event_booth_count_available, 2)
self.assertEqual(event.event_booth_category_ids, self.event_booth_category_1 + self.event_booth_category_2)
@@ -23,9 +23,9 @@
<group name="renter">
<field name="partner_id"/>
<field name="contact_name"/>
<field name="contact_email"/>
<field name="contact_phone"/>
<field name="contact_mobile"/>
<field name="contact_email" widget="email"/>
<field name="contact_phone" widget="phone"/>
<field name="contact_mobile" widget="phone"/>
</group>
</group>
</sheet>
@@ -21,16 +21,6 @@
</div>
</button>
</div>
<page name="tickets" position="after">
<page string="Booths" groups="base.group_no_one">
<!-- The booths created from 'event_type_id' won't be saved if invisible attr is set. -->
<field name="event_booth_ids"
context="{
'form_view_ref': 'event_booth.event_booth_view_form_simple_from_event',
'tree_view_ref': 'event_booth.event_booth_view_tree_from_event',
}"/>
</page>
</page>
</field>
</record>
@@ -18,6 +18,7 @@ class EventBoothCategory(models.Model):
'product.product', string='Product', required=True,
domain=[('detailed_type', '=', 'event_booth')], default=_default_product_id)
price = fields.Float(string='Price', compute='_compute_price', digits='Product Price', readonly=False, store=True)
currency_id = fields.Many2one(related='product_id.currency_id')
price_reduce = fields.Float(
string='Price Reduce', compute='_compute_price_reduce',
compute_sudo=True, digits='Product Price')
@@ -9,6 +9,7 @@ class EventTypeBooth(models.Model):
product_id = fields.Many2one(related='booth_category_id.product_id')
price = fields.Float(related='booth_category_id.price')
currency_id = fields.Many2one(related='booth_category_id.currency_id')
@api.model
def _get_event_booth_fields_whitelist(self):
@@ -82,14 +82,13 @@ class TestEventData(TestEventBoothSaleCommon):
]})
# change event type to one using booths: include event type booths and keep reserved booths
event_form = Form(event)
event_form.event_type_id = event_type_wbooths
self.assertEqual(event_form.event_booth_count, 3)
with Form(event) as event_form:
event_form.event_type_id = event_type_wbooths
self.assertEqual(event.event_booth_count, 3)
self.assertEqual(
set(r['name'] for r in event_form.event_booth_ids._records),
set(r['name'] for r in event.event_booth_ids),
set(('Custom Standard Booth 2', 'Standard Booth', 'Premium Booth')),
'Should keep booths with reservation, remove unused ones and add type ones'
)
event_form.save()
self.assertEqual(event.event_booth_count_available, 2)
self.assertEqual(event.event_booth_category_ids, self.event_booth_category_1 + self.event_booth_category_2)
@@ -9,8 +9,9 @@
<field name="arch" type="xml">
<group name="main" position="inside">
<group string="Booth Details">
<field name="currency_id" invisible="1"/>
<field name="product_id" context="{'default_detailed_type': 'event_booth', 'default_type': 'service'}"/>
<field name="price"/>
<field name="price" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</group>
</group>
</field>
@@ -23,8 +24,9 @@
<field name="priority">3</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="currency_id" invisible="1"/>
<field name="product_id"/>
<field name="price"/>
<field name="price" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</field>
</field>
</record>
@@ -18,8 +18,10 @@
<widget name="web_ribbon" title="Paid" attrs="{'invisible': [('is_paid', '=', False)]}"/>
</div>
<field name="booth_category_id" position="after">
<field name="currency_id" invisible="1"/>
<field name="product_id" attrs="{'invisible': [('booth_category_id', '=', False)]}"/>
<field name="price" attrs="{'invisible': [('booth_category_id', '=', False)]}"/>
<field name="price" widget="monetary" options="{'currency_field': 'currency_id'}"
attrs="{'invisible': [('booth_category_id', '=', False)]}"/>
</field>
<group name="renter" position="after">
<group name="sales" groups="base.group_no_one"
@@ -44,7 +46,8 @@
<field name="inherit_id" ref="event_booth.event_booth_view_tree"/>
<field name="arch" type="xml">
<field name="booth_category_id" position="after">
<field name="price"/>
<field name="currency_id" invisible="1"/>
<field name="price" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</field>
</field>
</record>
@@ -7,8 +7,9 @@
<field name="inherit_id" ref="event_booth.event_type_booth_view_form_from_type"/>
<field name="arch" type="xml">
<field name="booth_category_id" position="after">
<field name="currency_id" invisible="1"/>
<field name="product_id"/>
<field name="price"/>
<field name="price" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</field>
</field>
</record>
@@ -19,8 +20,9 @@
<field name="inherit_id" ref="event_booth.event_type_booth_view_tree_from_type"/>
<field name="arch" type="xml">
<field name="booth_category_id" position="after">
<field name="currency_id" invisible="1"/>
<field name="product_id"/>
<field name="price"/>
<field name="price" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</field>
</field>
</record>
@@ -35,7 +35,7 @@
</record>
<record id="event_booth_configurator_action" model="ir.actions.act_window">
<field name="name">Configure an event booth</field>
<field name="name">Select an event booth</field>
<field name="res_model">event.booth.configurator</field>
<field name="view_mode">form</field>
<field name="target">new</field>
@@ -53,6 +53,6 @@ class SaleOrder(models.Model):
product = self.env['product.product'].browse(product_id)
if product.type == 'event_booth' and set_qty > 1:
set_qty = 1
values['warning'] = _('Sorry, you can\'t modify quantity to an Event Booth product.')
values['warning'] = _('You cannot manually change the quantity of an Event Booth product.')
values.update(super(SaleOrder, self)._cart_update(product_id, line_id, add_qty, set_qty, **kwargs))
return values