Skip to content

Commit

Permalink
[IMP] pos_timeout: black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
acsonefho authored and benwillig committed Jan 26, 2024
1 parent a5c43e8 commit f8b7ad3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 39 deletions.
1 change: 0 additions & 1 deletion pos_timeout/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
from . import models
18 changes: 4 additions & 14 deletions pos_timeout/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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 change: 0 additions & 1 deletion pos_timeout/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
from . import pos_config
9 changes: 5 additions & 4 deletions pos_timeout/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -7,10 +6,11 @@


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"
Expand All @@ -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 changes: 6 additions & 8 deletions pos_timeout/static/src/js/pos_timeout.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -24,5 +23,4 @@ odoo.define('pos_timeout.models', function (require) {
return PosModelParent._save_to_server.apply(this, arguments);
},
});

});
10 changes: 5 additions & 5 deletions pos_timeout/views/templates.xml
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 6 deletions pos_timeout/views/view_pos_config.xml
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit f8b7ad3

Please sign in to comment.