[FIX] website_sale: save the company in street and the street in street2.

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
This commit is contained in:
Jeremy Kersten 2014-10-07 19:00:45 +02:00
parent 717895be1a
commit 8ff6299d9d
4 changed files with 12 additions and 12 deletions

View 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");

View 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'])

View 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");

View File

@ -854,9 +854,9 @@
<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>
@ -871,9 +871,9 @@
<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"/>