[WIP] website_sale: test tour: try to find errors
[odoo/odoo.git] / addons / website_sale / views / website_sale.xml
index 422950b..7a29205 100644 (file)
@@ -4,8 +4,8 @@
 
 <!-- Layout add nav and footer -->
 
-<template id="editor_head" inherit_id="website.editor_head" name="Shop Editor" groups="base.group_website_designer">
-  <xpath expr="//script[last()]" position="after">
+<template id="editor_head" inherit_id="website.editor_head" name="Shop Editor" groups="base.group_sale_manager">
+  <xpath expr="//script[@id='website_tour_js']" position="after">
       <script type="text/javascript" src="/website_sale/static/src/js/website_sale.editor.js"></script>
       <script type="text/javascript" src="/website_sale/static/src/js/website.tour.shop.js"></script>
   </xpath>
@@ -26,7 +26,7 @@
 <!-- List of categories -->
 
 <template id="categories_recursive" name="Category list">
-  <li t-att-class="str(category.id) == search.get('category') and 'active' or ''">
+  <li t-att-class="category.id == search.get('category') and 'active' or ''">
       <a t-href="/shop/category/#{ slug(category) }/" t-field="category.name"></a>
       <ul t-if="category.child_id" class="nav nav-pills nav-stacked nav-hierarchy">
           <t t-foreach="category.child_id" t-as="category">
@@ -88,7 +88,7 @@
           <t t-raw="head or ''"/>
       </t>
       <t t-set="additional_title">Shop</t>
-      <div id="wrap">
+      <div id="wrap" class="js_sale">
         <div class="oe_structure"/>
         <div class="container oe_website_sale">
           <div class="products_pager">
               <t t-if="not bins">
                 <div class="text-center text-muted">
                   <h3 class="css_editable_display">No product found</h3>
-                  <h3 class="css_non_editable_mode_hidden">There isn't available products right know, click <a t-href="/page/website.contactus">here</a> to contact us</h3>
+                  <h3 class="css_non_editable_mode_hidden">There isn't available products right now, click <a t-href="/page/website.contactus">here</a> to contact us</h3>
                   <t groups="base.group_website_publisher">
-                    <p>Click on "Content" to define a new product or "Help" for more informations.</p>
-                    <img src="/website/static/src/img/content_here.png"/>
-                    <p>In the backend's product form contains information to simplify the sale process: price, notes in the quotation, accounting data, procurement methods, etc.</p>
+                    <t groups="base.group_sale_manager">
+                      <p>Click on "Content" to define a new product or "Help" for more informations.</p>
+                      <img src="/website/static/src/img/content_here.png"/>
+                      <p>In the backend's product form contains information to simplify the sale process: price, notes in the quotation, accounting data, procurement methods, etc.</p>
+                    </t>
                   </t>
                 </div>
               </t>
 
 <template id="add_to_basket" inherit_option_id="website_sale.products_cart" name="Add to Cart">
   <xpath expr="//div[@class='product_price']" position="inside">
-      <a t-href="/shop/add_cart/#{ product.product_variant_ids[0].id }/"><!-- class="js_add_cart_json" -->
-          <span class="fa fa-shopping-cart"/>
-      </a>
+      <form action="/shop/add_cart/" method="post" style="display: inline-block;">
+          <input name="product_id" t-att-value="product.product_variant_ids[0].id" type="hidden"/>
+          <button type="submit" class="fa fa-shopping-cart"/>
+      </form>
   </xpath>
 </template>
 
           <link rel='stylesheet' href='/website_sale/static/src/css/website_mail.css'/>
       </t>
       <t t-set="additional_title" t-value="product.name"/>
-      <div id="wrap">
+      <div id="wrap" class="js_sale">
 
         <section class="container mt8">
           <div class="row">
                   <t t-call="website_sale.search" />
               </form>
             </div>
-            <div class="col-sm-4">
+            <div class="col-sm-4" groups="base.group_sale_manager">
                 <t t-call="website.publish_management">
                   <t t-set="object" t-value="product"/>
                   <t t-set="publish_edit" t-value="True"/>
                           </tr>
                       </tbody>
                   </table>
-                  <table class='pull-right mb16' id="mycart_total" t-if="website_sale_order">
-                      <colgroup>
-                          <col width="100"/>
-                          <col width="120"/>
-                      </colgroup>
-                      <thead>
-                          <tr style="border-top: 1px solid #000" id="order_total">
-                              <th><h3>Total:</h3></th>
-                              <th class="text-right">
-                                <h3><t t-call="website_sale.total"/></h3>
-                              </th>
-                          </tr>
-                          <tr class="text-muted" id="order_total_taxes">
-                              <td><abbr title="Taxes may be updated after providing shipping address">Taxes:</abbr></td>
-                              <td class="text-right">
-                                  <span t-field="website_sale_order.amount_tax" t-field-options='{
-                                      "widget": "monetary",
-                                      "display_currency": "website.pricelist_id.currency_id"
-                                  }'/>
-                              </td>
-                          </tr>
-                      </thead>
-                  </table>
+                  <t t-call="website_sale.total"/>
                   <div class="clearfix"/>
                   <a href="/shop" class="btn btn-default mb32"><span class="fa fa-long-arrow-left"/> Continue Shopping</a>
                   <a t-if="website_sale_order and website_sale_order.website_order_line" href="/shop/checkout/" class="btn btn-primary pull-right mb32">Process Checkout <span class="fa fa-long-arrow-right"/></a>
                       }'/>
                   </td>
                   <td class="text-center">
-                      <a t-href="/shop/add_cart/#{ product.product_variant_ids[0].id }/"><strong>Add to Cart</strong></a>
+                      <form action="/shop/add_cart/" method="post">
+                          <input name="product_id" t-att-value="product.product_variant_ids[0].id" type="hidden"/>
+                          <button type="submit" class="btn btn-link"><strong>Add to Cart</strong></button>
+                      </form>
                   </td>
               </tr>
           </tbody>
           <div class="row">
           <div class="col-md-8 oe_mycart">
               <h3 class="page-header mt16">Billing Information
-                  <small t-if="user_id.id == website.public_user.id"> or
+                  <small groups="base.group_public"> or
                       <a t-if="not partner" t-attf-href="/web#action=redirect&amp;url=#{ request.httprequest.url }">sign in</a>
                   </small>
               </h3>
                       </tr>
                   </tbody>
               </table>
-              <table class='pull-right mb16' id="mycart_total">
-                  <colgroup>
-                      <col width="100"/>
-                      <col width="120"/>
-                  </colgroup>
-                  <thead>
-                      <tr style="border-top: 1px solid #000" id="order_total">
-                          <th><h3>Total:</h3></th>
-                          <th class="text-right">
-                            <h3><span t-field="website_sale_order.amount_total" t-field-options='{
-                              "widget": "monetary",
-                              "display_currency": "website.pricelist_id.currency_id"
-                            }'/></h3>
-                          </th>
-                      </tr>
-                      <tr class="text-muted" id="order_total_taxes">
-                          <td>Taxes:</td>
-                          <td class="text-right"><span t-field="website_sale_order.amount_tax" t-field-options='{
-                              "widget": "monetary",
-                              "display_currency": "website.pricelist_id.currency_id"
-                          }'/></td>
-                      </tr>
-                  </thead>
-              </table>
+              <t t-call="website_sale.total"/>
               <div class="clearfix"/>
               <div class="oe_structure"/>
             </div>
             </div>
           </div>
 
-          <div class="js_payment mb64 row" t-if="acquirers" id="payment_method">
-              <h4>Choose your Payment Method</h4>
+          <div class="js_payment mb64" t-if="acquirers" id="payment_method">
               <div class="col-lg-5 col-sm-6">
+                  <h4>Payment Method:</h4>
                   <t t-foreach="acquirers or []" t-as="acquirer">
                       <label t-if="acquirer.button" class="oe_sale_acquirer_logo" style="display: block;">
-                          <input t-att-value="acquirer.id" type="radio" name="acquirer"/>
+                          <input t-att-value="acquirer.id" type="radio" name="acquirer" t-att-checked="acquirers[0] == acquirer"/>
                           <img class="media-object" style="width: 60px; display: inline-block;"
                               t-att-title="acquirer.name"
                               t-att-src="'/payment_acquirer_%s/static/src/img/%s_icon.png' % (acquirer.name, acquirer.name)"/>
+                              <span t-field="acquirer.name"/>
                       </label>
                   </t>
               </div>
               <div class="col-lg-3 col-sm-3">
                   <t t-foreach="acquirers or []" t-as="acquirer">
-                      <div t-att-data-id="acquirer.id" t-raw="acquirer.button" class="oe_sale_acquirer_button hidden"/>
+                      <div t-att-data-id="acquirer.id" t-raw="acquirer.button" class="oe_sale_acquirer_button hidden pull-right"/>
                   </t>
               </div>
           </div>
   </t>
 </template>
 
+<!-- Page Shop my cart and payment total -->
+
 <template id="total">
-<span t-field="website_sale_order.amount_total" t-field-options='{
-    "widget": "monetary",
-    "display_currency": "website.pricelist_id.currency_id"
-  }'/>
+    <table class='pull-right mb16' id="mycart_total" t-if="website_sale_order">
+        <colgroup>
+            <col width="100"/>
+            <col width="120"/>
+        </colgroup>
+        <thead>
+            <tr style="border-top: 1px solid #000" id="order_total">
+                <th><h3>Total:</h3></th>
+                <th class="text-right">
+                  <h3><span t-field="website_sale_order.amount_total" t-field-options='{
+                      "widget": "monetary",
+                      "display_currency": "website.pricelist_id.currency_id"
+                    }'/></h3>
+                </th>
+            </tr>
+            <tr class="text-muted" id="order_total_taxes">
+                <td><abbr title="Taxes may be updated after providing shipping address">Taxes:</abbr></td>
+                <td class="text-right">
+                    <span t-field="website_sale_order.amount_tax" t-field-options='{
+                        "widget": "monetary",
+                        "display_currency": "website.pricelist_id.currency_id"
+                    }'/>
+                </td>
+            </tr>
+        </thead>
+    </table>
 </template>
+
 </data>
 </openerp>