[ADD] website_sale: pricelist

bzr revid: chm@openerp.com-20130716093624-lf15mryypg3aevl8
This commit is contained in:
Christophe Matthieu 2013-07-16 11:36:24 +02:00
parent e52bdd3838
commit fbae203ac7
6 changed files with 123 additions and 3 deletions

View File

@ -13,8 +13,9 @@ OpenERP E-Commerce
'views/ecommerce.xml',
'views/pricelist.xml'
],
'js': ['static/src/js/ecommerce.js'],
'css': ['static/src/css/ecommerce.css'],
'js': ['static/src/js/*.js'],
'css': ['static/src/css/*.css'],
'qweb': ['static/src/xml/*.xml'],
'installable': True,
'auto_install': True,
}

View File

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import osv, fields
class product_pricelist(osv.osv):
_inherit = "product.pricelist"
_columns = {
'code': fields.char('Promotionnal Code', size=64, required=True, translate=True),
}

View File

@ -22,4 +22,45 @@ $(document).ready(function (){
ev.preventDefault();
$('.oe_ecommerce form').toggle();
});
});
openerp.website = function(instance) {
instance.website.sale = {};
instance.website.sale.Checkout = instance.web.Widget.extend({
template: 'Website.sale.Checkout',
events: {
'click button[data-action=gotostep]': 'gotostep',
},
start: function() {
console.log("instance.website.sale.Checkout", this);
return this._super.apply(this, arguments);
},
goto: function (e) {
},
save: function () {
},
});
};
$(document).ready(function () {
if (!$('.oe_placeholder_checkout').size())
return;
// Init headless webclient
// TODO: Webclient research : use iframe embedding mode
// Meanwhile, let's HACK !!!
var s = new openerp.init(['web', 'website']);
s.web.WebClient.bind_hashchange = s.web.WebClient.show_common = s.web.blockUI = s.web.unblockUI = function() {};
s.web.WebClient.include({ do_push_state: function() {} });
var wc = new s.web.WebClient();
wc.start();
var instance = openerp.instances[wc.session.name];
// Another hack since we have no callback when webclient has loaded modules.
instance.web.qweb.add_template('/website_sale/static/src/xml/ecommerce.xml');
var editor = new instance.website.sale.Checkout(instance.webclient);
editor.prependTo($('.oe_placeholder_checkout'));
});

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="Website.sale.Checkout">
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Collapsible Group Item #2
</a>
</div>
<div id="collapseTwo" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>
</div>
</t>
</templates>

View File

@ -212,7 +212,7 @@
<h5>Please Sign in or enter your informations</h5>
<input name="login" type="text" placeholder="Login..."/><br/>
<input name="password" type="password" placeholder="Password..."/><br/>
<button type="submit" class="btn btn-success">Next stage</button> or <button type="reset" class="btn btn-primary oe_toggleform">Complete your address</button>
<button type="submit" class="btn btn-success">Login</button> or <button type="reset" class="btn btn-primary oe_toggleform">Complete your address</button>
</form>
<form action="/shop/confirm_cart" class="oe_signup" method="post" t-att-style="partner and 'display:block' or ''">
<h5 t-if="partner">Please confirm your informations</h5>
@ -234,6 +234,7 @@
<button type="submit" class="btn btn-success">Next stage</button><t t-if="not partner"> or <button type="reset" class="btn btn-primary oe_toggleform">Sign in</button></t>
</form>
<t t-call="website_sale.total"/>
<div class="oe_placeholder_checkout">-</div>
</t>
</t>
</field>

View File

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="product_pricelist_view">
<field name="name">product.pricelist.website.form</field>
<field name="model">product.pricelist</field>
<field name="inherit_id" ref="product.product_pricelist_view"/>
<field name="arch" type="xml">
<field name="active" position="after">
<field name="code"/>
</field>
</field>
</record>
</data>
</openerp>