Browse Source

[IMP] pos_timeout: black, isort, prettier

pull/528/head
François Honoré 4 years ago
parent
commit
12b959279d
  1. 1
      pos_timeout/__init__.py
  2. 18
      pos_timeout/__manifest__.py
  3. 1
      pos_timeout/models/__init__.py
  4. 9
      pos_timeout/models/pos_config.py
  5. 14
      pos_timeout/static/src/js/pos_timeout.js
  6. 10
      pos_timeout/views/templates.xml
  7. 9
      pos_timeout/views/view_pos_config.xml
  8. 2
      setup/.setuptools-odoo-make-default-ignore
  9. 2
      setup/README
  10. 1
      setup/pos_timeout/odoo/__init__.py
  11. 1
      setup/pos_timeout/odoo/addons/__init__.py
  12. 1
      setup/pos_timeout/odoo/addons/pos_timeout
  13. 6
      setup/pos_timeout/setup.py

1
pos_timeout/__init__.py

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

18
pos_timeout/__manifest__.py

@ -1,4 +1,3 @@
# -*- 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)
@ -12,18 +11,9 @@
"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',
],
"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,
}

1
pos_timeout/models/__init__.py

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

9
pos_timeout/models/pos_config.py

@ -1,4 +1,3 @@
# -*- 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).
@ -7,10 +6,11 @@ from odoo import fields, models
class PosConfig(models.Model):
_inherit = 'pos.config'
_inherit = "pos.config"
pos_order_timeout = fields.Integer(
string='PoS Order(s) Timeout', help="Defines the value of the"
string="PoS Order(s) Timeout",
help="Defines the value of the"
" client-side timeout for the creation of PoS Order(s)"
" from the POS UI.\n"
" The value is expressed in seconds, for a single order.\n"
@ -19,4 +19,5 @@ class PosConfig(models.Model):
" (after a long disconnection period for example, or if the previous"
" call raised the timeout),\n the effective timeout value applied will"
" be equal to the defined timeout value multiplied by the number of"
" orders.\n")
" orders.\n",
)

14
pos_timeout/static/src/js/pos_timeout.js

@ -1,21 +1,20 @@
/******************************************************************************
/** ****************************************************************************
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';
"use strict";
odoo.define('pos_timeout.models', function (require) {
odoo.define("pos_timeout.models", function(require) {
var models = require("point_of_sale.models");
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) {
_save_to_server: function(orders, options) {
// Get PoS Config Settings
var timeout = this.config.pos_order_timeout;
if (timeout > 0 && orders && orders.length) {
@ -24,5 +23,4 @@ odoo.define('pos_timeout.models', function (require) {
return PosModelParent._save_to_server.apply(this, arguments);
},
});
});

10
pos_timeout/views/templates.xml

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
<script
type="text/javascript"
src="/pos_timeout/static/src/js/pos_timeout.js"
/>
</xpath>
</template>
</odoo>

9
pos_timeout/views/view_pos_config.xml

@ -1,15 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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="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 name="pos_order_timeout" />
</field>
</field>
</record>
</odoo>

2
setup/.setuptools-odoo-make-default-ignore

@ -0,0 +1,2 @@
# addons listed in this file are ignored by
# setuptools-odoo-make-default (one addon per line)

2
setup/README

@ -0,0 +1,2 @@
To learn more about this directory, please visit
https://pypi.python.org/pypi/setuptools-odoo

1
setup/pos_timeout/odoo/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/pos_timeout/odoo/addons/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/pos_timeout/odoo/addons/pos_timeout

@ -0,0 +1 @@
../../../../pos_timeout

6
setup/pos_timeout/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save