From 5f25cb9244b4a1e5974359fb11da5fe4f3b25073 Mon Sep 17 00:00:00 2001
From: Christophe Matthieu <chm@odoo.com>
Date: Fri, 11 Jul 2014 15:29:22 +0200
Subject: [PATCH] [FIX] website_sale: install website_event_sale click on event
 to make a registration, error because fiscal_position is undefined

---
 addons/website_sale/models/sale_order.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py
index a0ec9bfd3a9f..60785910834f 100644
--- a/addons/website_sale/models/sale_order.py
+++ b/addons/website_sale/models/sale_order.py
@@ -176,9 +176,10 @@ class website(orm.Model):
                 fiscal_position = sale_order.fiscal_position and sale_order.fiscal_position.id or False
 
                 values = sale_order_obj.onchange_partner_id(cr, SUPERUSER_ID, [sale_order_id], partner.id, context=context)['value']
-                order_lines = map(int,sale_order.order_line)
-                values.update(sale_order_obj.onchange_fiscal_position(cr, SUPERUSER_ID, [],
-                    values['fiscal_position'], [[6, 0, order_lines]], context=context)['value'])
+                if values.get('fiscal_position'):
+                    order_lines = map(int,sale_order.order_line)
+                    values.update(sale_order_obj.onchange_fiscal_position(cr, SUPERUSER_ID, [],
+                        values['fiscal_position'], [[6, 0, order_lines]], context=context)['value'])
 
                 values['partner_id'] = partner.id
                 sale_order_obj.write(cr, SUPERUSER_ID, [sale_order_id], values, context=context)
-- 
GitLab