Browse Source
[ADD] start module pos_order_no_offline, the aim is to have a blocking synchronisation in order to be sure to synchronise the order without any posibility to destroy it
pull/172/head
[ADD] start module pos_order_no_offline, the aim is to have a blocking synchronisation in order to be sure to synchronise the order without any posibility to destroy it
pull/172/head
Sébastien BEAU
8 years ago
5 changed files with 131 additions and 0 deletions
-
38pos_order_no_offline/README.rst
-
1pos_order_no_offline/__init__.py
-
30pos_order_no_offline/__openerp__.py
-
49pos_order_no_offline/static/src/js/pos_order_no_offline.js
-
13pos_order_no_offline/view/pos_order_no_offline.xml
@ -0,0 +1,38 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:alt: License: AGPL-3 |
|||
|
|||
POS Order No offline mode |
|||
=========================== |
|||
|
|||
This module remove the possibility to generate a pos ticket without connexion. |
|||
This mean that no pos order can be drop |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/issues>`_. |
|||
In case of trouble, please check there if your issue has already been reported. |
|||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback |
|||
`here <https://github.com/OCA/pos/issues/new?body=module:%20pos_order_load%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Sébastien Beau <sebastien.beau@akretion.com> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: http://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: http://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. |
|||
|
|||
To contribute to this module, please visit http://odoo-community.org. |
|||
|
@ -0,0 +1 @@ |
|||
# -*- coding: utf-8 -*- |
@ -0,0 +1,30 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2017 Akretion (http://www.akretion.com). |
|||
# @author Sébastien BEAU <sebastien.beau@akretion.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
{ |
|||
"name": "POS Order no offline mode", |
|||
"summary": "Remove offine mode on pos order", |
|||
"version": "8.1.0.0", |
|||
"category": "Point Of Sale", |
|||
"website": "www.akretion.com", |
|||
'author': 'Akretion,Odoo Community Association (OCA)', |
|||
"license": "AGPL-3", |
|||
"application": False, |
|||
"installable": True, |
|||
"external_dependencies": { |
|||
"python": [], |
|||
"bin": [], |
|||
}, |
|||
"depends": [ |
|||
"base", |
|||
], |
|||
"data": [ |
|||
'view/pos_order_no_offline.xml', |
|||
], |
|||
"demo": [ |
|||
], |
|||
"qweb": [ |
|||
] |
|||
} |
@ -0,0 +1,49 @@ |
|||
openerp.pos_order_no_offline = function(instance, local) { |
|||
module = instance.point_of_sale; |
|||
var QWeb = instance.web.qweb; |
|||
var _t = instance.web._t; |
|||
var round_pr = instance.web.round_precision; |
|||
|
|||
/************************************************************************* |
|||
Extend Model PaymentScreenWidget: |
|||
*/ |
|||
|
|||
module.PaymentScreenWidget = module.PaymentScreenWidget.extend({ |
|||
next_screen: 'products', // forbid to edit ticket with pdf
|
|||
}) |
|||
|
|||
/************************************************************************* |
|||
Extend Model Pos: |
|||
*/ |
|||
module.PosModel = module.PosModel.extend({ |
|||
|
|||
push_order: function(order) { |
|||
//this._super();
|
|||
if(order){ |
|||
var posOrderModel = new instance.web.Model('pos.order'); |
|||
return posOrderModel.call( |
|||
'create_from_ui', |
|||
[[{'data': order.export_as_JSON(), 'to_invoice': false}]], |
|||
undefined, |
|||
{ |
|||
shadow: false, //!options.to_invoice,
|
|||
timeout: 30000, //timeout
|
|||
}).then(function (response) { |
|||
console.log(response) |
|||
return response; |
|||
}).fail(function (error, event){ |
|||
if(error.code === 200 ){ // Business Logic Error, not a connection problem
|
|||
/*self.pos_widget.screen_selector.show_popup('error-traceback',{ |
|||
message: error.data.message, |
|||
comment: error.data.debug |
|||
});*/ |
|||
} |
|||
// prevent an error popup creation by the rpc failure
|
|||
// we want the failure to be silent as we send the orders in the background
|
|||
event.preventDefault(); |
|||
console.error('Failed to send orders:', order); |
|||
}); |
|||
} |
|||
}, |
|||
}); |
|||
}; |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- vim:fdn=3: |
|||
--> |
|||
<openerp> |
|||
<data> |
|||
<template id="assets_backend" name="pos_order_no_offline assets" inherit_id="web.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<script type="text/javascript" src="/pos_order_no_offline/static/src/js/pos_order_no_offline.js"></script> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
</openerp> |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue