diff options
| author | Kevin Baptiste <kba@odoo.com> | 2019-06-27 14:24:41 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2019-07-16 11:44:35 +0000 |
| commit | 50163143a915635eda08dc1f053e057c38871f42 (patch) | |
| tree | 71c1dcdb08ac95a7a65ac0e9c5bb1be277e3a2e2 /addons | |
| parent | 8f137f66bc4a43a43da111cfde04d4fd27e455ea (diff) | |
[IMP] lunch: Improve the general UX (back2basics)
- Reorganize configure your order screen
- Alert users through chat: Alerts can now be configured to
send a chat message to the employees.
- Replace toppings by extras
closes odoo/odoo#34470
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons')
19 files changed, 187 insertions, 49 deletions
diff --git a/addons/lunch/controllers/main.py b/addons/lunch/controllers/main.py index 2097f86659a..3a94df70669 100644 --- a/addons/lunch/controllers/main.py +++ b/addons/lunch/controllers/main.py @@ -100,6 +100,7 @@ class LunchController(http.Controller): alert_domain = expression.AND([ [('available_today', '=', True)], [('location_ids', 'in', user_location.id)], + [('mode', '=', 'alert')], ]) res.update({ diff --git a/addons/lunch/data/ir_cron_data.xml b/addons/lunch/data/ir_cron_data.xml index e7c34640bb5..5c78a5b7509 100644 --- a/addons/lunch/data/ir_cron_data.xml +++ b/addons/lunch/data/ir_cron_data.xml @@ -13,5 +13,17 @@ <field name="numbercall">-1</field> <field name="doall" eval="False"/> </record> + <record id="ir_cron_lunch_alerts" model="ir.cron"> + <field name="name">Lunch: alert chat notification</field> + <field name="model_id" ref="model_lunch_alert"/> + <field name="state">code</field> + <field name="code">model._notify_chat()</field> + <field name="active" eval="True"/> + <field name="user_id" ref="base.user_root"/> + <field name="interval_number">5</field> + <field name="interval_type">minutes</field> + <field name="numbercall">-1</field> + <field name="doall" eval="False"/> + </record> </data> </odoo> diff --git a/addons/lunch/models/lunch_alert.py b/addons/lunch/models/lunch_alert.py index 5a265f75f71..fb8b7b4b369 100644 --- a/addons/lunch/models/lunch_alert.py +++ b/addons/lunch/models/lunch_alert.py @@ -1,9 +1,14 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +import pytz from odoo import api, fields, models from odoo.osv import expression +from .lunch_supplier import float_to_time +from datetime import datetime, timedelta + +from odoo.addons.base.models.res_partner import _tz_get WEEKDAY_TO_NAME = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] @@ -14,9 +19,23 @@ class LunchAlert(models.Model): _description = 'Lunch Alert' _order = 'write_date desc, id' - name = fields.Char(required=True) + name = fields.Char('Alert Name', required=True) message = fields.Html('Message', required=True) + mode = fields.Selection([ + ('alert', 'Alert in app'), + ('chat', 'Chat notification')], string='Display', default='alert') + recipients = fields.Selection([ + ('everyone', 'Everyone'), + ('last_week', 'Employee who ordered last week'), + ('last_month', 'Employee who ordered last month'), + ('last_year', 'Employee who ordered last year')], string='Recipients', default='everyone') + notification_time = fields.Float(default=10.0, string='Notification Time') + notification_moment = fields.Selection([ + ('am', 'AM'), + ('pm', 'PM')], default='am', required=True) + tz = fields.Selection(_tz_get, string='Timezone', required=True, default=lambda self: self.env.user.tz or 'UTC') + until = fields.Date('Show Until') recurrency_monday = fields.Boolean('Monday') recurrency_tuesday = fields.Boolean('Tuesday') @@ -33,6 +52,12 @@ class LunchAlert(models.Model): location_ids = fields.Many2many('lunch.location', string='Location') + _sql_constraints = [ + ('notification_time_range', + 'CHECK(notification_time >= 0 and notification_time <= 12)', + 'Notification time must be between 0 and 12') + ] + @api.depends('recurrency_monday', 'recurrency_tuesday', 'recurrency_wednesday', 'recurrency_thursday', 'recurrency_friday', 'recurrency_saturday', 'recurrency_sunday') @@ -58,3 +83,37 @@ class LunchAlert(models.Model): [('until', '>' if searching_for_true else '<', today)], ]) ]) + + def _notify_chat(self): + records = self.search([('mode', '=', 'chat'), ('active', '=', True)]) + + today = fields.Date.today() + now = fields.Datetime.now() + + for alert in records: + notification_to = now.astimezone(pytz.timezone(alert.tz)).replace(second=0, microsecond=0, tzinfo=None) + notification_from = notification_to - timedelta(minutes=5) + send_at = datetime.combine(fields.Date.today(), + float_to_time(alert.notification_time, alert.notification_moment)) + + if alert.available_today and send_at > notification_from and send_at <= notification_to: + order_domain = [('state', '!=', 'cancelled')] + + if alert.location_ids.ids: + order_domain = expression.AND([order_domain, [('user_id.last_lunch_location_id', 'in', alert.location_ids.ids)]]) + + if alert.recipients != 'everyone': + weeks = 1 + + if alert.recipients == 'last_month': + weeks = 4 + else: # last_year + weeks = 52 + + delta = timedelta(weeks=weeks) + order_domain = expression.AND([order_domain, [('date', '>=', today - delta)]]) + + orders = self.env['lunch.order'].search(order_domain).mapped('user_id') + partner_ids = [user.partner_id.id for user in orders] + if partner_ids: + self.env['mail.thread'].message_notify(body=alert.message, partner_ids=partner_ids) diff --git a/addons/lunch/models/lunch_order.py b/addons/lunch/models/lunch_order.py index d7c52bfdf4b..0ab049b0997 100644 --- a/addons/lunch/models/lunch_order.py +++ b/addons/lunch/models/lunch_order.py @@ -12,9 +12,9 @@ class LunchOrder(models.Model): _display_name = 'product_id' name = fields.Char(related='product_id.name', string="Product Name", readonly=True) # to remove - topping_ids_1 = fields.Many2many('lunch.topping', 'lunch_order_topping', 'order_id', 'topping_id', string='Toppings 1', domain=[('topping_category', '=', 1)]) - topping_ids_2 = fields.Many2many('lunch.topping', 'lunch_order_topping', 'order_id', 'topping_id', string='Toppings 2', domain=[('topping_category', '=', 2)]) - topping_ids_3 = fields.Many2many('lunch.topping', 'lunch_order_topping', 'order_id', 'topping_id', string='Toppings 3', domain=[('topping_category', '=', 3)]) + topping_ids_1 = fields.Many2many('lunch.topping', 'lunch_order_topping', 'order_id', 'topping_id', string='Extras 1', domain=[('topping_category', '=', 1)]) + topping_ids_2 = fields.Many2many('lunch.topping', 'lunch_order_topping', 'order_id', 'topping_id', string='Extras 2', domain=[('topping_category', '=', 2)]) + topping_ids_3 = fields.Many2many('lunch.topping', 'lunch_order_topping', 'order_id', 'topping_id', string='Extras 3', domain=[('topping_category', '=', 3)]) product_id = fields.Many2one('lunch.product', string="Product", required=True) category_id = fields.Many2one('lunch.product.category', string='Product Category', related='product_id.category_id', readonly=True, store=True) @@ -39,7 +39,7 @@ class LunchOrder(models.Model): currency_id = fields.Many2one('res.currency', related='company_id.currency_id', readonly=True, store=True) quantity = fields.Float('Quantity', required=True, default=1) - display_toppings = fields.Text('Toppings', compute='_compute_display_toppings', store=True) + display_toppings = fields.Text('Extras', compute='_compute_display_toppings', store=True) def init(self): self._cr.execute("""CREATE INDEX IF NOT EXISTS lunch_order_user_product_date ON %s (user_id, product_id, date)""" diff --git a/addons/lunch/models/lunch_product.py b/addons/lunch/models/lunch_product.py index 4929d986b90..07a6290e157 100644 --- a/addons/lunch/models/lunch_product.py +++ b/addons/lunch/models/lunch_product.py @@ -14,24 +14,24 @@ class LunchProductCategory(models.Model): name = fields.Char('Product Category', required=True) company_id = fields.Many2one('res.company', default=lambda self: self.env.company) currency_id = fields.Many2one('res.currency', related='company_id.currency_id') - topping_label_1 = fields.Char('Topping 1 Label', required=True, default='Supplements') - topping_label_2 = fields.Char('Topping 2 Label', required=True, default='Beverages') - topping_label_3 = fields.Char('Topping 3 Label', required=True, default='Topping Label 3') + topping_label_1 = fields.Char('Extra 1 Label', required=True, default='Extras') + topping_label_2 = fields.Char('Extra 2 Label', required=True, default='Beverages') + topping_label_3 = fields.Char('Extra 3 Label', required=True, default='Extra Label 3') topping_ids_1 = fields.One2many('lunch.topping', 'category_id', domain=[('topping_category', '=', 1)], ondelete='cascade') topping_ids_2 = fields.One2many('lunch.topping', 'category_id', domain=[('topping_category', '=', 2)], ondelete='cascade') topping_ids_3 = fields.One2many('lunch.topping', 'category_id', domain=[('topping_category', '=', 3)], ondelete='cascade') topping_quantity_1 = fields.Selection([ ('0_more', 'None or More'), ('1_more', 'One or More'), - ('1', 'Only One')], 'Topping 1 Quantity', default='0_more', required=True) + ('1', 'Only One')], 'Extra 1 Quantity', default='0_more', required=True) topping_quantity_2 = fields.Selection([ ('0_more', 'None or More'), ('1_more', 'One or More'), - ('1', 'Only One')], 'Topping 2 Quantity', default='0_more', required=True) + ('1', 'Only One')], 'Extra 2 Quantity', default='0_more', required=True) topping_quantity_3 = fields.Selection([ ('0_more', 'None or More'), ('1_more', 'One or More'), - ('1', 'Only One')], 'Topping 3 Quantity', default='0_more', required=True) + ('1', 'Only One')], 'Extra 3 Quantity', default='0_more', required=True) product_count = fields.Integer(compute='_compute_product_count', help="The number of products related to this category") def _compute_product_count(self): @@ -63,7 +63,7 @@ class LunchProductCategory(models.Model): class LunchTopping(models.Model): """""" _name = 'lunch.topping' - _description = 'Lunch Toppings' + _description = 'Lunch Extras' name = fields.Char('Name', required=True) company_id = fields.Many2one('res.company', default=lambda self: self.env.company) diff --git a/addons/lunch/report/lunch_cashmove_report.py b/addons/lunch/report/lunch_cashmove_report.py index b4615823082..6741d7d2fa3 100644 --- a/addons/lunch/report/lunch_cashmove_report.py +++ b/addons/lunch/report/lunch_cashmove_report.py @@ -41,7 +41,7 @@ class CashmoveReport(models.Model): lol.date as date, lol.currency_id as currency_id, lol.user_id as user_id, - format('Order for %%s x %%s %%s', lol.quantity::text, lp.name, lol.display_toppings) as description + format('Order: %%s x %%s %%s', lol.quantity::text, lp.name, lol.display_toppings) as description FROM lunch_order lol JOIN lunch_product lp ON lp.id = lol.product_id WHERE diff --git a/addons/lunch/static/src/js/lunch_kanban_controller.js b/addons/lunch/static/src/js/lunch_kanban_controller.js index f1acf81b301..a0f02b020a7 100644 --- a/addons/lunch/static/src/js/lunch_kanban_controller.js +++ b/addons/lunch/static/src/js/lunch_kanban_controller.js @@ -169,6 +169,7 @@ var LunchKanbanController = KanbanController.extend({ this.do_action({ res_model: 'lunch.order.temp', + name: 'Configure Your Order', type: 'ir.actions.act_window', views: [[false, 'form']], target: 'new', diff --git a/addons/lunch/static/src/scss/lunch_kanban.scss b/addons/lunch/static/src/scss/lunch_kanban.scss index 51acfd2b3f8..2e315025398 100644 --- a/addons/lunch/static/src/scss/lunch_kanban.scss +++ b/addons/lunch/static/src/scss/lunch_kanban.scss @@ -51,6 +51,13 @@ } } +.o_lunch_image { + img { + max-width: 128px; + max-height: 128px !important; + } +} + @include media-breakpoint-down(sm) { .o_lunch_kanban { details summary { @@ -65,3 +72,11 @@ } } } + +.o_lunch_wizard { + .col-10 { + .o_form_label { + font-weight: normal !important; + } + } +}
\ No newline at end of file diff --git a/addons/lunch/static/src/scss/lunch_list.scss b/addons/lunch/static/src/scss/lunch_list.scss new file mode 100644 index 00000000000..2babc5e388e --- /dev/null +++ b/addons/lunch/static/src/scss/lunch_list.scss @@ -0,0 +1,5 @@ +.o_lunch_list { + .o_list_button { + width: 1px; + } +}
\ No newline at end of file diff --git a/addons/lunch/static/src/xml/lunch_kanban.xml b/addons/lunch/static/src/xml/lunch_kanban.xml index 3b3b319ce95..1695319d96f 100644 --- a/addons/lunch/static/src/xml/lunch_kanban.xml +++ b/addons/lunch/static/src/xml/lunch_kanban.xml @@ -4,10 +4,10 @@ <div class="o_lunch_widget row py-3 py-md-0"> <div class="o_lunch_widget_info col-12 col-md-4 card border-0"> <div class="card-body row no-gutters align-items-center"> - <div class="col-3 col-md-6 col-lg-4"> + <div class="col-3 col-md-6 col-lg-3"> <img class="rounded-circle" t-attf-src="{{ widget.userimage }}"/> </div> - <div class="col-9 col-md-6 col-lg-8"> + <div class="col-9 col-md-6 col-lg-9"> <div class="pl-3"> <div class="o_lunch_user_field py-1"/> <div class="o_lunch_location_field py-1"/> @@ -87,7 +87,7 @@ </div> </div> <t t-foreach="widget.alerts" t-as="alert"> - <div class="alert alert-danger" role="alert"> + <div class="alert alert-warning" role="alert"> <t t-raw="alert.message"/> <!-- alert.message is coming from a fields.Html so it should be safe --> </div> </t> diff --git a/addons/lunch/static/tests/lunch_kanban_tests.js b/addons/lunch/static/tests/lunch_kanban_tests.js index 8bc4879f9e5..1757414c6c4 100644 --- a/addons/lunch/static/tests/lunch_kanban_tests.js +++ b/addons/lunch/static/tests/lunch_kanban_tests.js @@ -591,6 +591,7 @@ QUnit.module('LunchKanbanView', { intercepts: { do_action: function (ev) { assert.deepEqual(ev.data.action, { + name: "Configure Your Order", res_model: 'lunch.order.temp', type: 'ir.actions.act_window', views: [[false, 'form']], diff --git a/addons/lunch/views/lunch_alert_views.xml b/addons/lunch/views/lunch_alert_views.xml index 15fc85fb0ca..fefea3ca7e5 100644 --- a/addons/lunch/views/lunch_alert_views.xml +++ b/addons/lunch/views/lunch_alert_views.xml @@ -18,10 +18,11 @@ <field name="model">lunch.alert</field> <field name="arch" type="xml"> <tree> - <field name="active" widget="boolean_toggle"/> <field name="name"/> + <field name="mode"/> <field name="message" invisible="1"/> <field name="available_today"/> + <field name="active" widget="boolean_toggle"/> </tree> </field> </record> @@ -40,6 +41,8 @@ </div> <group> <group> + <field name="mode" widget="radio"/> + <field name="recipients" attrs="{'invisible': [['mode', '!=', 'chat']]}" widget="radio"/> <field name="location_ids" widget="many2many_tags"/> <field name="until"/> <field name="active"/> @@ -52,6 +55,12 @@ <field name="recurrency_friday"/> <field name="recurrency_saturday"/> <field name="recurrency_sunday"/> + <label for="notification_time" attrs="{'invisible': [['mode', '!=', 'chat']]}"/> + <div class="o_row" attrs="{'invisible': [['mode', '!=', 'chat']]}"> + <field name="notification_time" attrs="{'required': [('mode', '=', 'chat')]}" widget="float_time"/> + <field name="notification_moment"/> + </div> + <field name="tz" groups="base.group_no_one"/> </group> <group> <field name="message"/> @@ -67,7 +76,7 @@ <field name="res_model">lunch.alert</field> <field name="search_view_id" ref="lunch_alert_view_search"/> <field name="view_mode">tree,form</field> + <field name="domain">['|', ('active', '=', True), ('active', '=', False)]</field> <field name="view_id" ref="lunch_alert_view_tree"/> - <field name="context">{'search_default_inactive': 1, 'search_default_active': 1}</field> </record> </odoo> diff --git a/addons/lunch/views/lunch_cashmove_views.xml b/addons/lunch/views/lunch_cashmove_views.xml index b970cfb10ae..dec3bbf9e50 100644 --- a/addons/lunch/views/lunch_cashmove_views.xml +++ b/addons/lunch/views/lunch_cashmove_views.xml @@ -88,7 +88,7 @@ </record> <record id="lunch_cashmove_action_payment" model="ir.actions.act_window"> - <field name="name">Register Cash Moves</field> + <field name="name">Cash Moves</field> <field name="res_model">lunch.cashmove</field> <field name="view_mode">tree,kanban,form</field> <field name="search_view_id" ref="lunch_cashmove_view_search"/> diff --git a/addons/lunch/views/lunch_orders_views.xml b/addons/lunch/views/lunch_orders_views.xml index b2b6f03177c..0995e6cf484 100644 --- a/addons/lunch/views/lunch_orders_views.xml +++ b/addons/lunch/views/lunch_orders_views.xml @@ -17,7 +17,7 @@ <field name="user_id"/> <group expand="0" string="Group By"> <filter name="group_by_supplier" string="By Vendor" context="{'group_by':'supplier_id'}"/> - <filter name="group_by_date" string="Order Date" context="{'group_by':'date'}" help="Vendor Orders by Date"/> + <filter name="group_by_date" string="Order Date" context="{'group_by':'date:day'}" help="Vendor Orders by Date"/> </group> </search> </field> @@ -27,7 +27,7 @@ <field name="name">lunch.order.tree</field> <field name="model">lunch.order</field> <field name="arch" type="xml"> - <tree string="Order lines Tree" create="false" edit="false" decoration-muted="state == 'cancelled'"> + <tree string="Order lines Tree" create="false" edit="false" decoration-muted="state == 'cancelled'" class="o_lunch_list"> <field name='date'/> <field name='supplier_id' invisible='1'/> <field name='product_id'/> @@ -36,10 +36,10 @@ <field name='user_id'/> <field name="currency_id" invisible="1"/> <field name='price' sum="Total" string="Price" widget="monetary"/> - <button name="action_confirm" string="Confirm" type="object" icon="fa-phone text-success" attrs="{'invisible': [('state', '!=', 'ordered')]}" groups="lunch.group_lunch_manager"/> - <button name="action_cancel" string="Cancel" type="object" icon="fa-times-circle text-danger" attrs="{'invisible': [('state', 'in', ['cancelled', 'confirmed'])]}" groups="lunch.group_lunch_manager"/> <field name='state'/> <field name="company_id" groups="base.group_multi_company"/> + <button name="action_confirm" string="Confirm" type="object" icon="fa-phone text-success" attrs="{'invisible': [('state', '!=', 'ordered')]}" groups="lunch.group_lunch_manager"/> + <button name="action_cancel" string="Cancel" type="object" icon="fa-times-circle text-danger" attrs="{'invisible': [('state', 'in', ['cancelled', 'confirmed'])]}" groups="lunch.group_lunch_manager"/> </tree> </field> </record> @@ -120,11 +120,11 @@ </record> <record id="lunch_order_action" model="ir.actions.act_window"> - <field name="name">Your Orders</field> + <field name="name">My Orders</field> <field name="res_model">lunch.order</field> <field name="view_mode">tree,kanban,pivot</field> <field name="search_view_id" ref="lunch_order_view_search"/> - <field name="context">{"search_default_is_mine":1}</field> + <field name="context">{"search_default_is_mine":1, "search_default_group_by_date": 1}</field> <field name="help" type="html"> <p class="o_view_nocontent_empty_folder"> No previous order found @@ -135,7 +135,7 @@ </record> <record id="lunch_order_action_by_supplier" model="ir.actions.act_window"> - <field name="name">Orders by Vendor</field> + <field name="name">Today's Orders</field> <field name="res_model">lunch.order</field> <field name="view_mode">tree,kanban</field> <field name="search_view_id" ref="lunch_order_view_search"/> diff --git a/addons/lunch/views/lunch_product_views.xml b/addons/lunch/views/lunch_product_views.xml index 6b0179c988c..b6012781b10 100644 --- a/addons/lunch/views/lunch_product_views.xml +++ b/addons/lunch/views/lunch_product_views.xml @@ -126,7 +126,7 @@ <field name="model">lunch.product</field> <field name="priority">5</field> <field name="arch" type="xml"> - <kanban class="o_kanban_mobile"> + <kanban create="1" edit="0" class="o_kanban_mobile"> <field name="id"/> <field name="name"/> <field name="category_id"/> @@ -168,7 +168,7 @@ <record id="lunch_product_action_statbutton" model="ir.actions.act_window"> <field name="name">Products</field> <field name="res_model">lunch.product</field> - <field name="view_mode">tree,kanban,form</field> + <field name="view_mode">kanban,tree,form</field> <field name="context">{'search_default_group_by_supplier': 1}</field> <field name="help" type="html"> <p class="o_view_nocontent_smiling_face"> @@ -184,7 +184,7 @@ <field name="model">lunch.product.category</field> <field name="arch" type="xml"> <tree string="Products List"> - <field name='name' string="Product Category: "/> + <field name='name' string="Product Category"/> <field name="company_id" groups="base.group_multi_company"/> </tree> </field> diff --git a/addons/lunch/views/lunch_templates.xml b/addons/lunch/views/lunch_templates.xml index 40c57da0b79..b39211bf3af 100644 --- a/addons/lunch/views/lunch_templates.xml +++ b/addons/lunch/views/lunch_templates.xml @@ -3,6 +3,7 @@ <template id="assets_backend" name="lunch assets" inherit_id="web.assets_backend"> <xpath expr="." position="inside"> <link rel="stylesheet" type="text/scss" href="/lunch/static/src/scss/lunch_kanban.scss"/> + <link rel="stylesheet" type="text/scss" href="/lunch/static/src/scss/lunch_list.scss"/> <script type="text/javascript" src="/lunch/static/src/js/lunch_kanban_widget.js"></script> <script type="text/javascript" src="/lunch/static/src/js/lunch_payment_dialog.js"></script> diff --git a/addons/lunch/views/lunch_views.xml b/addons/lunch/views/lunch_views.xml index 88e5d61a280..c0254e906cc 100644 --- a/addons/lunch/views/lunch_views.xml +++ b/addons/lunch/views/lunch_views.xml @@ -7,13 +7,13 @@ <menuitem name="Configuration" parent="menu_lunch" id="menu_lunch_config" sequence="53" groups="group_lunch_manager"/> <menuitem name="New Order" parent="menu_lunch_title" id="lunch_order_menu_form" action="lunch.lunch_product_action_order" sequence="1"/> - <menuitem name="My Orders" parent="menu_lunch_title" id="lunch_order_menu_tree" action="lunch_order_action" sequence="2"/> - <menuitem name="My Lunch Account" parent="menu_lunch_title" id="lunch_cashmove_report_menu_form" action="lunch_cashmove_report_action_account" sequence="3"/> + <menuitem name="My Order History" parent="menu_lunch_title" id="lunch_order_menu_tree" action="lunch_order_action" sequence="2"/> + <menuitem name="My Account History" parent="menu_lunch_title" id="lunch_cashmove_report_menu_form" action="lunch_cashmove_report_action_account" sequence="3"/> <menuitem name="Today's Orders" parent="menu_lunch_admin" id="lunch_order_menu_by_supplier" action="lunch_order_action_by_supplier" /> - <menuitem name="Orders by Vendor" parent="menu_lunch_admin" id="lunch_order_menu_control_suppliers" action="lunch_order_action_control_suppliers" /> + <menuitem name="Control Vendors" parent="menu_lunch_admin" id="lunch_order_menu_control_suppliers" action="lunch_order_action_control_suppliers" /> <menuitem name="Control Accounts" parent="menu_lunch_admin" id="lunch_cashmove_report_menu_control_accounts" action="lunch_cashmove_report_action_control_accounts"/> - <menuitem name="Employee Payments" parent="menu_lunch_admin" id="lunch_cashmove_report_menu_payment" action="lunch_cashmove_action_payment"/> + <menuitem name="Cash Moves" parent="menu_lunch_admin" id="lunch_cashmove_report_menu_payment" action="lunch_cashmove_action_payment"/> <menuitem name="Settings" parent="menu_lunch_config" id="lunch_settings_menu" action="lunch_config_settings_action" sequence="1"/> <menuitem name="Vendors" parent="menu_lunch_config" id="lunch_vendors_menu" action="lunch_vendors_action" sequence="2"/> diff --git a/addons/lunch/wizard/lunch_line_wizard.py b/addons/lunch/wizard/lunch_line_wizard.py index 4a704215443..3678449a615 100644 --- a/addons/lunch/wizard/lunch_line_wizard.py +++ b/addons/lunch/wizard/lunch_line_wizard.py @@ -43,9 +43,13 @@ class LunchOrderWizard(models.TransientModel): domain="[('category_id', '=', product_category), ('topping_category', '=', 3)]", default=lambda self: self._default_order_line().topping_ids_3) - available_toppings_1 = fields.Boolean(help='Are toppings available for this product', compute='_compute_available_toppings') - available_toppings_2 = fields.Boolean(help='Are toppings available for this product', compute='_compute_available_toppings') - available_toppings_3 = fields.Boolean(help='Are toppings available for this product', compute='_compute_available_toppings') + available_toppings_1 = fields.Boolean(help='Are extras available for this product', compute='_compute_available_toppings') + available_toppings_2 = fields.Boolean(help='Are extras available for this product', compute='_compute_available_toppings') + available_toppings_3 = fields.Boolean(help='Are extras available for this product', compute='_compute_available_toppings') + + image = fields.Binary(related='product_id.image') + image_medium = fields.Binary(related='product_id.image_medium') + image_small = fields.Binary(related='product_id.image_small') quantity = fields.Float('Quantity', default=1) price_total = fields.Float('Total Price', compute='_compute_price_total') diff --git a/addons/lunch/wizard/lunch_line_wizard_views.xml b/addons/lunch/wizard/lunch_line_wizard_views.xml index 2e3a6990caa..94afac2e5f4 100644 --- a/addons/lunch/wizard/lunch_line_wizard_views.xml +++ b/addons/lunch/wizard/lunch_line_wizard_views.xml @@ -14,19 +14,49 @@ <field name="available_toppings_2" invisible="1"/> <field name="available_toppings_3" invisible="1"/> <field name="edit" invisible="1"/> - <h2 class="d-flex"> - <div class="flex-grow-1 pr-5"><field name="product_name"/></div> - <div class="flex-grow-0"><field name="price_total" widget="monetary"/></div> - </h2> - <group col="4"> - <field name="topping_label_1" nolabel="1" attrs="{'invisible': [('available_toppings_1', '=', False)]}" class="o_form_label"/> - <field name="topping_ids_1" attrs="{'invisible': [('available_toppings_1', '=', False)]}" widget="many2many_checkboxes" nolabel="1" colspan="3"/> - <field name="topping_label_2" nolabel="1" attrs="{'invisible': [('available_toppings_2', '=', False)]}" class="o_form_label"/> - <field name="topping_ids_2" attrs="{'invisible': [('available_toppings_2', '=', False)]}" widget="many2many_checkboxes" nolabel="1" colspan="3"/> - <field name="topping_label_3" nolabel="1" attrs="{'invisible': [('available_toppings_3', '=', False)]}" class="o_form_label"/> - <field name="topping_ids_3" attrs="{'invisible': [('available_toppings_3', '=', False)]}" widget="many2many_checkboxes" nolabel="1" colspan="3"/> - <field name="note" placeholder="Informations, allergens, ..." colspan="3"/> - </group> + <div class="d-flex"> + <div class="flex-grow-0 pr-5"> + <field name="image_medium" widget="image" class="o_lunch_image" /> + </div> + <div class="flex-grow-1 pr-5"> + <h2><field name="product_name"/></h2> + <h3 class="pt-3"><field name="price_total" widget="monetary"/></h3> + </div> + </div> + <div class="o_lunch_wizard"> + <div class="row"> + <div class="col-2"> + <field name="topping_label_1" nolabel="1" attrs="{'invisible': [('available_toppings_1', '=', False)]}" class="font-weight-bold"/> + </div> + <div class="col-10"> + <field name="topping_ids_1" attrs="{'invisible': [('available_toppings_1', '=', False)]}" widget="many2many_checkboxes" nolabel="1"/> + </div> + </div> + <div class="row"> + <div class="col-2"> + <field name="topping_label_2" nolabel="1" attrs="{'invisible': [('available_toppings_2', '=', False)]}" class="font-weight-bold"/> + </div> + <div class="col-10"> + <field name="topping_ids_2" attrs="{'invisible': [('available_toppings_2', '=', False)]}" widget="many2many_checkboxes" nolabel="1"/> + </div> + </div> + <div class="row"> + <div class="col-2"> + <field name="topping_label_3" nolabel="1" attrs="{'invisible': [('available_toppings_3', '=', False)]}" class="font-weight-bold"/> + </div> + <div class="col-10"> + <field name="topping_ids_3" attrs="{'invisible': [('available_toppings_3', '=', False)]}" widget="many2many_checkboxes" nolabel="1"/> + </div> + </div> + <div class="row"> + <div class="col-2"> + <label for="note" class="font-weight-bold" /> + </div> + <div class="col-10"> + <field name="note" nolabel="1" placeholder="Informations, allergens, ..." /> + </div> + </div> + </div> <footer> <button name="add_to_cart" string="Add To Cart" type="object" class="oe_highlight" attrs="{'invisible': [('edit', '=', True)]}"/> <button name="add_to_cart" string="Save" type="object" class="oe_highlight" attrs="{'invisible': [('edit', '=', False)]}"/> |
