From 01ae6a69f2287f0ed28b058de5c116cca530e651 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Fri, 9 Jul 2021 14:44:29 +0200 Subject: [PATCH] [IMP] lunch: Improve general UX (back2basics) TaskID: 2586326 --- addons/lunch/data/lunch_demo.xml | 28 +++++++++++++++++++ addons/lunch/models/lunch_order.py | 8 ++++-- addons/lunch/models/lunch_supplier.py | 2 +- .../static/src/js/lunch_controller_common.js | 1 - addons/lunch/static/src/scss/lunch_view.scss | 9 ++++++ addons/lunch/views/lunch_orders_views.xml | 7 +++-- addons/lunch/views/lunch_product_views.xml | 1 + 7 files changed, 49 insertions(+), 7 deletions(-) diff --git a/addons/lunch/data/lunch_demo.xml b/addons/lunch/data/lunch_demo.xml index 14dab611a67..44695fc994d 100644 --- a/addons/lunch/data/lunch_demo.xml +++ b/addons/lunch/data/lunch_demo.xml @@ -13,6 +13,7 @@ 975 Bullock Orchard 02155 cynthiasanchez@gmail.com + @@ -22,6 +23,7 @@ Beef, Bacon, Salad, Cheddar, Fried Onion, BBQ Sauce + @@ -31,6 +33,7 @@ Beef, Cheddar, Salad, Fried Onions, BBQ Sauce + @@ -40,6 +43,7 @@ Ham, Cheese, Vegetables + @@ -47,6 +51,7 @@ 2.9 + @@ -55,6 +60,7 @@ 6.90 Tomatoes, Mozzarella + @@ -174,6 +180,7 @@ Beef, Bacon, Salad, Cheddar, Fried Onion, BBQ Sauce + @@ -183,6 +190,7 @@ Beef, Cheddar, Salad, Fried Onions, BBQ Sauce + @@ -191,6 +199,7 @@ 3.0 + @@ -199,6 +208,7 @@ 3.0 + @@ -208,6 +218,7 @@ Mozzarella, Pesto, Tomatoes + @@ -217,6 +228,7 @@ Ham, Cheese, Vegetables + @@ -227,6 +239,7 @@ 6 Maki Salmon - 6 Maki Tuna - 6 Maki Shrimp/Avocado + @@ -237,6 +250,7 @@ 4 Sushi Salmon - 6 Maki Salmon - 4 Sashimi Salmon + @@ -247,6 +261,7 @@ 1 Avocado - 1 Salmon - 1 Eggs - 1 Tuna + @@ -257,6 +272,7 @@ 2 Tempuras, Cabbages, Onions, Sesame Sauce + @@ -266,6 +282,7 @@ Cheese, Ham, Salad, Tomatoes, cucumbers, eggs + @@ -275,6 +292,7 @@ Brie, Honey, Walnut Kernels + @@ -284,6 +302,7 @@ Tuna, Mayonnaise + @@ -293,6 +312,7 @@ + @@ -302,6 +322,7 @@ + @@ -311,6 +332,7 @@ Tomatoes, Mozzarella + @@ -320,6 +342,7 @@ Tomatoes, Mushrooms, Mozzarella + @@ -329,6 +352,7 @@ Tomatoes, Mozzarella, Mushrooms, Peppers, Olives + @@ -338,6 +362,7 @@ Fresh Tomatoes, Basil, Mozzarella + @@ -347,6 +372,7 @@ + @@ -356,6 +382,7 @@ Tomatoes, Basil + @@ -371,6 +398,7 @@ Tomato sauce, Olive oil, Fresh Tomatoes, Onions, Vegetables, Parmesan + diff --git a/addons/lunch/models/lunch_order.py b/addons/lunch/models/lunch_order.py index 25adf1eb681..9ecf4ab5297 100644 --- a/addons/lunch/models/lunch_order.py +++ b/addons/lunch/models/lunch_order.py @@ -11,7 +11,7 @@ class LunchOrder(models.Model): _order = 'id desc' _display_name = 'product_id' - name = fields.Char(related='product_id.name', string="Product Name", readonly=True) # to remove + name = fields.Char(related='product_id.name', string="Product Name", store=True, readonly=True) 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)]) @@ -27,8 +27,7 @@ class LunchOrder(models.Model): states={'new': [('readonly', False)]}, default=lambda self: self.env.uid) note = fields.Text('Notes') - price = fields.Float('Total Price', compute='_compute_total_price', readonly=True, store=True, - digits='Account') + price = fields.Monetary('Total Price', compute='_compute_total_price', readonly=True, store=True) active = fields.Boolean('Active', default=True) state = fields.Selection([('new', 'To Order'), ('ordered', 'Ordered'), @@ -206,3 +205,6 @@ class LunchOrder(models.Model): def action_cancel(self): self.write({'state': 'cancelled'}) + + def action_reset(self): + self.write({'state': 'ordered'}) diff --git a/addons/lunch/models/lunch_supplier.py b/addons/lunch/models/lunch_supplier.py index 9309d40d38f..3776544e6e9 100644 --- a/addons/lunch/models/lunch_supplier.py +++ b/addons/lunch/models/lunch_supplier.py @@ -189,7 +189,7 @@ class LunchSupplier(models.Model): ('supplier_id', '=', self.id), ('state', '=', 'ordered'), ('date', '=', fields.Date.context_today(self.with_context(tz=self.tz))), - ]) + ], order="user_id, name") if not orders: return diff --git a/addons/lunch/static/src/js/lunch_controller_common.js b/addons/lunch/static/src/js/lunch_controller_common.js index 8cd09316220..e9d86897844 100644 --- a/addons/lunch/static/src/js/lunch_controller_common.js +++ b/addons/lunch/static/src/js/lunch_controller_common.js @@ -140,7 +140,6 @@ var LunchControllerCommon = { }, }; - // YTI TODO Maybe don't always pass the default_product_id var action = { res_model: 'lunch.order', name: _t('Configure Your Order'), diff --git a/addons/lunch/static/src/scss/lunch_view.scss b/addons/lunch/static/src/scss/lunch_view.scss index 6b7056f96f7..a19834d809f 100644 --- a/addons/lunch/static/src/scss/lunch_view.scss +++ b/addons/lunch/static/src/scss/lunch_view.scss @@ -9,6 +9,9 @@ flex: 0 0 auto; border-bottom: 1px solid #CED4DA; background-color: white; + position: fixed; + z-index: 50; + width: 90%; } .o_lunch_purple { @@ -50,6 +53,12 @@ } } +.o_kanban_view { + &.o_lunch_kanban_view { + padding-top: 11rem; + } +} + .o_lunch_image { img { max-width: 128px; diff --git a/addons/lunch/views/lunch_orders_views.xml b/addons/lunch/views/lunch_orders_views.xml index 9ea8265cd2e..70dbb1a16bc 100644 --- a/addons/lunch/views/lunch_orders_views.xml +++ b/addons/lunch/views/lunch_orders_views.xml @@ -46,6 +46,7 @@