diff --git a/pos_timeout/README.rst b/pos_timeout/README.rst new file mode 100644 index 00000000..1151af63 --- /dev/null +++ b/pos_timeout/README.rst @@ -0,0 +1,76 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +======================= +Point of Sale - timeout +======================= + +This module extends the functionality of Point of Sale module. + +By default, in Odoo a timeout is set to 7.5 seconds for the creation of +a PoS order. This threshold is usually sufficient, but in some cases it is not, +mainly if the connection is bad, or if some custom modules add extra +long treatments. + +This module allows to change this default value. + + +Configuration +============= + +To configure this module, you need to: + +* Go to 'Point Of Sale' / 'Configuration' / 'Point of Sale' and edit your + PoS Config, setting a timeout + +.. figure:: /pos_timeout/static/description/pos_config.png + :alt: PoS Configuration + :width: 800 px + +If not set, the default Odoo timeout will be used. (7.5 seconds in V10.0) + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/121/10.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Sylvain LE GAL (https://twitter.com/legalsylvain) + +Funders +------- + +The development of this module has been financially supported by: + +* GRAP, Groupement Régional Alimentaire de Proximité (http://www.grap.coop) + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://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 https://odoo-community.org. diff --git a/pos_timeout/__init__.py b/pos_timeout/__init__.py new file mode 100644 index 00000000..a0fdc10f --- /dev/null +++ b/pos_timeout/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models diff --git a/pos_timeout/__manifest__.py b/pos_timeout/__manifest__.py new file mode 100644 index 00000000..e6ceedbb --- /dev/null +++ b/pos_timeout/__manifest__.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2017 - Today: GRAP (http://www.grap.coop) +# Copyright (C) 2017 - Today: Akretion (http://www.akretion.com) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Point of Sale - timeout", + "summary": "Set the timeout of the point of sale", + "version": "10.0.1.0.0", + "category": "Point Of sale", + "website": "https://odoo-community.org/", + "author": "GRAP, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + "point_of_sale", + ], + "images": [ + "static/description/pos_config.png", + ], + "data": [ + "views/view_pos_config.xml", + "views/templates.xml", + ], + 'qweb': [ + 'static/src/xml/pos_timeout.xml', + ], + "installable": True, +} diff --git a/pos_timeout/i18n/fr.po b/pos_timeout/i18n/fr.po new file mode 100644 index 00000000..b27ce7db --- /dev/null +++ b/pos_timeout/i18n/fr.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_timeout +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-20 00:43+0000\n" +"PO-Revision-Date: 2018-01-20 00:43+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_timeout +#: model:ir.model.fields,help:pos_timeout.field_pos_config_pos_order_timeout +msgid "Define the timeout for the creation of PoS Order in the Front Office UI.\n" +" The value is expressed in seconds.\n" +" If not defined, the default Odoo value will be used (7.5 seconds)." +msgstr "Définit le timeout pour la création des commandes de vente dans la partie front office du point de vente.\n" +" La valeur est exprimée en secondes.\n" +" Si elle n'est pas définie, la valeur par défaut de Odoo sera utilisée. (7.5 secondes)." + +#. module: pos_timeout +#: model:ir.model.fields,field_description:pos_timeout.field_pos_config_pos_order_timeout +msgid "PoS Order Timeout" +msgstr "Timeout des commandes" + +#. module: pos_timeout +#: model:ir.model,name:pos_timeout.model_pos_config +msgid "pos.config" +msgstr "pos.config" + diff --git a/pos_timeout/models/__init__.py b/pos_timeout/models/__init__.py new file mode 100644 index 00000000..e77b6015 --- /dev/null +++ b/pos_timeout/models/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import pos_config diff --git a/pos_timeout/models/pos_config.py b/pos_timeout/models/pos_config.py new file mode 100644 index 00000000..b7ff8c73 --- /dev/null +++ b/pos_timeout/models/pos_config.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2018 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class PosConfig(models.Model): + _inherit = 'pos.config' + + pos_order_timeout = fields.Integer( + string='PoS Order Timeout', help="Define the timeout for" + " the creation of PoS Order in the Front Office UI.\n" + " The value is expressed in seconds.\n" + " If not defined, the default Odoo value will be used (7.5 seconds).") diff --git a/pos_timeout/static/description/icon.png b/pos_timeout/static/description/icon.png new file mode 100644 index 00000000..325d72f5 Binary files /dev/null and b/pos_timeout/static/description/icon.png differ diff --git a/pos_timeout/static/description/pos_config.png b/pos_timeout/static/description/pos_config.png new file mode 100644 index 00000000..5ce3efb5 Binary files /dev/null and b/pos_timeout/static/description/pos_config.png differ diff --git a/pos_timeout/static/src/js/pos_timeout.js b/pos_timeout/static/src/js/pos_timeout.js new file mode 100644 index 00000000..fd8615b9 --- /dev/null +++ b/pos_timeout/static/src/js/pos_timeout.js @@ -0,0 +1,28 @@ +/****************************************************************************** + Copyright (C) 2018 - Today: GRAP (http://www.grap.coop) + @author: Sylvain LE GAL (https://twitter.com/legalsylvain) + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + *****************************************************************************/ +'use strict'; + +odoo.define('pos_timeout.models', function (require) { + + var models = require('point_of_sale.models'); + + /************************************************************************* + Extend module.PosModel: + Overload _save_to_server to alter the timeout + */ + var PosModelParent = models.PosModel.prototype; + models.PosModel = models.PosModel.extend({ + _save_to_server: function (orders, options) { + // Get PoS Config Settings + var timeout = this.config.pos_order_timeout; + if (timeout > 0) { + arguments[1].timeout = timeout * 1000; + } + return PosModelParent._save_to_server.apply(this, arguments); + }, + }); + +}); diff --git a/pos_timeout/views/templates.xml b/pos_timeout/views/templates.xml new file mode 100644 index 00000000..c3ed6738 --- /dev/null +++ b/pos_timeout/views/templates.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/pos_timeout/views/view_pos_config.xml b/pos_timeout/views/view_pos_config.xml new file mode 100644 index 00000000..e7357123 --- /dev/null +++ b/pos_timeout/views/view_pos_config.xml @@ -0,0 +1,15 @@ + + + + + + pos.config + + + + + + + + +