[MERGE] forward port of branch 8.0 up to ed1c173
[odoo/odoo.git] / addons / website_sale / views / templates.xml
index a0e3068..3f1f902 100644 (file)
 </template>
 
 <template id="search" name="Search hidden fields">
-  <t t-if="attrib_values">
-    <t t-foreach="attrib_values" t-as="a">
-      <input type="hidden" name="attrib" t-att-value="'%s-%s' % (a[0], a[1])"/>
+  <form t-att-action="keep('/shop'+ ('/category/'+slug(category)) if category else '', search=0)" method="get" t-att-class="search_class">
+
+    <t t-if="attrib_values">
+      <t t-foreach="attrib_values" t-as="a">
+        <input type="hidden" name="attrib" t-att-value="'%s-%s' % (a[0], a[1])"/>
+      </t>
     </t>
-  </t>
-  <input t-if="category" type="hidden" name="category" t-att-value="int(category or 0)"/>
-  <div class="input-group">
-    <input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search"/>
-    <span class="input-group-btn">
-      <a class="btn btn-default a-submit"><i class="fa fa-search"/></a>
-    </span>
+    <div class="input-group">
+      <input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search"/>
+      <span class="input-group-btn">
+        <a class="btn btn-default a-submit"><i class="fa fa-search"/></a>
+      </span>
   </div>
+
+  </form>
 </template>
 
 <template id="404">
@@ -73,7 +76,7 @@
   </div>
   <div class="oe_product_image">
       <a itemprop="url" t-att-href="keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']>1 else None))">
-          <img itemprop="image" class="img img-responsive" t-attf-src="/website/image/product.template/#{product.id}/image#{'' if product_image_big else '?max_width=300&amp;max_height=300'}"/>
+          <img itemprop="image" class="img img-responsive" t-attf-src="/website/image/product.template/#{product.id}/image{{'' if product_image_big else '/300x300' }}"/>
       </a>
   </div>
   <section>
   </form>
 </template>
 
-<template id="products_description" inherit_id="website_sale.products_item" optional="disabled" name="Product Description">
+<template id="products_description" inherit_id="website_sale.products_item" active="False" customize_show="True" name="Product Description">
   <xpath expr="//div[@class='product_price']" position="before">
       <div class="text-info oe_subdescription" contenteditable="false">
         <div itemprop="description" t-field="product.description_sale"></div>
   </xpath>
 </template>
 
-<template id="products_add_to_cart" inherit_id="website_sale.products_item" optional="disabled" name="Add to Cart">
+<template id="products_add_to_cart" inherit_id="website_sale.products_item" active="False" customize_show="True" name="Add to Cart">
   <xpath expr="//div[@class='product_price']" position="inside">
     <input name="product_id" t-att-value="product.product_variant_ids[0].id" type="hidden"/>
     <a class="btn btn-default btn-xs fa fa-shopping-cart a-submit"/>
         <div class="container oe_website_sale">
           <div class="products_pager">
             <div class="row">
-              <form t-att-action="keep('/shop',search='')" method="get" class="pagination form-inline col-md-3">
-                <t t-call="website_sale.search"/>
-              </form>
+              <t t-call="website_sale.search"><t t-set="search_class">pagination form-inline col-md-3</t></t>
               <t t-call="website.pager"/>
             </div>
           </div>
   </li>
 </template>
 
-<template id="products_categories" inherit_id="website_sale.products" optional="disabled" name="Product Categories">
+<template id="products_categories" inherit_id="website_sale.products" active="False" customize_show="True" name="Product Categories">
   <xpath expr="//div[@id='products_grid_before']" position="inside">
       <ul class="nav nav-pills nav-stacked mt16">
           <li t-att-class=" '' if category else 'active' "><a t-att-href="keep('/shop',category=0)">All Products</a></li>
   </xpath>
 </template>
 
-<template id="products_attributes" inherit_id="website_sale.products" optional="disabled" name="Product Attribute's Filters">
+<template id="products_attributes" inherit_id="website_sale.products" active="False" customize_show="True" name="Product Attribute's Filters">
   <xpath expr="//div[@id='products_grid_before']" position="inside">
       <form class="js_attributes" method="get">
           <input type="hidden" name="search" t-att-value="search"/>
   </xpath>
 </template>
 
-<template id="products_list_view" inherit_id="website_sale.products" optional="disabled" name="List View">
+<template id="products_list_view" inherit_id="website_sale.products" active="False" customize_show="True" name="List View">
   <xpath expr="//div[@id='products_grid']//table" position="replace">
     <t t-foreach="products" t-as="product">
       <div class="oe_product oe_list oe_product_cart" t-att-data-publish="product.website_published and 'on' or 'off'">
                 </ol>
             </div>
             <div class="col-sm-3">
-              <form t-att-action="keep(search=0)" method="get" class="pull-right">
-                  <t t-call="website_sale.search"/>
-              </form>
+              <t t-call="website_sale.search"><t t-set="search_class">pull-right</t></t>
             </div>
             <div class="col-sm-4" groups="base.group_sale_manager">
                 <t t-call="website.publish_management">
   </t>
 </template>
 
-<template id="product_quantity" inherit_id="website_sale.product" optional="enabled" name="Select Quantity">
+<template id="product_quantity" inherit_id="website_sale.product" customize_show="True" name="Select Quantity">
   <xpath expr="//a[@id='add_to_cart']" position="before">
     <div class="css_quantity input-group" style="width: 108px;">
         <span class="input-group-addon">
   </div>
 </template>
 
-<template id="product_variants" inherit_id="website_sale.product" optional="disabled" name="List View of Variants">
+<template id="product_variants" inherit_id="website_sale.product" active="False" customize_show="True" name="List View of Variants">
   <xpath expr="//t[@t-placeholder='select']" position="replace">
     <input type="hidden" t-if="len(product.product_variant_ids) == 1" name="product_id" t-att-value="product.product_variant_ids[0].id"/>
     <t t-if="len(product.product_variant_ids) &gt; 1">
   </ul>
 </template>
 
-<template id="recommended_products" inherit_id="website_sale.product" optional="enabled" name="Alternative Products">
+<template id="recommended_products" inherit_id="website_sale.product" customize_show="True" name="Alternative Products">
   <xpath expr="//div[@id='product_full_description']" position="after">
       <div class="container mt32" t-if="product.alternative_product_ids">
           <h3>Suggested alternatives:</h3>
   </xpath>
 </template>
 
-<template id="product_attributes" inherit_id="website_sale.product" optional="enabled" name="Product attributes">
+<template id="product_attributes" inherit_id="website_sale.product" customize_show="True" name="Product attributes">
   <xpath expr="//p[@t-field='product.description_sale']" position="after">
     <hr t-if="sum([(1 if len(l.value_ids)==1 else 0) for l in product.attribute_line_ids])"/>
     <p class="text-muted">
 
 <!-- Product options: OpenChatter -->
 
-<template id="product_comment" inherit_id="website_sale.product" optional="disabled" name="Discussion">
+<template id="product_comment" inherit_id="website_sale.product" active="False" customize_show="True" name="Discussion">
     <xpath expr="//div[@t-field='product.website_description']" position="after">
         <hr class="mb32"/>
         <section class="container">
                 <ul class="media-list" id="comments-list"  t-if="product.website_message_ids">
                     <li t-foreach="product.website_message_ids" t-as="message" class="media">
                         <div class="media-body oe_msg">
-                            <img class="media-object pull-left oe_msg_avatar" t-att-src="'/website/image?model=res.partner&amp;field=image_small&amp;id='+str(message.author_id.id)" style="width: 50px; margin-right: 10px;"/>
+                            <img class="media-object pull-left oe_msg_avatar" t-attf-src="/website/image/res.partner/{{ message.author_id.id }}/image_small" style="width: 50px; margin-right: 10px;"/>
                             <div class="media-body oe_msg_content">
                                 <t t-call="website.publish_short">
                                     <t t-set="object" t-value="message"/>
                 </ul>
                 <div class="css_editable_mode_hidden">
                     <form id="comment" t-attf-action="/shop/product/comment/#{product.id}" method="POST">
-                        <img class="img pull-left img-rounded" t-att-src="'/website/image?model=res.partner&amp;field=image_small&amp;id='+str(user_id.partner_id.id)" style="width: 50px; margin-right: 10px;"/>
+                        <img class="img pull-left img-rounded" t-attf-src="/website/image/res.partner/{{ user_id.partner_id.id }}/image_small" style="width: 50px; margin-right: 10px;"/>
                         <div class="pull-left mb32" style="width: 75%%">
                             <textarea rows="3" name="comment" class="form-control" placeholder="Write a comment..."></textarea>
                             <a class="btn btn-primary mt8 a-submit">Post</a>
   </t>
 </template>
 
-<template id="suggested_products_list" inherit_id="website_sale.cart" optional="enabled" name="Suggested Products in my cart">
+<template id="suggested_products_list" inherit_id="website_sale.cart" customize_show="True" name="Suggested Products in my cart">
   <xpath expr="//table[@id='cart_products']" position="after">
       <table t-if="suggested_products" class='table table-striped table-condensed'>
           <colgroup>
   </xpath>
 </template>
 
-<template id="continue_shopping" inherit_id="website_sale.cart" optional="enabled" name="Continue Shopping Button">
+<template id="continue_shopping" inherit_id="website_sale.cart" customize_show="True" name="Continue Shopping Button">
   <xpath expr="//a[@href='/shop/checkout']" position="before">
     <a href="/shop" class="btn btn-default mb32"><span class="fa fa-long-arrow-left"/> Continue Shopping</a>
   </xpath>
 </template>
 
-<template id="reduction_code" inherit_id="website_sale.cart" optional="disabled" name="Reduction Code">
+<template id="reduction_code" inherit_id="website_sale.cart" active="False" customize_show="True" name="Reduction Code">
   <xpath expr="//div[@id='right_column']" position="inside">
       <h4>Coupon Code</h4>
       <p>
 
                   <div class="clearfix"/>
 
-                  <div class="form-group col-lg-6">
-                      <label>
-                          <input type="checkbox" name="shipping_different" t-att-checked="checkout.get('shipping_different')"/>
-                          <span>Ship to a different address</span>
-                      </label>
+                  <div class="form-group col-lg-12">
+                      <label>Shipping</label>
+                      <select name="shipping_id" class="form-control">
+                          <option value="0">Ship to the same address</option>
+                          <t t-foreach="shippings" t-as="shipping">
+                              <option t-att-value="shipping.id" t-att-selected="shipping.id == shipping_id"
+                                t-att-data-shipping_name="shipping.name"
+                                t-att-data-shipping_phone="shipping.phone"
+                                t-att-data-shipping_street="shipping.street"
+                                t-att-data-shipping_city="shipping.city"
+                                t-att-data-shipping_zip="shipping.zip"
+                                t-att-data-shipping_state_id="shipping.state_id and shipping.state_id.id"
+                                t-att-data-shipping_country_id="shipping.country_id and shipping.country_id.id"
+                                ><t t-esc="', '.join('\n'.join(shipping.name_get()[0][1].split(',')).split('\n')[1:])"/></option>
+                          </t>
+                          <option value="-1">-- Create a new address --</option>
+                      </select>
                   </div>
               </div>
-              <div class="js_shipping row mb16" t-att-style="not checkout.get('shipping_different') and 'display:none' or ''">
+              <div class="js_shipping row mb16" t-att-style="not shipping_id and 'display:none' or ''">
                   <h3 class="oe_shipping col-lg-12 mt16">Shipping Information</h3>
 
                   <div t-attf-class="form-group #{error.get('shipping_name') and 'has-error' or ''} col-lg-6">
                       <label class="control-label" for="shipping_name">Name (Shipping)</label>
-                      <input type="text" name="shipping_name" class="form-control" t-att-value="checkout.get('shipping_name', '')"/>
+                      <input type="text" name="shipping_name" class="form-control" t-att-value="checkout.get('shipping_name', '')" t-att-readonly="'readonly' if shipping_id &gt;= 0 else ''"/>
                   </div>
                   <div t-attf-class="form-group #{error.get('shipping_phone') and 'has-error' or ''} col-lg-6">
                       <label class="control-label" for="shipping_phone">Phone</label>
-                      <input type="tel" name="shipping_phone" class="form-control" t-att-value="checkout.get('shipping_phone', '')"/>
+                      <input type="tel" name="shipping_phone" class="form-control" t-att-value="checkout.get('shipping_phone', '')" t-att-readonly="  'readonly' if shipping_id &gt;= 0 else ''"/>
                   </div>
                   <div t-attf-class="form-group #{error.get('shipping_street') and 'has-error' or ''} col-lg-6">
                       <label class="control-label" for="shipping_street">Street</label>
-                      <input type="text" name="shipping_street" class="form-control" t-att-value="checkout.get('shipping_street', '')"/>
+                      <input type="text" name="shipping_street" class="form-control" t-att-value="checkout.get('shipping_street', '')" t-att-readonly=" 'readonly' if shipping_id &gt;= 0 else ''"/>
                   </div>
                   <div class="clearfix"/>
                   <div t-attf-class="form-group #{error.get('shipping_city') and 'has-error' or ''} col-lg-6">
                       <label class="control-label" for="shipping_city">City</label>
-                      <input type="text" name="shipping_city" class="form-control" t-att-value="checkout.get('shipping_city', '')"/>
+                      <input type="text" name="shipping_city" class="form-control" t-att-value="checkout.get('shipping_city', '')" t-att-readonly=" 'readonly' if shipping_id &gt;= 0 else ''"/>
                   </div>
                   <div t-attf-class="form-group #{error.get('shipping_zip') and 'has-error' or ''} col-lg-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', '')"/>
+                      <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_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">
+                      <select name="shipping_country_id" class="form-control" t-att-readonly="  'readonly' if shipping_id &gt;= 0 else ''">
                           <option value="">Country...</option>
                           <t t-foreach="countries or []" t-as="country">
                               <option t-att-value="country.id" t-att-selected="country.id == checkout.get('shipping_country_id')"><t t-esc="country.name"/></option>
                   </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>
                       </select>
                   </div>
               </div>
-              <a href="/shop/cart" class="btn btn-default mb32"><span class="fa fa-long-arrow-left"/> Return to Cart</a>
-              <a class="btn btn-default btn-primary pull-right mb32 a-submit">Confirm <span class="fa fa-long-arrow-right"/></a>
+              <div class="clearfix">
+                <a href="/shop/cart" class="btn btn-default mb32"><span class="fa fa-long-arrow-left"/> Return to Cart</a>
+                <a class="btn btn-default btn-primary pull-right mb32 a-submit">Confirm <span class="fa fa-long-arrow-right"/></a>
+              </div>
           </div>
           <div class="col-lg-offset-1 col-lg-3 col-md-3 text-muted">
               <h3 class="page-header mt16">Your Order <small><a href="/shop/cart"><span class="fa fa-arrow-right"/> change</a></small></h3>
     </table>
 </template>
 
+<template id="website.layout_footer_copyright" inherit_id="website.layout" name="Footer Copyright">
+    <xpath expr="//footer" position="inside">
+        <div class="container mt16 mb8">
+            <div class="pull-right" t-ignore="true" t-if="not editable">
+                Powered by <a class="label label-danger" href="http://www.odoo.com/page/website-builder">Odoo</a>,
+                the #1 <a href="http://www.odoo.com/page/e-commerce">Open Source eCommerce</a>.
+            </div>
+            <div class="pull-left text-muted">
+                Copyright &amp;copy; <span t-field="res_company.name">Company name</span>
+            </div>
+        </div>
+    </xpath>
+</template>
+
+
 <!-- User Navbar -->
 <template id="content_new_product" inherit_id="website.user_navbar" groups="base.group_sale_manager">
     <xpath expr="//ul[@id='oe_systray']/li/ul[@class='dropdown-menu oe_content_menu']" position="inside">