Browse Source

[ADD] new module pos_timeout

pull/528/head
Sylvain LE GAL 7 years ago
committed by François Honoré
parent
commit
041dbc0fe5
  1. 76
      pos_timeout/README.rst
  2. 2
      pos_timeout/__init__.py
  3. 29
      pos_timeout/__manifest__.py
  4. 36
      pos_timeout/i18n/fr.po
  5. 2
      pos_timeout/models/__init__.py
  6. 16
      pos_timeout/models/pos_config.py
  7. BIN
      pos_timeout/static/description/icon.png
  8. BIN
      pos_timeout/static/description/pos_config.png
  9. 28
      pos_timeout/static/src/js/pos_timeout.js
  10. 11
      pos_timeout/views/templates.xml
  11. 15
      pos_timeout/views/view_pos_config.xml

76
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
<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 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.

2
pos_timeout/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

29
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,
}

36
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"

2
pos_timeout/models/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import pos_config

16
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).")

BIN
pos_timeout/static/description/icon.png

After

Width: 160  |  Height: 160  |  Size: 2.4 KiB

BIN
pos_timeout/static/description/pos_config.png

After

Width: 820  |  Height: 205  |  Size: 21 KiB

28
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);
},
});
});

11
pos_timeout/views/templates.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets" name="pos_timeout assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_timeout/static/src/js/pos_timeout.js"></script>
</xpath>
</template>
</odoo>

15
pos_timeout/views/view_pos_config.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_pos_config_form" model="ir.ui.view">
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.view_pos_config_form"/>
<field name="arch" type="xml">
<field name="iface_invoicing" position="before">
<field name="pos_order_timeout"/>
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save