Skip to content
Browse files

[FIX] lunch: avoid rewriting ids

The wrong order was used in the row_number call, which lead to ids
changing when writing on `is_favorite`

closes #38092

Signed-off-by: Romain Libert (rli) <>
  • Loading branch information...
RomainLibert committed Oct 7, 2019
1 parent fcf03ea commit 28ebe6d4849a692d234b4c256332525aa71132e5
Showing with 13 additions and 1 deletion.
  1. +1 −1 addons/lunch/report/
  2. +12 −0 addons/lunch/tests/
@@ -79,7 +79,7 @@ def init(self):
CREATE or REPLACE view %s AS (
row_number() over (ORDER BY user_id, AS id,
row_number() over (ORDER BY, AS id, AS product_id,,
@@ -7,3 +7,15 @@
class TestLunchProductReport(TestsCommon):
def test_product_available(self):
self.assertTrue(self.env[''].search([]), 'There should be some record on lunch_product_report')

def test_order_in_report(self):
pizza = self.env[''].search([('product_id', '=',], limit=1)
self.assertEqual(, 'Pizza')
pizza = pizza.with_user(pizza.user_id)
pizza.write({'is_favorite': True})
self.assertTrue(pizza.product_id in pizza.user_id.favorite_lunch_product_ids)

new_pizza = self.env[''].search([('product_id', '=',, ('user_id', '=',])

self.assertEqual(, 'Pizza')

0 comments on commit 28ebe6d

Please sign in to comment.
You can’t perform that action at this time.