details:   https://code.tryton.org/tryton/commit/3b49f78c45de
branch:    7.8
user:      Cédric Krier <[email protected]>
date:      Wed Apr 15 16:26:20 2026 +0200
description:
        Sort Shopify products by ID when position is None

        Closes #14774
        (grafted from 200ef3ae85b8b2c945b11ff2b1c1b904195f332b)
diffstat:

 modules/web_shop_shopify/web.py |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r b2dcfeb312e6 -r 3b49f78c45de modules/web_shop_shopify/web.py
--- a/modules/web_shop_shopify/web.py   Thu Apr 09 18:24:39 2026 +0200
+++ b/modules/web_shop_shopify/web.py   Wed Apr 15 16:26:20 2026 +0200
@@ -356,7 +356,10 @@
                 for template, t_products in groupby(
                         products, key=lambda p: p.template):
                     t_products = sorted(
-                        t_products, key=lambda p: p.position or 0)
+                        t_products,
+                        key=lambda p: (
+                            p.position if p.position is not None else -1,
+                            p.id))
                     p_inventory_items = [
                         inventory_items[p] for p in t_products]
                     p_sale_prices = [sale_prices[p.id] for p in t_products]

Reply via email to