[IMP] begin widget checkout

bzr revid: chm@openerp.com-20130722102857-3t0uos21ojv5tvut
This commit is contained in:
Christophe Matthieu 2013-07-22 12:28:57 +02:00
parent 02e8b1ab3e
commit 45d94be656
6 changed files with 73 additions and 22 deletions

View File

@ -4,7 +4,7 @@
<openerp>
<data>
<record id="header" model="ir.ui.view">
<field name="name">customer</field>
<field name="name">header</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<div class="container">
@ -22,7 +22,7 @@
</record>
<record id="footer" model="ir.ui.view">
<field name="name">customer</field>
<field name="name">footer</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<div class="container">

View File

@ -160,3 +160,14 @@
.oe_ecommerce .oe_checkout label > div > input {
margin-bottom: 0;
}
.oe_ecommerce .oe_checkout .oe_payment {
position: relative;
}
.oe_ecommerce .oe_checkout .oe_payment .oe_error_payment {
width: 100%;
height: 100%;
position: absolute;
top: +O;
left: 0;
cursor: pointer;
}

View File

@ -1,11 +1,12 @@
@import "compass/css3"
.oe_ecommerce
.oe_total
margin-top: 10px
td
padding: 5px 10px
table
width: auto
.oe_products
.oe_product
.oe_hidden
@ -121,3 +122,12 @@
margin-top: 3px
> div > input
margin-bottom: 0
.oe_payment
position: relative
.oe_error_payment
width: 100%
height: 100%
position: absolute
top: +O
left: +0
cursor: pointer

View File

@ -27,7 +27,7 @@ openerp.website = function(instance) {
instance.website.sale.Checkout = instance.web.Widget.extend({
template: 'Website.sale.Checkout',
events: {
'click button[data-action=gotostep]': 'gotostep',
'click .oe_error_payment': 'error_payment',
},
start: function() {
var self = this;
@ -36,17 +36,21 @@ openerp.website = function(instance) {
self.$('.oe_shipping').toggle();
});
},
goto: function (e) {
get_payment_image: function () {
// model: portal.payment.acquirer => form_template
// see Setting => Accounting => Bank & Cash => Configure payment acquiring methods
},
save: function () {
},
error_payment: function () {
alert("error_payment");
},
});
};
$(document).ready(function () {
if (!$('.oe_placeholder_checkout').size())
if (!$('.oe_checkout').size())
return;
// Init headless webclient
// TODO: Webclient research : use iframe embedding mode
@ -61,5 +65,5 @@ $(document).ready(function () {
instance.web.qweb.add_template('/website_sale/static/src/xml/ecommerce.xml');
var editor = new instance.website.sale.Checkout(instance.webclient);
editor.replace($('.oe_placeholder_checkout'));
editor.appendTo($('.oe_checkout'));
});

View File

@ -3,8 +3,8 @@
<t t-name="Website.sale.Checkout">
<div class="oe_checkout">
<h3 class="span8">Billing Information</h3>
<div class="span8">
<div>
<h3 class="span8">Billing Information</h3>
<button class="btn btn-success">Log me, I have an account</button>
<label class="span8">Name and firstname<input class="span7" type="text" name="name" placeholder="Name and firstname"/></label>
<label class="span4">Telephone<input type="text" name="tel" placeholder="Telephone"/></label>
@ -18,8 +18,8 @@
<label class="span4">Country<input type="text" name="state" placeholder="Country"/></label>
<label class="checkbox">Ship to different address<input type="checkbox" name="shipping_different"/></label>
</div>
<h3 class="span8 oe_shipping" style="display:none">Shipping Information</h3>
<div class="span8 oe_shipping" style="display:none">
<div class="oe_shipping" style="display:none">
<h3 class="span8 oe_shipping" style="display:none">Shipping Information</h3>
<label class="span8">Name and firstname<input class="span7" type="text" name="name" placeholder="Name and firstname"/></label>
<label class="span4">Telephone<input type="text" name="tel" placeholder="Telephone"/></label>
<label class="span4">Fax<input type="text" name="fax" placeholder="Fax"/></label>
@ -30,10 +30,20 @@
<label class="span4">Zip/Postal Code<input type="text" name="zip" placeholder="Zip/Postal Code"/></label>
<label class="span4">Country<input type="text" name="state" placeholder="Country"/></label>
</div>
<h3 class="span8">Choose your payment</h3>
<div class="span8">
<div class="oe_payment">
<div class="oe_error_payment"></div>
% if object.company_id.paypal_account:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick"/>
<input type="hidden" name="business" value="${object.company_id.paypal_account}"/>
<input type="hidden" name="item_name" value="${object.company_id.name} ${kind.title()} ${reference}"/>
<input type="hidden" name="amount" value="${amount}"/>
<input type="hidden" name="currency_code" value="${currency.name}"/>
<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
</form>
% endif
</div>
</div>
</t>
</templates>
</templates>

View File

@ -229,13 +229,29 @@
<field name="name">checkout</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<t t-name="website_sale.customer">
<t t-call="website_sale.page">
<t t-set="title">Checkout</t>
<t t-set="shop_content">
<div class="oe_placeholder_checkout">oe_placeholder_checkout</div>
</t>
</t>
<t t-call="website.layout">
<t t-set="title">Shop - Checkout</t>
<div class="container oe_ecommerce">
<div class="row">
<div class="span4 oe_total">
<table class="table table-condensed" t-if="order.order_line">
<thead>
<tr><th>Product</th><th>Qty.</th><th>Price</th></tr>
</thead>
<tbody>
<t t-foreach="order.order_line or []" t-as="line">
<tr><td><t t-esc="line.product_id.name"/></td><td><t t-esc="int(line.product_uom_qty)"/></td><td></td></tr>
</t>
<tr><td colspan="3" style="visibility: hidden; border: 0">-</td></tr>
<tr><th>Untaxed Amount</th><td></td><td><t t-esc="order.amount_untaxed"/></td></tr>
<tr><th>Taxes</th><td></td><td><t t-esc="order.amount_tax"/></td></tr>
<tr><th>Total</th><td></td><td><t t-esc="order.amount_total"/></td></tr>
</tbody>
</table>
</div>
<div class="span8 oe_checkout"></div>
</div>
</div>
</t>
</field>
</record>