From edf7288fcd1f3e7a8286d6866c596eeb8023cdcf Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Thu, 16 Dec 2010 10:37:25 +0000
Subject: [PATCH] Provide compatibility by automatically setting the shopping
 card customer.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41490 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_commerce/SaleOrder_getShoppingCartCustomer.xml  | 9 ++++++++-
 bt5/erp5_commerce/bt/revision                            | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/SaleOrder_getShoppingCartCustomer.xml b/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/SaleOrder_getShoppingCartCustomer.xml
index 7a82f767be..83409d3263 100644
--- a/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/SaleOrder_getShoppingCartCustomer.xml
+++ b/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/SaleOrder_getShoppingCartCustomer.xml
@@ -52,7 +52,12 @@
             <key> <string>_body</string> </key>
             <value> <string>"""Get the shopping cart customer"""\n
 shopping_cart = context.SaleOrder_getShoppingCart()\n
-return shopping_cart.getDestinationSectionValue()\n
+result = shopping_cart.getDestinationSectionValue()\n
+if result is None:\n
+  shopping_cart.SaleOrder_setShoppingCartCustomer()\n
+  result = shopping_cart.getDestinationSectionValue()\n
+\n
+return result\n
 </string> </value>
         </item>
         <item>
@@ -98,6 +103,8 @@ return shopping_cart.getDestinationSectionValue()\n
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>shopping_cart</string>
+                            <string>result</string>
+                            <string>None</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_commerce/bt/revision b/bt5/erp5_commerce/bt/revision
index e21ad0e4fb..61f9147fdc 100644
--- a/bt5/erp5_commerce/bt/revision
+++ b/bt5/erp5_commerce/bt/revision
@@ -1 +1 @@
-273
\ No newline at end of file
+275
\ No newline at end of file
-- 
2.30.9