Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] point_of_sale: load product requests #126782

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions addons/point_of_sale/models/pos_config.py
Expand Up @@ -653,8 +653,9 @@ def get_limited_products_loading(self, fields):
WITH pm AS (
SELECT product_id,
Max(write_date) date
FROM stock_quant
FROM stock_move_line
GROUP BY product_id
ORDER BY date DESC
)
SELECT p.id
FROM product_product p
Expand All @@ -669,10 +670,11 @@ def get_limited_products_loading(self, fields):
WHERE product_template_id = t.id
AND pos_category_id = ANY(%(available_categ_ids)s)))
) OR p.id=%(tip_product_id)s
ORDER BY t.priority DESC,
t.detailed_type DESC,
COALESCE(pm.date,p.write_date) DESC
LIMIT %(limit)s
ORDER BY t.priority DESC,
case when t.detailed_type = 'service' then 1 else 0 end DESC,
pm.date DESC NULLS LAST,
p.write_date
LIMIT %(limit)s
"""
params = {
'company_id': self.company_id.id,
Expand Down