[ADD] POS integration in web client
bzr revid: xmo@openerp.com-20111018151341-38xqjk3dfbviuws6
This commit is contained in:
commit
437c6346fc
|
@ -22,7 +22,7 @@
|
|||
|
||||
{
|
||||
'name': 'Point Of Sale',
|
||||
'version': '1.0',
|
||||
'version': '1.0.1',
|
||||
'category': 'Point Of Sale',
|
||||
'description': """
|
||||
This module provides a quick and easy sale process.
|
||||
|
@ -80,5 +80,8 @@ Main features :
|
|||
],
|
||||
'installable': True,
|
||||
'certificate' : '001156338024966477869',
|
||||
# Web client
|
||||
'js': ['static/lib/backbone/backbone-0.5.3.js', 'static/src/js/pos.js'],
|
||||
'css': ['static/src/css/pos.css']
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
</record>
|
||||
|
||||
<menuitem name="Cash Register Management" parent="point_of_sale.menu_point_root"
|
||||
id="menu_point_open_config" sequence="1"/>
|
||||
id="menu_point_open_config" sequence="10"/>
|
||||
<menuitem
|
||||
name="Open Cash Registers" parent="menu_point_open_config"
|
||||
string="Open Cash Registers"
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Daily Operations" id="menu_point_of_sale" parent="menu_point_root" sequence="1" />
|
||||
<menuitem name="Daily Operations" id="menu_point_of_sale" parent="menu_point_root" sequence="10" />
|
||||
<menuitem name="New Sale Order" parent="menu_point_of_sale" id="menu_point_ofsale" action="action_pos_pos_form" sequence="1" groups="group_pos_manager,group_pos_user"/>
|
||||
<menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="15" />
|
||||
|
||||
|
@ -791,6 +791,16 @@
|
|||
<menuitem icon="STOCK_PRINT" action="action_report_pos_details"
|
||||
id="menu_pos_details" parent="menu_point_rep" sequence="6" />
|
||||
|
||||
<record model="ir.actions.client" id="action_pos_pos">
|
||||
<field name="name">Start Point of Sale</field>
|
||||
<field name="tag">pos.ui</field>
|
||||
</record>
|
||||
|
||||
<record id="menu_pos_pos" model="ir.ui.menu">
|
||||
<field name="name">Start Point of Sale</field>
|
||||
<field name="sequence" eval="5"/>
|
||||
<field name="parent_id" ref="menu_point_root"/>
|
||||
<field name="action" ref="action_pos_pos"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
font-family: "Lucida Grande", Helvetica, Verdana, Arial;
|
||||
color: #555555;
|
||||
font-size: 12px;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
openerp.point_of_sale = {};
|
||||
|
||||
openerp.point_of_sale = function(db) {
|
||||
db.point_of_sale = {};
|
||||
|
||||
|
||||
/* Some utility functions defined by Coffee script */
|
||||
var __bind = function(fn, me) {
|
||||
return function() {
|
||||
|
@ -42,7 +39,7 @@ openerp.point_of_sale = function(db) {
|
|||
return QWeb.render(template, ctx);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Local store access. Read once from localStorage upon construction and persist on every change.
|
||||
There should only be one store active at any given time to ensure data consistency.
|
||||
|
@ -161,16 +158,16 @@ openerp.point_of_sale = function(db) {
|
|||
};
|
||||
return Pos;
|
||||
})();
|
||||
|
||||
|
||||
/* global variable */
|
||||
var pos;
|
||||
|
||||
|
||||
var App, CashRegister, CashRegisterCollection, Category, CategoryCollection, CategoryView,
|
||||
NumpadState, NumpadView, Order, OrderButtonView, OrderCollection, OrderView, Orderline,
|
||||
OrderlineCollection, OrderlineView, PaymentButtonView, PaymentView, Paymentline,
|
||||
PaymentlineCollection, PaymentlineView, PaypadView, Product, ProductCollection,
|
||||
ProductListView, ProductView, ReceiptLineView, ReceiptView, Shop, ShopView, StepsView;
|
||||
|
||||
|
||||
/*
|
||||
---
|
||||
Models
|
||||
|
@ -588,7 +585,7 @@ openerp.point_of_sale = function(db) {
|
|||
/* set correct view */
|
||||
$('.step-screen').hide();
|
||||
$('#payment-screen').show();
|
||||
|
||||
|
||||
cashRegisterId = event.currentTarget.attributes['cash-register-id'].nodeValue;
|
||||
cashRegisterCollection = this.shop.get('cashRegisters');
|
||||
cashRegister = cashRegisterCollection.find(__bind( function(item) {
|
||||
|
@ -963,7 +960,7 @@ openerp.point_of_sale = function(db) {
|
|||
function ReceiptView() {
|
||||
ReceiptView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
|
||||
ReceiptView.prototype.initialize = function(options) {
|
||||
this.shop = options.shop;
|
||||
this.shop.bind('change:selectedOrder', this.changeSelectedOrder, this);
|
||||
|
@ -1186,19 +1183,24 @@ openerp.point_of_sale = function(db) {
|
|||
};
|
||||
return App;
|
||||
})();
|
||||
|
||||
|
||||
db.web.client_actions.add('pos.ui', 'db.point_of_sale.PointOfSale');
|
||||
db.point_of_sale.PointOfSale = db.web.Widget.extend({
|
||||
template: "PointOfSale",
|
||||
start: function() {
|
||||
// FIXME: absolutely horrible hack to avoid conflict
|
||||
// between backbone's history and al's action
|
||||
// thingie
|
||||
window.location.hash = '';
|
||||
var self = this;
|
||||
|
||||
|
||||
if (pos)
|
||||
throw "It is not possible to instantiate multiple instances"+
|
||||
"of the point of sale at the same time.";
|
||||
pos = new Pos(this.session);
|
||||
|
||||
|
||||
this.$element.find('#steps').buttonset();
|
||||
|
||||
|
||||
return pos.ready.then( function() {
|
||||
pos.app = new App(self.$element);
|
||||
return Backbone.history.start();
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Point of Sale</title>
|
||||
<link rel="stylesheet" type="text/css" href="/web/static/lib/jquery.ui/css/smoothness/jquery-ui-1.8.9.custom.css">
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="/point_of_sale/static/src/css/pos.css">
|
||||
<script type="text/javascript" src="/web/static/lib/jquery/jquery-1.6.2.js"></script>
|
||||
<script type="text/javascript" src="/web/static/lib/jquery.ui/js/jquery-ui-1.8.9.custom.min.js"></script>
|
||||
<script type="text/javascript" src="/web/static/lib/underscore/underscore.js"></script>
|
||||
<script type="text/javascript" src="/web/static/lib/qweb/qweb2.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/boot.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/core.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/formats.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/chrome.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/data.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/dates.js"></script>
|
||||
<script type="text/javascript" src="/point_of_sale/static/lib/backbone/backbone-0.5.3.js"></script>
|
||||
<script type="text/javascript" src="/point_of_sale/static/src/js/pos.js"></script>
|
||||
<script type="text/javascript" src="/web/static/lib/datejs/globalization/en-US.js"></script>
|
||||
<script type="text/javascript" src="/web/static/lib/datejs/core.js"></script>
|
||||
<script type="text/javascript" src="/web/static/lib/datejs/parser.js"></script>
|
||||
<script type="text/javascript" src="/web/static/lib/datejs/sugarpak.js"></script>
|
||||
<script type="text/javascript" src="/web/static/lib/datejs/extras.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var db = openerp.init();
|
||||
openerp.point_of_sale(db);
|
||||
var session = new db.web.Session('DEBUG');
|
||||
session.session_login('addons-trunk_all', 'admin', 'admin').then(function() {
|
||||
var pos = new db.point_of_sale.PointOfSale({session: session});
|
||||
pos.appendTo($("body"));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue