[FIX] website_sale: customer write on public user and the sale order is apply to public user if the public user is active=True; the checkout layout display state_id field twice

This commit is contained in:
Christophe Matthieu 2014-09-04 13:08:42 +02:00
parent 6e6dd7962c
commit c9a134b541
2 changed files with 4 additions and 12 deletions

View File

@ -359,14 +359,15 @@ class website_sale(http.Controller):
shipping_ids = []
checkout = {}
if not data:
print request.uid, request.website.user_id.id
if request.uid != request.website.user_id.id:
checkout.update( self.checkout_parse("billing", partner) )
shipping_ids = orm_partner.search(cr, SUPERUSER_ID, [("parent_id", "=", partner.id), ('type', "=", 'delivery')], context=context)
else:
order = request.website.sale_get_order(force_create=1, context=context)
if order.partner_id:
domain = [("active", "=", False), ("partner_id", "=", order.partner_id.id)]
user_ids = request.registry['res.users'].search(cr, SUPERUSER_ID, domain, context=context)
domain = [("partner_id", "=", order.partner_id.id)]
user_ids = request.registry['res.users'].search(cr, SUPERUSER_ID, domain, context=dict(context or {}, active_test=False))
if not user_ids or request.website.user_id.id not in user_ids:
checkout.update( self.checkout_parse("billing", order.partner_id) )
else:

View File

@ -958,15 +958,6 @@
<label class="control-label" for="shipping_zip">Zip / Postal Code</label>
<input type="text" name="shipping_zip" class="form-control" t-att-value="checkout.get('shipping_zip', '')" t-att-readonly=" 'readonly' if shipping_id &gt;= 0 else ''"/>
</div>
<div t-attf-class="form-group #{error.get('shipping_state_id') and 'has-error' or ''} col-lg-6">
<label class="control-label" for="shipping_state_id" style="font-weight: normal">State / Province</label>
<select name="shipping_state_id" class="form-control" t-att-readonly=" 'readonly' if shipping_id &gt;= 0 else ''">
<option value="">State / Province...</option>
<t t-foreach="states or []" t-as="state">
<option t-att-value="state.id" t-att-selected="state.id == checkout.get('shipping_state_id')"><t t-esc="state.name"/></option>
</t>
</select>
</div>
<div t-attf-class="form-group #{error.get('shipping_country_id') and 'has-error' or ''} col-lg-6">
<label class="control-label" for="shipping_country_id">Country</label>
<select name="shipping_country_id" class="form-control" t-att-readonly=" 'readonly' if shipping_id &gt;= 0 else ''">
@ -978,7 +969,7 @@
</div>
<div t-attf-class="form-group #{error.get('shipping_state_id') and 'has-error' or ''} col-lg-6">
<label class="control-label" for="shipping_state_id" style="font-weight: normal">State / Province</label>
<select name="shipping_state_id" class="form-control">
<select name="shipping_state_id" class="form-control" t-att-readonly=" 'readonly' if shipping_id &gt;= 0 else ''">
<option value="">State / Province...</option>
<t t-foreach="states or []" t-as="state">
<option t-att-value="state.id" style="display:none;" t-att-data-country_id="state.country_id.id" t-att-selected="state.id == checkout.get('shipping_state_id')"><t t-esc="state.name"/></option>