summaryrefslogtreecommitdiff
path: root/addons/lunch/models
diff options
context:
space:
mode:
authorToufik Ben Jaa <tbe@odoo.com>2019-05-13 13:29:43 +0000
committerToufik Ben Jaa <tbe@odoo.com>2019-05-14 09:57:56 +0000
commit2a7652307e74927c5f9681d16c16d9293e5dbbf1 (patch)
tree7edc859045a0c670b9af2a47852d33452541f016 /addons/lunch/models
parent23d1bb8ea12ba72c3644add9dff860b47f7053e1 (diff)
[FIX] lunch: missing products on lunch order page
- Since the performance commit @c42ccf2ca7f0a600a0dd7e3b4dd8bacd7a5c6513 the lunch products are displayed only if you have already ordered it. - Added indexes on `lunch.order` to speed up the SQL request. closes odoo/odoo#33336 Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
Diffstat (limited to 'addons/lunch/models')
-rw-r--r--addons/lunch/models/lunch_order.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/lunch/models/lunch_order.py b/addons/lunch/models/lunch_order.py
index ee3f01c6d44..8ad99e9f940 100644
--- a/addons/lunch/models/lunch_order.py
+++ b/addons/lunch/models/lunch_order.py
@@ -42,6 +42,10 @@ class LunchOrder(models.Model):
display_toppings = fields.Text('Toppings', 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)"""
+ % self._table)
+
@api.depends('topping_ids_1', 'topping_ids_2', 'topping_ids_3', 'product_id', 'quantity')
def _compute_total_price(self):
for line in self: