[FIX] website_sale: save the company in street and the street in street2.
authorJeremy Kersten <jke@odoo.com>
Tue, 7 Oct 2014 17:00:45 +0000 (19:00 +0200)
committerJeremy Kersten <jke@odoo.com>
Tue, 7 Oct 2014 17:00:45 +0000 (19:00 +0200)
The old behaviour was not better, because when we print the invoice, the order was ugly:
    Name
    Street
    Company name
    Country

Now we will have:
    Name
    Company name
    Street
    Country

This patch is not retro-compatible:
   Old partners will see the address in company name and vice-versa.
   Need to update view and switch street field and street2 field

addons/website_event_sale/static/src/js/website.tour.event_sale.js
addons/website_sale/controllers/main.py
addons/website_sale/static/src/js/website_sale_tour_buy.js
addons/website_sale/views/templates.xml

index cfb5a42..a81abd3 100644 (file)
@@ -51,7 +51,7 @@
                     if ($("input[name='email']").val() === "")
                         $("input[name='email']").val("website_event_sale_test_shoptest@websiteeventsaletest.odoo.com");
                     $("input[name='phone']").val("123");
-                    $("input[name='street']").val("123");
+                    $("input[name='street2']").val("123");
                     $("input[name='city']").val("123");
                     $("input[name='zip']").val("123");
                     $("select[name='country_id']").val("21");
index b43ac55..a5ef981 100644 (file)
@@ -425,8 +425,8 @@ class website_sale(http.Controller):
 
         return values
 
-    mandatory_billing_fields = ["name", "phone", "email", "street", "city", "country_id", "zip"]
-    optional_billing_fields = ["street2", "state_id", "vat"]
+    mandatory_billing_fields = ["name", "phone", "email", "street2", "city", "country_id", "zip"]
+    optional_billing_fields = ["street", "state_id", "vat"]
     mandatory_shipping_fields = ["name", "phone", "street", "city", "country_id", "zip"]
     optional_shipping_fields = ["state_id"]
 
@@ -448,9 +448,9 @@ class website_sale(http.Controller):
                 for field_name in all_fields if data.get(prefix + field_name))
         else:
             query = dict((prefix + field_name, getattr(data, field_name))
-                for field_name in all_fields if field_name != "street2" and getattr(data, field_name))
+                for field_name in all_fields if getattr(data, field_name))
             if data.parent_id:
-                query[prefix + 'street2'] = data.parent_id.name
+                query[prefix + 'street'] = data.parent_id.name
 
         if query.get(prefix + 'state_id'):
             query[prefix + 'state_id'] = int(query[prefix + 'state_id'])
index 8c2f387..742bf97 100644 (file)
@@ -71,7 +71,7 @@
                     if ($("input[name='email']").val() === "")
                         $("input[name='email']").val("website_sale_test_shoptest@websitesaletest.odoo.com");
                     $("input[name='phone']").val("123");
-                    $("input[name='street']").val("123");
+                    $("input[name='street2']").val("123");
                     $("input[name='city']").val("123");
                     $("input[name='zip']").val("123");
                     $("select[name='country_id']").val("21");
index 60bef80..243ec3f 100644 (file)
                       <input type="text" name="name" class="form-control" t-att-value="checkout.get('name')"/>
                   </div>
                   <div t-if="has_check_vat" class="clearfix"/>
-                  <div t-attf-class="form-group #{error.get('street2') and 'has-error' or ''} col-lg-6">
-                      <label class="control-label" for="street2" style="font-weight: normal">Company Name</label>
-                      <input type="text" name="street2" class="form-control" t-att-value="checkout.get('street2')"/>
+                  <div t-attf-class="form-group #{error.get('street') and 'has-error' or ''} col-lg-6">
+                      <label class="control-label" for="street" style="font-weight: normal">Company Name</label>
+                      <input type="text" name="street" class="form-control" t-att-value="checkout.get('street')"/>
                   </div>
                   <div t-if="has_check_vat" t-attf-class="form-group #{error.get('vat') and 'has-error' or ''} col-lg-6">
                       <label class="control-label" for="vat" style="font-weight: normal">VAT Number</label>
                       <input type="tel" name="phone" class="form-control" t-att-value="checkout.get('phone')"/>
                   </div>
 
-                  <div t-attf-class="form-group #{error.get('street') and 'has-error' or ''} col-lg-6">
-                      <label class="control-label" for="street">Street</label>
-                      <input type="text" name="street" class="form-control" t-att-value="checkout.get('street')"/>
+                  <div t-attf-class="form-group #{error.get('street2') and 'has-error' or ''} col-lg-6">
+                      <label class="control-label" for="street2">Street</label>
+                      <input type="text" name="street2" class="form-control" t-att-value="checkout.get('street2')"/>
                   </div>
                   <div class="clearfix"/>