From df7a9f9563929306b7ec3ceaf2efce6f7285ec2a Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Thu, 8 Sep 2022 12:21:58 +0000
Subject: [PATCH] slapos_accounting: debug debug debug log log log

---
 .../InstanceTree_requestUpdateOpenSaleOrder.py         | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/InstanceTree_requestUpdateOpenSaleOrder.py b/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/InstanceTree_requestUpdateOpenSaleOrder.py
index 0bcb6012a..ea38314b7 100644
--- a/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/InstanceTree_requestUpdateOpenSaleOrder.py
+++ b/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/InstanceTree_requestUpdateOpenSaleOrder.py
@@ -123,6 +123,7 @@ if instance_tree.getCausalityState() == 'diverged':
         assert open_order.getSpecialise() == specialise
 
       predicate_list = []
+      log_predicate_list = []
       inherited_trade_condition = open_sale_order.getSpecialiseValue()
 
       if specialise is None:
@@ -133,6 +134,9 @@ if instance_tree.getCausalityState() == 'diverged':
           x for x in inherited_trade_condition.contentValues(portal_type='Sale Supply Line')
           if x.getResource() == service.getRelativeUrl()
         ])
+        log_predicate_list.extend([
+          x for x in inherited_trade_condition.contentValues(portal_type='Sale Supply Line')
+        ])
         inherited_trade_condition = inherited_trade_condition.getSpecialiseValue(portal_type=inherited_trade_condition.getPortalType())
 
       price = service.getPrice(
@@ -141,11 +145,13 @@ if instance_tree.getCausalityState() == 'diverged':
         default=None,
       )
       if price is None:
-        raise NotImplementedError('Price not found on %s (%s) for %s %s' % (
+        raise NotImplementedError('Price not found on %s (%s) for %s %s - %s' % (
                                                                       open_sale_order.getSpecialiseTitle(),
                                                                       open_sale_order.getSpecialise(),
                                                                       service.getRelativeUrl(),
-                                                                      str([x.getRelativeUrl() for x in predicate_list])))
+                                                                      str([x.getRelativeUrl() for x in predicate_list]),
+                                                                      str([(x.getRelativeUrl(), x.getResource()) for x in log_predicate_list]),
+        ))
       open_order_line.edit(
         price=price
       )
-- 
2.30.9