diff --git a/alipay/data/module_data.xml b/alipay/data/module_data.xml index 1106ef3f..5fcaffb8 100644 --- a/alipay/data/module_data.xml +++ b/alipay/data/module_data.xml @@ -2,9 +2,10 @@ Mini-program - Helps you manage your Alipay and main operations: create orders, payment, etc... + + Helps you manage your Alipay and main operations: create orders, payment, + etc... + 60 diff --git a/alipay/models/alipay_order.py b/alipay/models/alipay_order.py index 9bee3bf0..492710c8 100644 --- a/alipay/models/alipay_order.py +++ b/alipay/models/alipay_order.py @@ -22,7 +22,7 @@ class AlipayOrder(models.Model): """Records with order information and payment status. - Can be used for different types of Payments. See description of trade_type field. """ + Can be used for different types of Payments. See description of trade_type field.""" _name = "alipay.order" _description = "Unified Order" @@ -77,7 +77,7 @@ def _compute_refund_fee(self): ) def _body(self): - """ Example of result: + """Example of result: {"goods_detail": [ { diff --git a/alipay/models/alipay_refund.py b/alipay/models/alipay_refund.py index 4dd19e4b..2d9ea7c3 100644 --- a/alipay/models/alipay_refund.py +++ b/alipay/models/alipay_refund.py @@ -13,7 +13,7 @@ class AlipayRefund(models.Model): """Records with refund information and payment status. - Can be used for different types of Payments. See description of trade_type field. """ + Can be used for different types of Payments. See description of trade_type field.""" _name = "alipay.refund" _description = "Unified Refund" @@ -68,7 +68,10 @@ def action_confirm(self): else: alipay = self.env["ir.config_parameter"].get_alipay_pay_object() result_raw = alipay.refund.apply( - record.total_fee, self.refund_fee, self.name, out_trade_no=record.name, + record.total_fee, + self.refund_fee, + self.name, + out_trade_no=record.name, ) vals = { diff --git a/alipay/models/ir_config_parameter.py b/alipay/models/ir_config_parameter.py index 53f4e92b..1ee3a67c 100644 --- a/alipay/models/ir_config_parameter.py +++ b/alipay/models/ir_config_parameter.py @@ -50,7 +50,10 @@ def get_alipay_object(self): notify_url = self.sudo().get_param("alipay.notify_url") if not notify_url: base = self.sudo().get_param("web.base.url") - notify_url = "{base}{path}".format(base=base, path=ALIPAY_NOTIFY_URL,) + notify_url = "{base}{path}".format( + base=base, + path=ALIPAY_NOTIFY_URL, + ) options["app_notify_url"] = notify_url diff --git a/alipay/tests/test_alipay.py b/alipay/tests/test_alipay.py index e13d6a7b..8f9d854c 100644 --- a/alipay/tests/test_alipay.py +++ b/alipay/tests/test_alipay.py @@ -31,7 +31,9 @@ def setUp(self): self.requests_mock.start() self.addCleanup(self.requests_mock.stop) - context = dict(app_private_key_string=DUMMY_RSA_KEY,) + context = dict( + app_private_key_string=DUMMY_RSA_KEY, + ) self.Config = self.env["ir.config_parameter"].with_context(context) self.Order = self.env["alipay.order"].with_context(context) diff --git a/base_automation_webhook/data/base_automation_demo.xml b/base_automation_webhook/data/base_automation_demo.xml index d2c16421..f9ccb2b0 100644 --- a/base_automation_webhook/data/base_automation_demo.xml +++ b/base_automation_webhook/data/base_automation_demo.xml @@ -6,10 +6,10 @@ Base Automation: test rule on create code -log("code is executed") + log("code is executed") # don't make actual request, but just check the package is available make_request - + on_create diff --git a/ir_attachment_s3/controllers/main.py b/ir_attachment_s3/controllers/main.py index c8789f47..fb905952 100644 --- a/ir_attachment_s3/controllers/main.py +++ b/ir_attachment_s3/controllers/main.py @@ -111,8 +111,10 @@ def content_image( ) if image_variant_attachment: w, h = SIZES_MAP[field] - resized_attachment = image_variant_attachment._get_or_create_resized_in_cache( - w, h, field=field + resized_attachment = ( + image_variant_attachment._get_or_create_resized_in_cache( + w, h, field=field + ) ) attachment = resized_attachment.resized_attachment_id diff --git a/ir_attachment_s3/views/res_config_settings_views.xml b/ir_attachment_s3/views/res_config_settings_views.xml index 7abb3c18..6f3c8e9c 100644 --- a/ir_attachment_s3/views/res_config_settings_views.xml +++ b/ir_attachment_s3/views/res_config_settings_views.xml @@ -1,9 +1,9 @@ - res.config.settings.view.form.inherit.ir_attachment_s3 + + res.config.settings.view.form.inherit.ir_attachment_s3 + res.config.settings diff --git a/ir_attachment_url/demo/ir_attachment.xml b/ir_attachment_url/demo/ir_attachment.xml index 3c99ed03..232629a4 100644 --- a/ir_attachment_url/demo/ir_attachment.xml +++ b/ir_attachment_url/demo/ir_attachment.xml @@ -3,8 +3,8 @@ test_attachment url - https://en.wikipedia.org/wiki/Iceland#/media/File:Gullfoss,_an_iconic_waterfall_of_Iceland.jpg + + https://en.wikipedia.org/wiki/Iceland#/media/File:Gullfoss,_an_iconic_waterfall_of_Iceland.jpg + diff --git a/ir_attachment_url/models/image.py b/ir_attachment_url/models/image.py index d2f1724f..92fe4a0f 100644 --- a/ir_attachment_url/models/image.py +++ b/ir_attachment_url/models/image.py @@ -72,8 +72,8 @@ def updated_image_resize_image_big( filetype=None, avoid_if_small=True, ): - """ copy-pasted from odoo/tools/image.py::image_resize_image_big - because we rewrite image_resize_image function. + """copy-pasted from odoo/tools/image.py::image_resize_image_big + because we rewrite image_resize_image function. """ return updated_image_resize_image( base64_source, size, encoding, filetype, avoid_if_small @@ -87,8 +87,8 @@ def updated_image_resize_image_medium( filetype=None, avoid_if_small=False, ): - """ copy-pasted from odoo/tools/image.py::image_resize_image_medium - because we rewrite image_resize_image function. + """copy-pasted from odoo/tools/image.py::image_resize_image_medium + because we rewrite image_resize_image function. """ return updated_image_resize_image( base64_source, size, encoding, filetype, avoid_if_small @@ -98,8 +98,8 @@ def updated_image_resize_image_medium( def updated_image_resize_image_small( base64_source, size=(64, 64), encoding="base64", filetype=None, avoid_if_small=False ): - """ copy-pasted from odoo/tools/image.py::image_resize_image_small - because we rewrite image_resize_image function. + """copy-pasted from odoo/tools/image.py::image_resize_image_small + because we rewrite image_resize_image function. """ return updated_image_resize_image( base64_source, size, encoding, filetype, avoid_if_small @@ -118,8 +118,8 @@ def updated_image_get_resized_images( avoid_resize_medium=False, avoid_resize_small=False, ): - """ copy-pasted from odoo/tools/image.py::image_get_resized_images - because we rewrite image_resize_image function. + """copy-pasted from odoo/tools/image.py::image_get_resized_images + because we rewrite image_resize_image function. """ return_dict = dict() if isinstance(base64_source, tools.pycompat.text_type): diff --git a/ir_attachment_url/models/ir_http.py b/ir_attachment_url/models/ir_http.py index 7a9ccc33..67568191 100644 --- a/ir_attachment_url/models/ir_http.py +++ b/ir_attachment_url/models/ir_http.py @@ -64,7 +64,7 @@ def binary_content( access_token=None, env=None, ): # pylint: disable=redefined-builtin - """ Get file, attachment or downloadable content + """Get file, attachment or downloadable content If the ``xmlid`` and ``id`` parameter is omitted, fetches the default value for the binary field (via ``default_get``), otherwise fetches the field for diff --git a/ir_attachment_url/static/src/js/ir_attachment_url.js b/ir_attachment_url/static/src/js/ir_attachment_url.js index 455e5027..db14e287 100644 --- a/ir_attachment_url/static/src/js/ir_attachment_url.js +++ b/ir_attachment_url/static/src/js/ir_attachment_url.js @@ -1,6 +1,4 @@ -odoo.define("ir_attachment_url", function(require) { - "use strict"; - +odoo.define("ir_attachment_url", function (require) { var core = require("web.core"); var QWeb = core.qweb; var FieldBinaryImage = require("web.field_registry").get("image"); @@ -11,25 +9,25 @@ odoo.define("ir_attachment_url", function(require) { "click .o_link_address_button": "on_link_address", }), - init: function(parent, name, record) { + init: function (parent, name, record) { this._super.apply(this, arguments); this.url_clicked = false; this.is_url = false; }, - on_link_address: function() { + on_link_address: function () { var self = this; this.$el.children(".img-responsive").remove(); this.$el.children(".input_url").remove(); this.$el.children(".o_form_image_controls").addClass("media_url_controls"); - this.$el.prepend($(QWeb.render("AttachmentURL", {widget: this}))); - this.$(".input_url input").on("change", function() { + this.$el.prepend($(QWeb.render("AttachmentURL", { widget: this }))); + this.$(".input_url input").on("change", function () { var input_val = $(this).val(); self._setValue(input_val); }); }, - is_url_valid: function(value) { + is_url_valid: function (value) { if (value || (this.$input && this.$input.is("input"))) { var u = new RegExp( "^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?" @@ -39,7 +37,7 @@ odoo.define("ir_attachment_url", function(require) { return true; }, - _render: function() { + _render: function () { if (!this.is_url_valid(this.value)) { return this._super(); } @@ -61,14 +59,14 @@ odoo.define("ir_attachment_url", function(require) { }); this.$("> img").remove(); this.$el.prepend($img); - $img.on("error", function() { + $img.on("error", function () { self.on_clear(); $img.attr("src", self.placeholder); self.do_warn(_t("Image"), _t("Could not display the selected image.")); }); }, - isSet: function() { + isSet: function () { return true; }, }); diff --git a/ir_attachment_url/views/ir_attachment_res_config.xml b/ir_attachment_url/views/ir_attachment_res_config.xml index 361b2077..87efbd95 100644 --- a/ir_attachment_url/views/ir_attachment_res_config.xml +++ b/ir_attachment_url/views/ir_attachment_res_config.xml @@ -9,20 +9,20 @@ class="oe_form_configuration" >
-
+
diff --git a/odoo_backup_sh/models/res_config_settings.py b/odoo_backup_sh/models/res_config_settings.py index 85ae3498..91867a72 100644 --- a/odoo_backup_sh/models/res_config_settings.py +++ b/odoo_backup_sh/models/res_config_settings.py @@ -79,10 +79,12 @@ def set_values(self): @api.onchange("odoo_backup_sh_amazon_access_key_id") def switch_to_private_s3(self): - if self.odoo_backup_sh_amazon_access_key_id and self.odoo_backup_sh_amazon_access_key_id != self.env[ - "ir.config_parameter" - ].get_param( - "odoo_backup_sh.aws_access_key_id" + if ( + self.odoo_backup_sh_amazon_access_key_id + and self.odoo_backup_sh_amazon_access_key_id + != self.env["ir.config_parameter"].get_param( + "odoo_backup_sh.aws_access_key_id" + ) ): # when Access Key is changed to new non-empty value self.odoo_backup_sh_odoo_oauth_uid = "" diff --git a/odoo_backup_sh/static/src/js/dashboard.js b/odoo_backup_sh/static/src/js/dashboard.js index 7724b9ab..6df85fde 100644 --- a/odoo_backup_sh/static/src/js/dashboard.js +++ b/odoo_backup_sh/static/src/js/dashboard.js @@ -2,9 +2,7 @@ // Copyright 2019 Dinar Gabbasov // License MIT (https://opensource.org/licenses/MIT). /* global nv, d3*/ -odoo.define("odoo_backup_sh.dashboard", function(require) { - "use strict"; - +odoo.define("odoo_backup_sh.dashboard", function (require) { var Widget = require("web.Widget"); var ajax = require("web.ajax"); var ControlPanelMixin = require("web.ControlPanelMixin"); @@ -35,20 +33,20 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { "click .kanban_group_buttons .btn": "click_group_buttons", }, - willStart: function() { + willStart: function () { var self = this; - return $.when(ajax.loadLibs(this), this._super()).then(function() { + return $.when(ajax.loadLibs(this), this._super()).then(function () { return self.fetch_dashboard_data(); }); }, - fetch_dashboard_data: function() { + fetch_dashboard_data: function () { var self = this; return self ._rpc({ route: "/odoo_backup_sh/fetch_dashboard_data", }) - .done(function(results) { + .done(function (results) { self.remote_storage_usage_graph_values = results.remote_storage_usage_graph_values; self.services_storage_usage_graph_values = @@ -62,49 +60,49 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { self.cloud_params = results.cloud_params; }); }, - on_dashboard_action: function(ev) { + on_dashboard_action: function (ev) { ev.preventDefault(); var $action = $(ev.currentTarget); this.do_action($action.attr("name")); }, - dashboard_can_backup: function() { + dashboard_can_backup: function () { return ( this.modules.odoo_backup_sh.configured || this.modules.odoo_backup_sh_dropbox.configured || this.modules.odoo_backup_sh_google_disk.configured ); }, - dashboard_basic: function() { + dashboard_basic: function () { return ( !this.modules.odoo_backup_sh.configured && !this.modules.odoo_backup_sh_dropbox.installed && !this.modules.odoo_backup_sh_google_disk.installed ); }, - dashboard_configure_dropbox: function() { + dashboard_configure_dropbox: function () { return ( this.modules.odoo_backup_sh_dropbox.installed && !this.modules.odoo_backup_sh_dropbox.configured ); }, - dashboard_configure_google_disk: function() { + dashboard_configure_google_disk: function () { return ( this.modules.odoo_backup_sh_google_disk.installed && !this.modules.odoo_backup_sh_google_disk.configured ); }, - dashboard_offer_iap: function() { + dashboard_offer_iap: function () { return ( (this.modules.odoo_backup_sh_dropbox.configured || this.modules.odoo_backup_sh_google_disk.configured) && !this.modules.odoo_backup_sh.configured ); }, - dashboard_iap: function() { + dashboard_iap: function () { return this.modules.odoo_backup_sh.configured_iap; }, - dashboard_offer_extra_module: function() { + dashboard_offer_extra_module: function () { return ( this.modules.odoo_backup_sh.configured && !this.modules.odoo_backup_sh.configured_iap && @@ -112,7 +110,7 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { !this.modules.odoo_backup_sh_google_disk.installed ); }, - auth_via_odoo: function() { + auth_via_odoo: function () { if ("auth_link" in this.cloud_params) { self.do_action({ name: "Auth via odoo.com", @@ -140,9 +138,9 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { self.cloud_params = cloud_params; })*/ }, - start: function() { + start: function () { var self = this; - return this._super().then(function() { + return this._super().then(function () { self.set_service("total"); if (!self.show_nocontent_msg) { self.render_remote_storage_usage_graph(); @@ -151,7 +149,7 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { }); }, - set_active_button: function($el) { + set_active_button: function ($el) { $el.parent() .find(".btn-primary") .removeClass("btn-primary") @@ -160,7 +158,7 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { $el.addClass("btn-primary"); }, - click_group_buttons: function(e) { + click_group_buttons: function (e) { e.preventDefault(); var $el = $(e.target); var service = $el.data("service"); @@ -175,15 +173,15 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { this.set_active_button($el); }, - set_service: function(service) { + set_service: function (service) { this.service = service; }, - get_service: function() { + get_service: function () { return this.service; }, - render_remote_storage_usage_graph: function(chart_values) { + render_remote_storage_usage_graph: function (chart_values) { this.$("#graph_remote_storage_usage").empty(); var service = this.get_service(); var title = null; @@ -204,13 +202,13 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { chart_values = chart_values || this.remote_storage_usage_graph_values; var self = this; - nv.addGraph(function() { + nv.addGraph(function () { var chart = nv.models .lineChart() - .x(function(d) { + .x(function (d) { return self.getDate(d); }) - .y(function(d) { + .y(function (d) { return self.getValue(d); }) .forceY([0]) @@ -221,11 +219,11 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { var tick_values = self.getPrunedTickValues(chart_values[0].values, 5); chart.xAxis - .tickFormat(function(d) { + .tickFormat(function (d) { return d3.time.format("%m/%d/%y")(new Date(d)); }) .tickValues( - _.map(tick_values, function(d) { + _.map(tick_values, function (d) { return self.getDate(d); }) ) @@ -244,14 +242,16 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { }); }, - render_backup_config_cards: function() { + render_backup_config_cards: function () { var self = this; var $o_backup_dashboard_configs = self .$(".o_backup_dashboard_configs") .append( - QWeb.render("odoo_backup_sh.config_cards", {configs: self.configs}) + QWeb.render("odoo_backup_sh.config_cards", { + configs: self.configs, + }) ); - _.each($o_backup_dashboard_configs.find(".o_kanban_record"), function( + _.each($o_backup_dashboard_configs.find(".o_kanban_record"), function ( record ) { self.render_backup_config_card_graph( @@ -261,26 +261,26 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { }); }, - render_backup_config_card_graph: function(db_name, service) { - var chart_values = this.configs.filter(function(config) { + render_backup_config_card_graph: function (db_name, service) { + var chart_values = this.configs.filter(function (config) { return ( config.database === db_name && config.storage_service === service ); })[0].graph; - nv.addGraph(function() { + nv.addGraph(function () { var chart = nv.models .discreteBarChart() - .x(function(d) { + .x(function (d) { return d.label; }) - .y(function(d) { + .y(function (d) { return d.value; }) .showValues(true) .showYAxis(false) .color(["#7c7bad"]) - .margin({left: 0, right: 0, top: 10, bottom: 42}); + .margin({ left: 0, right: 0, top: 10, bottom: 42 }); chart.xAxis.axisLabel("Backups of Last 7 Days, MB"); @@ -300,12 +300,12 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { return chart; }); }, - o_dashboard_get_s3_credentials: function(ev) { + o_dashboard_get_s3_credentials: function (ev) { window.location.href = "/odoo_backup_sh/get_s3_credentials?redirect=" + encodeURIComponent(window.location.href); }, - o_dashboard_action_add_database: function(ev) { + o_dashboard_action_add_database: function (ev) { ev.preventDefault(); this.do_action( { @@ -323,7 +323,7 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { ); }, - o_dashboard_action_update_info: function(ev) { + o_dashboard_action_update_info: function (ev) { if (ev && ev.preventDefault) { ev.preventDefault(); } @@ -334,11 +334,11 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { kwargs: { cloud_params: self.cloud_params, }, - }).then(function(result) { + }).then(function (result) { if ("reload_page" in result) { window.location.reload(); } - $.when(self.fetch_dashboard_data()).then(function() { + $.when(self.fetch_dashboard_data()).then(function () { self.$("#graph_remote_storage_usage").empty(); self.$(".o_backup_dashboard_configs").empty(); self.start(); @@ -346,7 +346,7 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { }); }, - o_dashboard_action_make_backup: function(ev) { + o_dashboard_action_make_backup: function (ev) { ev.preventDefault(); var service = $(ev.currentTarget) .closest("div[data-service]") @@ -360,7 +360,7 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { .data("db_name"), service: service, }, - }).then(function(result) { + }).then(function (result) { // Always reload to update graphs window.location.reload(); @@ -371,7 +371,7 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { }); }, - o_dashboard_action_view_backups: function(ev) { + o_dashboard_action_view_backups: function (ev) { ev.preventDefault(); this.do_action( { @@ -410,7 +410,7 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { ); }, - o_dashboard_action_backup_config: function(ev) { + o_dashboard_action_backup_config: function (ev) { ev.preventDefault(); this.do_action( { @@ -428,7 +428,7 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { ); }, - close_dashboard_notification: function(ev) { + close_dashboard_notification: function (ev) { ev.preventDefault(); var $o_backup_dashboard_notification = $(ev.currentTarget).closest( ".o_backup_dashboard_notification" @@ -437,23 +437,23 @@ odoo.define("odoo_backup_sh.dashboard", function(require) { model: "odoo_backup_sh.notification", method: "toggle_is_read", args: [$o_backup_dashboard_notification.data("notification_id")], - }).then(function() { + }).then(function () { $o_backup_dashboard_notification.hide(); }); }, // Utility functions - getDate: function(d) { + getDate: function (d) { return new Date(d[0]); }, - getValue: function(d) { + getValue: function (d) { return d[1]; }, - getPrunedTickValues: function(ticks, nb_desired_ticks) { + getPrunedTickValues: function (ticks, nb_desired_ticks) { var nb_values = ticks.length; var keep_one_of = Math.max(1, Math.floor(nb_values / nb_desired_ticks)); - return _.filter(ticks, function(d, i) { + return _.filter(ticks, function (d, i) { return i % keep_one_of === 0; }); }, diff --git a/odoo_backup_sh/static/src/js/tour.js b/odoo_backup_sh/static/src/js/tour.js index a9636578..b38e0876 100644 --- a/odoo_backup_sh/static/src/js/tour.js +++ b/odoo_backup_sh/static/src/js/tour.js @@ -1,9 +1,7 @@ // Copyright 2018 Stanislav Krotov // License MIT (https://opensource.org/licenses/MIT). -odoo.define("odoo_backup_sh.tour", function(require) { - "use strict"; - +odoo.define("odoo_backup_sh.tour", function (require) { var core = require("web.core"); var tour = require("web_tour.tour"); @@ -36,7 +34,7 @@ odoo.define("odoo_backup_sh.tour", function(require) { { // Check that at least one button in dashboard is visible trigger: ".o_backup_dashboard a", - run: function() { + run: function () { // Empty }, }, diff --git a/odoo_backup_sh/static/src/xml/dashboard.xml b/odoo_backup_sh/static/src/xml/dashboard.xml index 15473ff4..88c0818d 100644 --- a/odoo_backup_sh/static/src/xml/dashboard.xml +++ b/odoo_backup_sh/static/src/xml/dashboard.xml @@ -14,8 +14,8 @@ License MIT (https://opensource.org/licenses/MIT). title="Add new database in the dashboard." >
- -
+ +
Add Database
@@ -37,9 +37,10 @@ License MIT (https://opensource.org/licenses/MIT). name="odoo_backup_sh.action_backup_settings" >
-
- Configure S3 -
+ +
+ Configure S3 +
@@ -585,7 +622,9 @@ License MIT (https://opensource.org/licenses/MIT).

Other Storage

+ > + Other Storage +
-
Save this page and come back here to set up the feature.
+
+ Save + this page and come back here to set up the + feature. +
@@ -640,8 +682,11 @@ License MIT (https://opensource.org/licenses/MIT). attrs="{'invisible': [('module_odoo_backup_sh_dropbox','=',False)]}" id="msg_module_odoo_backup_sh_dropbox" > -
Save this page and come back here to set up the feature.
+
+ Save + this page and come back here to set up the + feature. +
diff --git a/odoo_backup_sh_dropbox/static/src/js/dashboard.js b/odoo_backup_sh_dropbox/static/src/js/dashboard.js index 2c55601a..75c69432 100644 --- a/odoo_backup_sh_dropbox/static/src/js/dashboard.js +++ b/odoo_backup_sh_dropbox/static/src/js/dashboard.js @@ -1,13 +1,11 @@ // Copyright 2019 Dinar Gabbasov Krotov // License MIT (https://opensource.org/licenses/MIT). -odoo.define("odoo_backup_sh_dropbox.dashboard", function(require) { - "use strict"; - +odoo.define("odoo_backup_sh_dropbox.dashboard", function (require) { var Dashboard = require("odoo_backup_sh.dashboard"); Dashboard.include({ - click_group_buttons: function(e) { + click_group_buttons: function (e) { var $el = $(e.target); var service = $el.data("service"); if ($el.data("service") === "dropbox") { @@ -20,11 +18,11 @@ odoo.define("odoo_backup_sh_dropbox.dashboard", function(require) { this._super(e); } }, - renderElement: function() { + renderElement: function () { this._super(); this.$(".kanban_group_buttons").removeClass("o_hidden"); }, - render_backup_config_cards: function() { + render_backup_config_cards: function () { this._super(); this.$(".backup_storage_service_title").removeClass("o_hidden"); }, diff --git a/odoo_backup_sh_dropbox/static/src/xml/dashboard.xml b/odoo_backup_sh_dropbox/static/src/xml/dashboard.xml index 669b85a3..439af6b0 100644 --- a/odoo_backup_sh_dropbox/static/src/xml/dashboard.xml +++ b/odoo_backup_sh_dropbox/static/src/xml/dashboard.xml @@ -10,14 +10,14 @@ License MIT (https://opensource.org/licenses/MIT). type="button" data-service="dropbox" class="btn btn-secondary btn-sm" - >Dropbox + > + Dropbox + - - Dropbox - + Dropbox diff --git a/odoo_backup_sh_dropbox/views/res_config_settings_views.xml b/odoo_backup_sh_dropbox/views/res_config_settings_views.xml index eec10352..e3d2d118 100644 --- a/odoo_backup_sh_dropbox/views/res_config_settings_views.xml +++ b/odoo_backup_sh_dropbox/views/res_config_settings_views.xml @@ -30,7 +30,10 @@ License MIT (https://opensource.org/licenses/MIT). Documentation + > + + Documentation +
diff --git a/odoo_backup_sh_google_disk/models/odoo_backup_sh.py b/odoo_backup_sh_google_disk/models/odoo_backup_sh.py index e4889c30..b01646fa 100644 --- a/odoo_backup_sh_google_disk/models/odoo_backup_sh.py +++ b/odoo_backup_sh_google_disk/models/odoo_backup_sh.py @@ -18,8 +18,8 @@ ) try: - from googleapiclient.http import MediaIoBaseDownload, MediaIoBaseUpload from apiclient import errors + from googleapiclient.http import MediaIoBaseDownload, MediaIoBaseUpload except ImportError as err: logging.getLogger(__name__).debug(err) diff --git a/odoo_backup_sh_google_disk/static/src/js/dashboard.js b/odoo_backup_sh_google_disk/static/src/js/dashboard.js index 45ecac67..ad6e9706 100644 --- a/odoo_backup_sh_google_disk/static/src/js/dashboard.js +++ b/odoo_backup_sh_google_disk/static/src/js/dashboard.js @@ -1,13 +1,11 @@ // Copyright 2019 Dinar Gabbasov Krotov // License MIT (https://opensource.org/licenses/MIT). -odoo.define("odoo_backup_sh_google_disk.dashboard", function(require) { - "use strict"; - +odoo.define("odoo_backup_sh_google_disk.dashboard", function (require) { var Dashboard = require("odoo_backup_sh.dashboard"); Dashboard.include({ - click_group_buttons: function(e) { + click_group_buttons: function (e) { var $el = $(e.target); var service = $el.data("service"); if ($el.data("service") === "google_drive") { @@ -20,11 +18,11 @@ odoo.define("odoo_backup_sh_google_disk.dashboard", function(require) { this._super(e); } }, - renderElement: function() { + renderElement: function () { this._super(); this.$(".kanban_group_buttons").removeClass("o_hidden"); }, - render_backup_config_cards: function() { + render_backup_config_cards: function () { this._super(); this.$(".backup_storage_service_title").removeClass("o_hidden"); }, diff --git a/odoo_backup_sh_google_disk/static/src/xml/dashboard.xml b/odoo_backup_sh_google_disk/static/src/xml/dashboard.xml index c117ca6d..fb60f377 100644 --- a/odoo_backup_sh_google_disk/static/src/xml/dashboard.xml +++ b/odoo_backup_sh_google_disk/static/src/xml/dashboard.xml @@ -10,14 +10,14 @@ License MIT (https://opensource.org/licenses/MIT). type="button" data-service="google_drive" class="btn btn-secondary btn-sm" - >Google Drive + > + Google Drive + - - Google Drive - + Google Drive diff --git a/odoo_backup_sh_google_disk/views/res_config_settings_views.xml b/odoo_backup_sh_google_disk/views/res_config_settings_views.xml index 533fa9c9..6af9201f 100644 --- a/odoo_backup_sh_google_disk/views/res_config_settings_views.xml +++ b/odoo_backup_sh_google_disk/views/res_config_settings_views.xml @@ -30,7 +30,10 @@ License MIT (https://opensource.org/licenses/MIT). Documentation + > + + Documentation + diff --git a/openapi/controllers/api.py b/openapi/controllers/api.py index 7a320769..8a044679 100644 --- a/openapi/controllers/api.py +++ b/openapi/controllers/api.py @@ -34,7 +34,7 @@ class ApiV1Controller(http.Controller): - """ Implements the REST API V1 endpoint. + """Implements the REST API V1 endpoint. .. methods: CRUD Methods: diff --git a/openapi/controllers/apijsonrequest.py b/openapi/controllers/apijsonrequest.py index c2412f78..56e71a49 100644 --- a/openapi/controllers/apijsonrequest.py +++ b/openapi/controllers/apijsonrequest.py @@ -106,8 +106,8 @@ def _json_response(self, result=None, error=None): def _handle_exception(self, exception): """Called within an except block to allow converting exceptions - to arbitrary responses. Anything returned (except None) will - be used as response.""" + to arbitrary responses. Anything returned (except None) will + be used as response.""" try: return super(ApiJsonRequest, self)._handle_exception(exception) except Exception: diff --git a/openapi/models/openapi_access.py b/openapi/models/openapi_access.py index a423c168..cde77292 100644 --- a/openapi/models/openapi_access.py +++ b/openapi/models/openapi_access.py @@ -38,7 +38,10 @@ class Access(models.Model): # * all forbidden # * all allowed # * some are allowed - api_public_methods = fields.Boolean("Call Public methods via API", default=False,) + api_public_methods = fields.Boolean( + "Call Public methods via API", + default=False, + ) public_methods = fields.Text( "Restric Public methods", help="Allowed public methods besides basic ones.\n" diff --git a/openapi/models/openapi_namespace.py b/openapi/models/openapi_namespace.py index 3842190f..59fc24bf 100644 --- a/openapi/models/openapi_namespace.py +++ b/openapi/models/openapi_namespace.py @@ -225,7 +225,9 @@ def get_OAS(self): def _compute_spec_url(self): for record in self: record.spec_url = "/api/v1/{}/swagger.json?token={}&db={}".format( - record.name, record.token, self._cr.dbname, + record.name, + record.token, + self._cr.dbname, ) def reset_token(self): diff --git a/openapi/static/src/js/configure_api_button.js b/openapi/static/src/js/configure_api_button.js index a511138d..c63e8bb3 100644 --- a/openapi/static/src/js/configure_api_button.js +++ b/openapi/static/src/js/configure_api_button.js @@ -2,8 +2,7 @@ Copyright 2018 Rafis Bikbov License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). */ -odoo.define("openapi.configure_API", function(require) { - "use strict"; +odoo.define("openapi.configure_API", function (require) { var ListView = require("web.ListView"); var Model = require("web.DataModel"); var IrModel = new Model("ir.model"); @@ -16,7 +15,7 @@ odoo.define("openapi.configure_API", function(require) { ["name", "=", "openapi.namespace"], ["model", "=", "openapi.namespace"], ], - ]).then(function(ids) { + ]).then(function (ids) { var context = { default_model: self.model, default_model_id: ids[0], @@ -32,7 +31,7 @@ odoo.define("openapi.configure_API", function(require) { } ListView.include({ - render_buttons: function() { + render_buttons: function () { this._super.apply(this, arguments); this.$buttons.on( "click", diff --git a/openapi/static/src/js/dashboard.js b/openapi/static/src/js/dashboard.js index 5c2a446b..7b3a9a91 100644 --- a/openapi/static/src/js/dashboard.js +++ b/openapi/static/src/js/dashboard.js @@ -3,8 +3,7 @@ Copyright 2018-2019 Ivan Yelizariev Copyright 2018 Rafis Bikbov License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). */ -odoo.define("openapi.dashboard", function(require) { - "use strict"; +odoo.define("openapi.dashboard", function (require) { var Widget = require("web.Widget"); var dashboard = require("web_settings_dashboard"); @@ -17,7 +16,7 @@ odoo.define("openapi.dashboard", function(require) { "click .o_openapi_namespace": "on_namespace_clicked", }, - init: function(parent, data) { + init: function (parent, data) { this.data = data; this.parent = parent; return this._super.apply(this, arguments); @@ -27,7 +26,7 @@ odoo.define("openapi.dashboard", function(require) { // }, - on_openapi_create: function() { + on_openapi_create: function () { this.do_action({ type: "ir.actions.act_window", res_model: "openapi.namespace", @@ -36,7 +35,7 @@ odoo.define("openapi.dashboard", function(require) { }); }, - on_namespace_clicked: function(e) { + on_namespace_clicked: function (e) { var self = this; e.preventDefault(); var namespace_id = $(e.currentTarget).data("namespace-id"); @@ -50,7 +49,7 @@ odoo.define("openapi.dashboard", function(require) { target: "new", }; this.do_action(action, { - on_reverse_breadcrumb: function() { + on_reverse_breadcrumb: function () { return self.reload(); }, }); @@ -58,18 +57,16 @@ odoo.define("openapi.dashboard", function(require) { }); dashboard.Dashboard.include({ - init: function(parent, data) { + init: function (parent, data) { var ret = this._super(parent, data); this.all_dashboards.push("openapi"); return ret; }, - load_openapi: function(data) { + load_openapi: function (data) { if (data.openapi_not_allowed === true) { return $.when(); } - this.$(".o_web_settings_dashboard_openapi") - .parent() - .show(); + this.$(".o_web_settings_dashboard_openapi").parent().show(); return new DashboardOpenAPI(this, data.openapi).replace( this.$(".o_web_settings_dashboard_openapi") ); diff --git a/openapi/static/src/js/dashboard.tour.js b/openapi/static/src/js/dashboard.tour.js index b0285dd8..6218476d 100644 --- a/openapi/static/src/js/dashboard.tour.js +++ b/openapi/static/src/js/dashboard.tour.js @@ -2,9 +2,7 @@ Copyright 2018 Ivan Yelizariev License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). */ -odoo.define("openapi.dashboard.tour", function(require) { - "use strict"; - +odoo.define("openapi.dashboard.tour", function (require) { var tour = require("web_tour.tour"); var base = require("web_editor.base"); diff --git a/openapi/static/src/xml/dashboard.xml b/openapi/static/src/xml/dashboard.xml index bf702106..1b303f1c 100644 --- a/openapi/static/src/xml/dashboard.xml +++ b/openapi/static/src/xml/dashboard.xml @@ -50,7 +50,10 @@
- Last connection: + + Last connection: + +
diff --git a/pos_alipay/models/alipay_pos.py b/pos_alipay/models/alipay_pos.py index 3676f4e8..8dbe4d30 100644 --- a/pos_alipay/models/alipay_pos.py +++ b/pos_alipay/models/alipay_pos.py @@ -16,5 +16,8 @@ def _send_pos_notification(self): msg = self._prepare_message() assert self.pos_id, "The record has empty value of pos_id field" return self.env["pos.config"]._send_to_channel_by_id( - self._cr.dbname, self.pos_id.id, CHANNEL_ALIPAY, msg, + self._cr.dbname, + self.pos_id.id, + CHANNEL_ALIPAY, + msg, ) diff --git a/pos_alipay/security/alipay_security.xml b/pos_alipay/security/alipay_security.xml index 7ac15e25..bf6e22d2 100644 --- a/pos_alipay/security/alipay_security.xml +++ b/pos_alipay/security/alipay_security.xml @@ -4,13 +4,13 @@ - Mini-Program: mini-program user: read POS products only + + Mini-Program: mini-program user: read POS products only + - [('sale_ok', '=', True), ('available_in_pos', '=', True)] + + [('sale_ok', '=', True), ('available_in_pos', '=', True)] + diff --git a/pos_alipay/static/src/js/alipay.js b/pos_alipay/static/src/js/alipay.js index 8f09c0c0..6877a376 100644 --- a/pos_alipay/static/src/js/alipay.js +++ b/pos_alipay/static/src/js/alipay.js @@ -1,8 +1,6 @@ /* Copyright 2018 Ivan Yelizariev License MIT (https://opensource.org/licenses/MIT). */ -odoo.define("pos_alipay", function(require) { - "use strict"; - +odoo.define("pos_alipay", function (require) { require("pos_qr_scan"); require("pos_qr_show"); var rpc = require("web.rpc"); @@ -15,21 +13,21 @@ odoo.define("pos_alipay", function(require) { var PosModelSuper = models.PosModel; models.PosModel = models.PosModel.extend({ - initialize: function() { + initialize: function () { var self = this; PosModelSuper.prototype.initialize.apply(this, arguments); this.alipay = new exports.Alipay(this); this.bus.add_channel_callback("alipay", this.on_alipay, this); - this.ready.then(function() { + this.ready.then(function () { // Take out alipay scan cashregister from cashregisters to avoid // rendering in payment screent - self.scan_journal = self.hide_cashregister(function(r) { + self.scan_journal = self.hide_cashregister(function (r) { return r.alipay === "scan"; }); }); }, - scan_product: function(parsed_code) { + scan_product: function (parsed_code) { // TODO: do we need to make this optional? var value = parsed_code.code; if (this.alipay.check_auth_code(value)) { @@ -38,7 +36,7 @@ odoo.define("pos_alipay", function(require) { } return PosModelSuper.prototype.scan_product.apply(this, arguments); }, - on_alipay: function(msg) { + on_alipay: function (msg) { this.add_qr_payment( msg.order_ref, msg.journal_id, @@ -50,7 +48,7 @@ odoo.define("pos_alipay", function(require) { true ); }, - alipay_qr_payment: function(order, creg) { + alipay_qr_payment: function (order, creg) { /* Send request asynchronously */ var self = this; @@ -58,7 +56,7 @@ odoo.define("pos_alipay", function(require) { var terminal_ref = "POS/" + pos.config.name; var pos_id = pos.config.id; - var lines = order.orderlines.map(function(r) { + var lines = order.orderlines.map(function (r) { return { // Always use 1 because quantity is taken into account in price field quantity: 1, @@ -83,7 +81,7 @@ odoo.define("pos_alipay", function(require) { journal_id: creg.journal.id, }, }) - .then(function(data) { + .then(function (data) { if (data.code_url) { self.on_payment_qr(order, data.code_url); } else if (data.error) { @@ -97,7 +95,7 @@ odoo.define("pos_alipay", function(require) { var OrderSuper = models.Order; models.Order = models.Order.extend({ - add_paymentline: function(cashregister) { + add_paymentline: function (cashregister) { if (cashregister.journal.alipay === "show") { this.pos.alipay_qr_payment(this, cashregister); return; @@ -108,12 +106,12 @@ odoo.define("pos_alipay", function(require) { var PaymentlineSuper = models.Paymentline; models.Paymentline = models.Paymentline.extend({ - initialize: function(attributes, options) { + initialize: function (attributes, options) { PaymentlineSuper.prototype.initialize.apply(this, arguments); this.scan_id = options.scan_id; }, // TODO: do we need to extend init_from_JSON too ? - export_as_JSON: function() { + export_as_JSON: function () { var res = PaymentlineSuper.prototype.export_as_JSON.apply(this, arguments); res.scan_id = this.scan_id; return res; @@ -121,16 +119,16 @@ odoo.define("pos_alipay", function(require) { }); exports.Alipay = window.Backbone.Model.extend({ - initialize: function(pos) { + initialize: function (pos) { var self = this; this.pos = pos; - core.bus.on("qr_scanned", this, function(value) { + core.bus.on("qr_scanned", this, function (value) { if (self.check_auth_code(value)) { self.process_qr(value); } }); }, - check_auth_code: function(code) { + check_auth_code: function (code) { // TODO: do we need to integrate this with barcode.nomenclature? var beginning = code.substring(0, 2); if ( @@ -145,7 +143,7 @@ odoo.define("pos_alipay", function(require) { } return false; }, - process_qr: function(auth_code) { + process_qr: function (auth_code) { var order = this.pos.get_order(); if (!order) { return; @@ -153,14 +151,14 @@ odoo.define("pos_alipay", function(require) { // TODO: block order for editing this.scan(auth_code, order); }, - scan: function(auth_code, order) { + scan: function (auth_code, order) { /* Send request asynchronously */ var self = this; var terminal_ref = "POS/" + self.pos.config.name; var pos_id = self.pos.config.id; - var send_it = function() { + var send_it = function () { return rpc.query({ model: "alipay.order", method: "pos_create_from_qr", @@ -177,7 +175,7 @@ odoo.define("pos_alipay", function(require) { }; var current_send_number = 0; - return send_it().fail(function(error, e) { + return send_it().fail(function (error, e) { if (self.pos.debug) { console.log( "Alipay", diff --git a/pos_alipay/static/src/js/tour.js b/pos_alipay/static/src/js/tour.js index 65e800a0..aa68c973 100644 --- a/pos_alipay/static/src/js/tour.js +++ b/pos_alipay/static/src/js/tour.js @@ -3,9 +3,7 @@ /* This file is not used until we make a CI tool, that can run it. Normal CI cannot use longpolling. See https://github.com/odoo/odoo/commit/673f4aa4a77161dc58e0e1bf97e8f713b1e88491 */ -odoo.define("pos_alipay.tour", function(require) { - "use strict"; - +odoo.define("pos_alipay.tour", function (require) { var DUMMY_AUTH_CODE = "134579302432164181"; var tour = require("web_tour.tour"); var core = require("web.core"); @@ -62,7 +60,7 @@ odoo.define("pos_alipay.tour", function(require) { { content: "Make dummy action and trigger scanning event", trigger: ".order-button.selected", - run: function() { + run: function () { core.bus.trigger("qr_scanned", DUMMY_AUTH_CODE); }, }, @@ -72,7 +70,7 @@ odoo.define("pos_alipay.tour", function(require) { { content: "Screen is changed to payment screen", trigger: ".button_next", - run: function() { + run: function () { // No need to click on the button }, }, @@ -82,5 +80,5 @@ odoo.define("pos_alipay.tour", function(require) { trigger: ".button_print,.order-button", }, ]); - tour.register("tour_pos_debt_notebook", {test: true, url: "/web"}, steps); + tour.register("tour_pos_debt_notebook", { test: true, url: "/web" }, steps); }); diff --git a/pos_alipay/tests/test_alipay.py b/pos_alipay/tests/test_alipay.py index d35a95cf..c6c9cbb0 100644 --- a/pos_alipay/tests/test_alipay.py +++ b/pos_alipay/tests/test_alipay.py @@ -20,7 +20,9 @@ def setUp(self): # create alipay journals self.pos_config.init_pos_alipay_journals() - context = dict(app_private_key_string=DUMMY_RSA_KEY,) + context = dict( + app_private_key_string=DUMMY_RSA_KEY, + ) self.Config = self.env["ir.config_parameter"].with_context(context) self.Order = self.env["alipay.order"].with_context(context) diff --git a/pos_longpolling/external_tests/run.js b/pos_longpolling/external_tests/run.js index 316dcea2..be2c8c46 100644 --- a/pos_longpolling/external_tests/run.js +++ b/pos_longpolling/external_tests/run.js @@ -46,12 +46,12 @@ var pages = []; for (var i = 0; i < pages_num; i++) { var page = require("webpage").create(); - page.open(pos_url, function(status) { + page.open(pos_url, function (status) { console.log("Page #" + i + ": " + status); }); pages.push(page); } -setTimeout(function() { +setTimeout(function () { phantom.exit(); }, timeout * 1000); diff --git a/pos_longpolling/static/src/js/pos_longpolling.js b/pos_longpolling/static/src/js/pos_longpolling.js index 90bf82a3..bf16717c 100644 --- a/pos_longpolling/static/src/js/pos_longpolling.js +++ b/pos_longpolling/static/src/js/pos_longpolling.js @@ -1,5 +1,4 @@ -odoo.define("pos_longpolling", function(require) { - "use strict"; +odoo.define("pos_longpolling", function (require) { var exports = {}; var Backbone = window.Backbone; @@ -18,7 +17,7 @@ odoo.define("pos_longpolling", function(require) { bus_bus.bus.activated = true; bus_bus.Bus.include({ - init_bus: function(pos, sync_server) { + init_bus: function (pos, sync_server) { this.pos = pos; if (!this.channel_callbacks) { this.channel_callbacks = {}; @@ -37,14 +36,14 @@ odoo.define("pos_longpolling", function(require) { this.longpolling_connection ); }, - poll: function(address) { + poll: function (address) { var self = this; this.set_activated(true); var now = new Date().getTime(); var options = _.extend({}, this.options, { bus_inactivity: now - this.get_last_presence(), }); - var data = {channels: this.channels, last: this.last, options: options}; + var data = { channels: this.channels, last: this.last, options: options }; // Function is copy-pasted from bus.js but the line below defines a custom server address var serv_adr = address ? address.serv : this.serv_adr || ""; session @@ -53,7 +52,7 @@ odoo.define("pos_longpolling", function(require) { timeout: 60000, }) .then( - function(result) { + function (result) { self.on_notification(result); if (!self.stop) { self.poll(); @@ -63,7 +62,7 @@ odoo.define("pos_longpolling", function(require) { poll_connection.set_waiting_poll_response(false); poll_connection.network_is_on(); }, - function(unused, e) { + function (unused, e) { // Difference with original self.longpolling_connection.network_is_off(); // No error popup if request is interrupted or fails for any reason @@ -77,7 +76,7 @@ odoo.define("pos_longpolling", function(require) { } ); }, - check_sleep_mode: function() { + check_sleep_mode: function () { // Var hidden = ""; var visibilityChange = ""; var self = this; @@ -104,7 +103,7 @@ odoo.define("pos_longpolling", function(require) { document.addEventListener(visibilityChange, onVisibilityChange, false); } }, - add_channel_callback: function(channel_name, callback, thisArg) { + add_channel_callback: function (channel_name, callback, thisArg) { if (thisArg) { callback = _.bind(callback, thisArg); } @@ -116,14 +115,14 @@ odoo.define("pos_longpolling", function(require) { this.activate_channel(channel_name); } }, - remove_channel: function(channel_name) { + remove_channel: function (channel_name) { if (channel_name in this.channels) { delete this.channels[channel_name]; var channel = this.get_full_channel_name(channel_name); this.delete_channel(channel); } }, - start: function() { + start: function () { if (this.activated) { return; } @@ -131,11 +130,11 @@ odoo.define("pos_longpolling", function(require) { this.last = this.pos.db.load(this.bus_id_last(), 0); this.on("notification", this, this.on_notification_callback); this.stop_polling(); - _.each(self.channel_callbacks, function(value, key) { + _.each(self.channel_callbacks, function (value, key) { self.activate_channel(key); }); this.lonpolling_activated = true; - this.longpolling_connection.send_ping({serv: this.serv_adr}); + this.longpolling_connection.send_ping({ serv: this.serv_adr }); // One tab per browser is_master but we need to be able to poll with several tabs with odoo opened // https://github.com/odoo/odoo/blob/10.0/addons/bus/static/src/js/bus.js#L134 var is_master = this.is_master; @@ -146,11 +145,11 @@ odoo.define("pos_longpolling", function(require) { this.set_activated(true); this.check_sleep_mode(); }, - activate_channel: function(channel_name) { + activate_channel: function (channel_name) { var channel = this.get_full_channel_name(channel_name); this.add_channel(channel); }, - on_notification_callback: function(notification) { + on_notification_callback: function (notification) { for (var i = 0; i < notification.length; i++) { var channel = notification[i][0]; var message = notification[i][1]; @@ -158,10 +157,10 @@ odoo.define("pos_longpolling", function(require) { } this.pos.db.save(this.bus_id_last(), this.last); }, - bus_id_last: function() { + bus_id_last: function () { return "bus_" + this.bus_id + "last"; }, - on_notification_do: function(channel, message) { + on_notification_do: function (channel, message) { var self = this; if (_.isString(channel)) { channel = JSON.parse(channel); @@ -185,19 +184,19 @@ odoo.define("pos_longpolling", function(require) { crash_manager.show_error({ type: _t("Longpolling Handling Error"), message: _t("Longpolling Handling Error"), - data: {debug: err.stack}, + data: { debug: err.stack }, }); } } }, - get_full_channel_name: function(channel_name) { + get_full_channel_name: function (channel_name) { return JSON.stringify([ session.db, channel_name, String(this.pos.config.id), ]); }, - set_activated: function(is_online) { + set_activated: function (is_online) { if (this.activated === is_online) { return; } @@ -208,7 +207,7 @@ odoo.define("pos_longpolling", function(require) { var PosModelSuper = models.PosModel; models.PosModel = models.PosModel.extend({ - initialize: function() { + initialize: function () { var self = this; PosModelSuper.prototype.initialize.apply(this, arguments); this.buses = {}; @@ -216,19 +215,19 @@ odoo.define("pos_longpolling", function(require) { this.bus = bus_bus.bus; this.bus.lonpolling_activated = false; this.bus.name = "Default"; - this.ready.then(function() { + this.ready.then(function () { self.bus.init_bus(self); if (self.config.autostart_longpolling) { self.bus.start(); } }); }, - add_bus: function(key, sync_server) { + add_bus: function (key, sync_server) { this.buses[key] = new bus_bus.Bus(); this.buses[key].init_bus(this, sync_server); this.buses[key].name = key; }, - get_bus: function(key) { + get_bus: function (key) { if (key) { return this.buses[key]; } @@ -236,7 +235,7 @@ odoo.define("pos_longpolling", function(require) { }, }); exports.LongpollingConnection = Backbone.Model.extend({ - initialize: function(pos, bus) { + initialize: function (pos, bus) { this.pos = pos; this.timer = false; this.is_online = true; @@ -245,7 +244,7 @@ odoo.define("pos_longpolling", function(require) { this.response_status = false; this.set_waiting_poll_response(true); }, - network_is_on: function(message) { + network_is_on: function (message) { if (message) { this.response_status = true; } @@ -253,38 +252,38 @@ odoo.define("pos_longpolling", function(require) { this.set_is_online(true); this.bus.sleep = false; }, - network_is_off: function() { + network_is_off: function () { this.update_timer(); this.set_waiting_poll_response(true); this.set_is_online(false); }, - set_is_online: function(is_online) { + set_is_online: function (is_online) { if (this.is_online === is_online) { return; } this.is_online = is_online; this.trigger("change:poll_connection", is_online); }, - set_waiting_poll_response: function(status) { + set_waiting_poll_response: function (status) { if (this.waiting_poll_response === status) { return; } this.waiting_poll_response = status; this.trigger("change:poll_response", status); }, - update_timer: function() { + update_timer: function () { this.stop_timer(); this.start_timer(this.pos.config.longpolling_max_silence_timeout, "query"); }, - stop_timer: function() { + stop_timer: function () { if (this.timer) { clearTimeout(this.timer); this.timer = false; } }, - start_timer: function(time, type) { + start_timer: function (time, type) { var self = this; - this.timer = setTimeout(function() { + this.timer = setTimeout(function () { if (type === "query") { self.send_ping(); } else if (type === "response") { @@ -299,11 +298,11 @@ odoo.define("pos_longpolling", function(require) { } }, time * 1000); }, - response_timer: function() { + response_timer: function () { this.stop_timer(); this.start_timer(this.pos.config.longpolling_pong_timeout, "response"); }, - send_ping: function(address) { + send_ping: function (address) { var self = this; this.response_status = false; var serv_adr = address ? address.serv : this.pos.config.sync_server || ""; @@ -318,11 +317,15 @@ odoo.define("pos_longpolling", function(require) { return session .rpc( serv_adr + "/pos_longpolling/update", - {message: "PING", pos_id: self.pos.config.id, db_name: session.db}, - {timeout: 30000} + { + message: "PING", + pos_id: self.pos.config.id, + db_name: session.db, + }, + { timeout: 30000 } ) .then( - function() { + function () { /* If the value "response_status" is true, then the poll message came earlier if the value is false you need to start the response timer*/ self.set_is_online(true); @@ -330,7 +333,7 @@ odoo.define("pos_longpolling", function(require) { self.response_timer(); } }, - function(error, e) { + function (error, e) { e.preventDefault(); if (self.pos.debug) { console.log( @@ -347,7 +350,7 @@ odoo.define("pos_longpolling", function(require) { var Status_Widget = chrome.StatusWidget; Status_Widget.include({ - rerender_poll_status: function(current_bus) { + rerender_poll_status: function (current_bus) { var element = this.$el.find('div[bid="' + current_bus.bus_id + '"]'); if (current_bus.activated) { if (current_bus.longpolling_connection.is_online) { @@ -363,12 +366,12 @@ odoo.define("pos_longpolling", function(require) { this.set_icon_class(element, "oe_hidden"); } }, - set_icon_class: function(element, new_class) { + set_icon_class: function (element, new_class) { element .removeClass("oe_hidden oe_red oe_green oe_orange") .addClass(new_class); }, - icon_rotating: function(element, status) { + icon_rotating: function (element, status) { element.find("i").removeClass("fa-spin"); if (status) { element.find("i").addClass("fa-spin"); @@ -377,36 +380,36 @@ odoo.define("pos_longpolling", function(require) { }); chrome.SynchNotificationWidget.include({ - start: function() { + start: function () { this._super(); var element = this.$el.find(".serv_primary"); this.start_bus(this.pos.bus, element); this.start_additional_buses(); }, - start_bus: function(bus, element) { + start_bus: function (bus, element) { var self = this; element.attr("bid", bus.bus_id); this.rerender_poll_status(bus); bus.longpolling_connection.on( "change:poll_connection change:poll_response", - function(is_online) { + function (is_online) { self.rerender_poll_status(bus); } ); - element.on("click", function(event) { + element.on("click", function (event) { self.icon_rotating(element, true); bus.longpolling_connection - .send_ping({serv: bus.serv_adr}) - .always(function() { + .send_ping({ serv: bus.serv_adr }) + .always(function () { self.icon_rotating(element, false); }); }); }, - start_additional_buses: function() { + start_additional_buses: function () { var self = this; var sync_icon = QWeb.render("synch_icon", {}); var div = false; - _.each(this.pos.buses, function(b) { + _.each(this.pos.buses, function (b) { div = document.createElement("div"); div.innerHTML = sync_icon; var element = $(div); diff --git a/pos_longpolling/static/src/js/test_longpoll_pos.js b/pos_longpolling/static/src/js/test_longpoll_pos.js index 28e1fb38..235f997e 100644 --- a/pos_longpolling/static/src/js/test_longpoll_pos.js +++ b/pos_longpolling/static/src/js/test_longpoll_pos.js @@ -1,6 +1,4 @@ -odoo.define("pos_longpolling.tour", function(require) { - "use strict"; - +odoo.define("pos_longpolling.tour", function (require) { var tour = require("web_tour.tour"); var core = require("web.core"); var _t = core._t; @@ -29,5 +27,5 @@ odoo.define("pos_longpolling.tour", function(require) { }, ]; - tour.register("longpoll_connection_tour", {test: true, url: "/web"}, steps); + tour.register("longpoll_connection_tour", { test: true, url: "/web" }, steps); }); diff --git a/pos_qr_payments/static/src/js/pos_qr_payments.js b/pos_qr_payments/static/src/js/pos_qr_payments.js index d8de0169..4d2c6073 100644 --- a/pos_qr_payments/static/src/js/pos_qr_payments.js +++ b/pos_qr_payments/static/src/js/pos_qr_payments.js @@ -1,7 +1,6 @@ /* Copyright 2018 Ivan Yelizariev License MIT (https://opensource.org/licenses/MIT). */ -odoo.define("pos_qr_payments", function(require) { - "use strict"; +odoo.define("pos_qr_payments", function (require) { var gui = require("point_of_sale.gui"); var models = require("point_of_sale.models"); var core = require("web.core"); @@ -9,15 +8,15 @@ odoo.define("pos_qr_payments", function(require) { var _t = core._t; gui.Gui.prototype.screen_classes - .filter(function(el) { + .filter(function (el) { return el.name === "payment"; })[0] .widget.include({ - init: function(parent, options) { + init: function (parent, options) { this._super(parent, options); this.pos.bind( "validate_order", - function() { + function () { this.validate_order(); }, this @@ -27,31 +26,31 @@ odoo.define("pos_qr_payments", function(require) { var PosModelSuper = models.PosModel; models.PosModel = models.PosModel.extend({ - initialize: function() { + initialize: function () { this.hidden_cashregisters = []; return PosModelSuper.prototype.initialize.apply(this, arguments); }, - show_warning: function(warning_message) { + show_warning: function (warning_message) { console.info("error", warning_message); this.chrome.gui.show_popup("error", { title: _t("Warning"), body: warning_message, }); }, - add_qr_payment: function( + add_qr_payment: function ( order_uid, journal_id, amount, payment_vals, validate ) { - var order = this.get("orders").find(function(item) { + var order = this.get("orders").find(function (item) { return item.uid === order_uid; }); if (order) { var creg = _.filter( this.hidden_cashregisters.concat(this.cashregisters), - function(r) { + function (r) { return r.journal_id[0] === journal_id; } )[0]; diff --git a/pos_qr_scan/static/src/js/qr_scan.js b/pos_qr_scan/static/src/js/qr_scan.js index 41eb4ccc..b4314e58 100644 --- a/pos_qr_scan/static/src/js/qr_scan.js +++ b/pos_qr_scan/static/src/js/qr_scan.js @@ -3,9 +3,7 @@ License MIT (https://opensource.org/licenses/MIT). */ /* global posmodel, qrcode, success, error*/ /* eslint no-alert: "off"*/ -odoo.define("pos_qr_scan", function(require) { - "use strict"; - +odoo.define("pos_qr_scan", function (require) { var core = require("web.core"); var models = require("point_of_sale.models"); var gui = require("point_of_sale.gui"); @@ -14,7 +12,7 @@ odoo.define("pos_qr_scan", function(require) { var QrButton = screens.ActionButtonWidget.extend({ template: "QrButton", - button_click: function() { + button_click: function () { this.gui.show_popup("qr_scan", { title: "QR Scanning", value: false, @@ -29,22 +27,22 @@ odoo.define("pos_qr_scan", function(require) { var QrScanPopupWidget = PopupWidget.extend({ template: "QrScanPopupWidget", - show: function(options) { + show: function (options) { this.gUM = false; this._super(options); this.generate_qr_scanner(); }, - click_cancel: function() { + click_cancel: function () { this.stop_camera(); this._super(arguments); }, - stop_camera: function(camera) { + stop_camera: function (camera) { this.cam_is_on = false; if (this.stream) { this.stream.getTracks()[0].stop(); } }, - add_button: function(content) { + add_button: function (content) { var button = document.createElement("div"); button.className = "button qr-content"; button.innerHTML = content.name; @@ -52,44 +50,46 @@ odoo.define("pos_qr_scan", function(require) { button = $(".transparent_sidebar > .body").append(button); return button; }, - add_button_click: function(e) { + add_button_click: function (e) { var button = document.createElement("div"); var active_id = e.target.getAttribute("camera-id"); - this.start_webcam({deviceId: {exact: active_id}}); + this.start_webcam({ deviceId: { exact: active_id } }); this.pos.db.save("active_camera_id", active_id); return button; }, - get_camera_by_id: function(id) { - return _.find(this.video_devices, function(cam) { + get_camera_by_id: function (id) { + return _.find(this.video_devices, function (cam) { return cam.deviceId === id; }); }, - generate_qr_scanner: function() { + generate_qr_scanner: function () { var options = false; var self = this; this.video_element = document.getElementById("preview"); - $(this.video_element).on("click", function() { + $(this.video_element).on("click", function () { self.click_cancel(); }); if (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) { this.capture_timeout = 700; try { - navigator.mediaDevices.enumerateDevices().then(function(devices) { - self.video_devices = _.filter(devices, function(d) { + navigator.mediaDevices.enumerateDevices().then(function (devices) { + self.video_devices = _.filter(devices, function (d) { return d.kind === "videoinput"; }); - _.each(self.video_devices, function(device) { - options = options || {deviceId: {exact: device.deviceId}}; + _.each(self.video_devices, function (device) { + options = options || { + deviceId: { exact: device.deviceId }, + }; if (device.label.toLowerCase().search("back") > -1) { options = { - deviceId: {exact: device.deviceId}, + deviceId: { exact: device.deviceId }, facingMode: "environment", }; self.active_camera = device; } - self.add_button({name: device.label, id: device.deviceId}) + self.add_button({ name: device.label, id: device.deviceId }) .off() - .on("click", function(e) { + .on("click", function (e) { self.add_button_click(e); }); }); @@ -101,7 +101,7 @@ odoo.define("pos_qr_scan", function(require) { active_camera_id && self.get_camera_by_id(active_camera_id) ) { - options = {deviceId: {exact: active_camera_id}}; + options = { deviceId: { exact: active_camera_id } }; } self.start_webcam(options); }); @@ -114,7 +114,7 @@ odoo.define("pos_qr_scan", function(require) { } }, - read: function(result) { + read: function (result) { // Trigger event on scanning and close camera window if (this.pos.debug) { console.log("QR scanned", result); @@ -123,20 +123,20 @@ odoo.define("pos_qr_scan", function(require) { posmodel.gui.popup_instances.qr_scan.click_cancel(); }, - start_webcam: function(options) { + start_webcam: function (options) { var self = this; this.initCanvas(800, 600); - qrcode.callback = function(value) { + qrcode.callback = function (value) { self.read(value); }; if (navigator.mediaDevices.getUserMedia) { navigator.mediaDevices - .getUserMedia({video: options, audio: false}) - .then(function(stream) { + .getUserMedia({ video: options, audio: false }) + .then(function (stream) { self.stream = stream; self.success(stream); }) - .catch(function(error) { + .catch(function (error) { self.gui.show_popup("error-traceback", { title: error.name + " " + error.code, body: error.message, @@ -144,27 +144,31 @@ odoo.define("pos_qr_scan", function(require) { }); // Dont know for what this is needed } else if (navigator.getUserMedia) { - navigator.getUserMedia({video: options, audio: false}, success, error); + navigator.getUserMedia( + { video: options, audio: false }, + success, + error + ); } else if (navigator.webkitGetUserMedia) { navigator.webkitGetUserMedia( - {video: options, audio: false}, + { video: options, audio: false }, success, error ); } this.cam_is_on = true; - setTimeout(function() { + setTimeout(function () { self.captureToCanvas(); }, this.capture_timeout); }, - success: function(stream) { + success: function (stream) { this.video_element.srcObject = stream; this.video_element.play(); this.gUM = true; }, - captureToCanvas: function() { + captureToCanvas: function () { if (!this.cam_is_on) { return; } @@ -176,19 +180,19 @@ odoo.define("pos_qr_scan", function(require) { qrcode.decode(); } catch (e) { console.log(e); - setTimeout(function() { + setTimeout(function () { self.captureToCanvas(); }, this.capture_timeout); } } catch (e) { console.log(e); - setTimeout(function() { + setTimeout(function () { self.captureToCanvas(); }, this.capture_timeout); } } }, - initCanvas: function(w, h) { + initCanvas: function (w, h) { var gCanvas = document.getElementById("qr-canvas"); gCanvas.style.width = w + "px"; gCanvas.style.height = h + "px"; @@ -200,12 +204,12 @@ odoo.define("pos_qr_scan", function(require) { }, }); - gui.define_popup({name: "qr_scan", widget: QrScanPopupWidget}); + gui.define_popup({ name: "qr_scan", widget: QrScanPopupWidget }); // Add some helpers: // * No need to show Cashregister that is used by scanning QR customer's code models.PosModel = models.PosModel.extend({ - hide_cashregister: function(journal_filter) { + hide_cashregister: function (journal_filter) { var self = this; var journal = _.filter(this.journals, journal_filter); if (journal.length) { @@ -221,7 +225,7 @@ odoo.define("pos_qr_scan", function(require) { } else { return false; } - self.cashregisters = _.filter(self.cashregisters, function(r) { + self.cashregisters = _.filter(self.cashregisters, function (r) { if (r.journal_id[0] === journal.id) { self.hidden_cashregisters.push(r); return false; diff --git a/pos_qr_scan/static/src/xml/templates.xml b/pos_qr_scan/static/src/xml/templates.xml index 9c090012..8e5d2fbd 100644 --- a/pos_qr_scan/static/src/xml/templates.xml +++ b/pos_qr_scan/static/src/xml/templates.xml @@ -2,7 +2,8 @@
- QR Scan + + QR Scan
@@ -21,7 +22,7 @@
-

Tap on the video to quit

+

Tap on the video to quit

License MIT (https://opensource.org/licenses/MIT). */ -odoo.define("pos_qr_show", function(require) { - "use strict"; - +odoo.define("pos_qr_show", function (require) { var models = require("point_of_sale.models"); var PosModelSuper = models.PosModel; models.PosModel = models.PosModel.extend({ - on_payment_qr: function(order, payment_qr) { + on_payment_qr: function (order, payment_qr) { // TODO shall we save type of qr too? // TODO check that order is current order order.payment_qr = payment_qr; @@ -16,7 +14,7 @@ odoo.define("pos_qr_show", function(require) { this.send_current_order_to_customer_facing_display(); } }, - show_payment_qr_on_payment_screen: function(payment_qr) { + show_payment_qr_on_payment_screen: function (payment_qr) { this.hide_payment_qr_on_payment_screen(); /* EcLevel -- Error Correction Level L - Low (7%) @@ -32,10 +30,10 @@ odoo.define("pos_qr_show", function(require) { size: 400, }); }, - hide_payment_qr_on_payment_screen: function() { + hide_payment_qr_on_payment_screen: function () { $(".qr-container").empty(); }, - render_html_for_customer_facing_display: function() { + render_html_for_customer_facing_display: function () { var res = PosModelSuper.prototype.render_html_for_customer_facing_display.apply( this, arguments @@ -44,7 +42,7 @@ odoo.define("pos_qr_show", function(require) { if (!order || !order.payment_qr) { return res; } - return res.then(function(rendered_html) { + return res.then(function (rendered_html) { var $rendered_html = $(rendered_html); var $elem = $rendered_html.find(".pos-adv"); @@ -67,7 +65,7 @@ odoo.define("pos_qr_show", function(require) { // root element. rendered_html = _.reduce( $rendered_html, - function(memory, current_element) { + function (memory, current_element) { return memory + $(current_element).prop("outerHTML"); }, // Initial memory of "" diff --git a/pos_qr_show/static/src/xml/pos.xml b/pos_qr_show/static/src/xml/pos.xml index 9640cf52..95845245 100644 --- a/pos_qr_show/static/src/xml/pos.xml +++ b/pos_qr_show/static/src/xml/pos.xml @@ -5,6 +5,7 @@
+
diff --git a/pos_wechat/static/src/js/tour.js b/pos_wechat/static/src/js/tour.js index 2408cae5..bbe66056 100644 --- a/pos_wechat/static/src/js/tour.js +++ b/pos_wechat/static/src/js/tour.js @@ -3,9 +3,7 @@ /* This file is not used until we make a CI tool, that can run it. Normal CI cannot use longpolling. See https://github.com/odoo/odoo/commit/673f4aa4a77161dc58e0e1bf97e8f713b1e88491 */ -odoo.define("pos_wechat.tour", function(require) { - "use strict"; - +odoo.define("pos_wechat.tour", function (require) { var DUMMY_AUTH_CODE = "134579302432164181"; var tour = require("web_tour.tour"); var core = require("web.core"); @@ -62,7 +60,7 @@ odoo.define("pos_wechat.tour", function(require) { { content: "Make dummy action and trigger scanning event", trigger: ".order-button.selected", - run: function() { + run: function () { core.bus.trigger("qr_scanned", DUMMY_AUTH_CODE); }, }, @@ -72,7 +70,7 @@ odoo.define("pos_wechat.tour", function(require) { { content: "Screen is changed to payment screen", trigger: ".button_next", - run: function() { + run: function () { // No need to click on the button }, }, @@ -82,5 +80,5 @@ odoo.define("pos_wechat.tour", function(require) { trigger: ".button_print,.order-button", }, ]); - tour.register("tour_pos_debt_notebook", {test: true, url: "/web"}, steps); + tour.register("tour_pos_debt_notebook", { test: true, url: "/web" }, steps); }); diff --git a/pos_wechat/static/src/js/wechat_pay.js b/pos_wechat/static/src/js/wechat_pay.js index 1013f4f3..f86876f2 100644 --- a/pos_wechat/static/src/js/wechat_pay.js +++ b/pos_wechat/static/src/js/wechat_pay.js @@ -1,9 +1,7 @@ /* Copyright 2018 Ivan Yelizariev Copyright 2019 Kolushov Alexandr License MIT (https://opensource.org/licenses/MIT). */ -odoo.define("pos_wechat", function(require) { - "use strict"; - +odoo.define("pos_wechat", function (require) { require("pos_qr_scan"); require("pos_qr_show"); var rpc = require("web.rpc"); @@ -14,16 +12,16 @@ odoo.define("pos_wechat", function(require) { models.load_fields("account.journal", ["wechat"]); var Wechat = Backbone.Model.extend({ - initialize: function(pos) { + initialize: function (pos) { var self = this; this.pos = pos; - core.bus.on("qr_scanned", this, function(value) { + core.bus.on("qr_scanned", this, function (value) { if (self.check_auth_code(value)) { self.process_qr(value); } }); }, - check_is_integer: function(value) { + check_is_integer: function (value) { // Due to travis AssertionError: ('TypeError: undefined is not a function (evaluating "'Number.isInteger(code)')\n" return ( (Number.isInteger && Number.isInteger(value)) || @@ -32,7 +30,7 @@ odoo.define("pos_wechat", function(require) { Math.floor(value) === value) ); }, - check_auth_code: function(value) { + check_auth_code: function (value) { // TODO: do we need to integrate this with barcode.nomenclature? var code = Number(value); if ( @@ -47,7 +45,7 @@ odoo.define("pos_wechat", function(require) { } return false; }, - process_qr: function(auth_code) { + process_qr: function (auth_code) { var order = this.pos.get_order(); if (!order) { return; @@ -55,14 +53,14 @@ odoo.define("pos_wechat", function(require) { // TODO: block order for editing this.micropay(auth_code, order); }, - micropay: function(auth_code, order) { + micropay: function (auth_code, order) { /* Send request asynchronously */ var self = this; var terminal_ref = "POS/" + self.pos.config.name; var pos_id = self.pos.config.id; - var send_it = function() { + var send_it = function () { return rpc.query({ model: "wechat.micropay", method: "pos_create_from_qr", @@ -78,7 +76,7 @@ odoo.define("pos_wechat", function(require) { }; var current_send_number = 0; - return send_it().fail(function(error, e) { + return send_it().fail(function (error, e) { if (self.pos.debug) { console.log( "Wechat", @@ -94,21 +92,21 @@ odoo.define("pos_wechat", function(require) { var PosModelSuper = models.PosModel; models.PosModel = models.PosModel.extend({ - initialize: function() { + initialize: function () { var self = this; PosModelSuper.prototype.initialize.apply(this, arguments); this.wechat = new Wechat(this); this.bus.add_channel_callback("wechat", this.on_wechat, this); - this.ready.then(function() { + this.ready.then(function () { // Take out wechat micropay cashregister from cashregisters to avoid // rendering in payment screent - self.micropay_journal = self.hide_cashregister(function(r) { + self.micropay_journal = self.hide_cashregister(function (r) { return r.wechat === "micropay"; }); }); }, - scan_product: function(parsed_code) { + scan_product: function (parsed_code) { // TODO: do we need to make this optional? var value = parsed_code.code; if (this.wechat.check_auth_code(value)) { @@ -117,7 +115,7 @@ odoo.define("pos_wechat", function(require) { } return PosModelSuper.prototype.scan_product.apply(this, arguments); }, - on_wechat: function(msg) { + on_wechat: function (msg) { this.add_qr_payment( msg.order_ref, msg.journal_id, @@ -129,7 +127,7 @@ odoo.define("pos_wechat", function(require) { true ); }, - wechat_qr_payment: function(order, creg) { + wechat_qr_payment: function (order, creg) { /* Send request asynchronously */ var self = this; @@ -137,7 +135,7 @@ odoo.define("pos_wechat", function(require) { var terminal_ref = "POS/" + pos.config.name; var pos_id = pos.config.id; - var lines = order.orderlines.map(function(r) { + var lines = order.orderlines.map(function (r) { return { // Always use 1 because quantity is taken into account in price field quantity: 1, @@ -161,7 +159,7 @@ odoo.define("pos_wechat", function(require) { journal_id: creg.journal.id, }, }) - .then(function(data) { + .then(function (data) { if (data.code_url) { self.on_payment_qr(order, data.code_url); } else if (data.error) { @@ -175,7 +173,7 @@ odoo.define("pos_wechat", function(require) { var OrderSuper = models.Order; models.Order = models.Order.extend({ - add_paymentline: function(cashregister) { + add_paymentline: function (cashregister) { if (cashregister.journal.wechat === "native") { this.pos.wechat_qr_payment(this, cashregister); return; @@ -186,12 +184,12 @@ odoo.define("pos_wechat", function(require) { var PaymentlineSuper = models.Paymentline; models.Paymentline = models.Paymentline.extend({ - initialize: function(attributes, options) { + initialize: function (attributes, options) { PaymentlineSuper.prototype.initialize.apply(this, arguments); this.micropay_id = options.micropay_id; }, // TODO: do we need to extend init_from_JSON too ? - export_as_JSON: function() { + export_as_JSON: function () { var res = PaymentlineSuper.prototype.export_as_JSON.apply(this, arguments); res.micropay_id = this.micropay_id; return res; diff --git a/qcloud_sms/models/qcloud_sms.py b/qcloud_sms/models/qcloud_sms.py index ae21a4f4..a706e066 100644 --- a/qcloud_sms/models/qcloud_sms.py +++ b/qcloud_sms/models/qcloud_sms.py @@ -8,8 +8,8 @@ _logger = logging.getLogger(__name__) try: - from qcloudsms_py.httpclient import HTTPError import phonenumbers + from qcloudsms_py.httpclient import HTTPError except ImportError as err: _logger.debug(err) diff --git a/sms_sg/data.xml b/sms_sg/data.xml index 21d879c2..a4088cd3 100644 --- a/sms_sg/data.xml +++ b/sms_sg/data.xml @@ -4,11 +4,11 @@ smssg_user - testuser + testuser smssg_pwd - testpwd + testpwd diff --git a/sync/models/sync_job.py b/sync/models/sync_job.py index 38710e8c..c21711b5 100644 --- a/sync/models/sync_job.py +++ b/sync/models/sync_job.py @@ -59,7 +59,9 @@ class SyncJob(models.Model): ], compute="_compute_state", ) - in_progress = fields.Boolean(compute="_compute_state",) + in_progress = fields.Boolean( + compute="_compute_state", + ) @api.depends("queue_job_id.max_retries") def _compute_max_retries_str(self): diff --git a/sync/models/sync_project.py b/sync/models/sync_project.py index dfa67515..aee96002 100644 --- a/sync/models/sync_project.py +++ b/sync/models/sync_project.py @@ -80,6 +80,7 @@ def _compute_eval_context_description(self): for r in self: if not r.eval_context: r.eval_context_description = "" + continue method = getattr(self, EVAL_CONTEXT_PREFIX + r.eval_context) r.eval_context_description = method.__doc__ diff --git a/sync/models/sync_project_demo.py b/sync/models/sync_project_demo.py index 896034ca..4e0848c8 100644 --- a/sync/models/sync_project_demo.py +++ b/sync/models/sync_project_demo.py @@ -1,14 +1,11 @@ # Copyright 2020 Ivan Yelizariev # Copyright 2020 Denis Mudarisov # License MIT (https://opensource.org/licenses/MIT). - import json +import logging import xmlrpc.client as _client from math import sqrt -# https://github.com/python-telegram-bot/python-telegram-bot -from telegram import Bot, Update - from odoo import api, fields, models from odoo.exceptions import UserError from odoo.tools.translate import _ @@ -18,6 +15,13 @@ from .ir_logging import LOG_WARNING from .sync_project import AttrDict +_logger = logging.getLogger(__name__) +# https://github.com/python-telegram-bot/python-telegram-bot +try: + from telegram import Bot, Update # pylint: disable=missing-manifest-dependency +except ImportError as err: + _logger.debug(err) + class SyncProjectDemo(models.Model): @@ -81,9 +85,10 @@ def _eval_context_telegram(self, secrets, eval_context): * telegram.setWebhook * telegram.parse_data """ - from odoo.tools import html2plaintext from lxml.html.clean import Cleaner + from odoo.tools import html2plaintext + log_transmission = eval_context["log_transmission"] if secrets.TELEGRAM_BOT_TOKEN: @@ -151,7 +156,8 @@ def _trello(secrets): from trello.exceptions import ResourceUnavailable client = TrelloClient( - api_key=secrets.TRELLO_KEY, api_secret=secrets.TRELLO_TOKEN, + api_key=secrets.TRELLO_KEY, + api_secret=secrets.TRELLO_TOKEN, ) board = client.get_board(secrets.TRELLO_BOARD_ID) diff --git a/sync/security/sync_groups.xml b/sync/security/sync_groups.xml index f003cb4e..9c806488 100644 --- a/sync/security/sync_groups.xml +++ b/sync/security/sync_groups.xml @@ -5,7 +5,8 @@ Sync Studio - User: read-only access; + + User: read-only access; Developer: restricted write access; Manager: same as Developer, but access to secure staff. diff --git a/sync/wizard/sync_make_module.py b/sync/wizard/sync_make_module.py index e7bbe3c6..f0c8d671 100644 --- a/sync/wizard/sync_make_module.py +++ b/sync/wizard/sync_make_module.py @@ -69,11 +69,13 @@ def act_makefile(self): self.env["ir.config_parameter"].set_param(PARAM_URL, self.author_url) url = " <{}>".format(self.author_url) if self.author_url else "" - copyright_str = "".format( - years=self.copyright_years, - name=self.author_name, - url=url, - license_line=self.license_line, + copyright_str = ( + "".format( + years=self.copyright_years, + name=self.author_name, + url=url, + license_line=self.license_line, + ) ) root = etree.Element("odoo") project = self.project_id.with_context(active_test=False) diff --git a/wechat/models/wechat_order.py b/wechat/models/wechat_order.py index e29d85f5..3d5d2dd8 100644 --- a/wechat/models/wechat_order.py +++ b/wechat/models/wechat_order.py @@ -21,7 +21,7 @@ class WeChatOrder(models.Model): """Records with order information and payment status. - Can be used for different types of Payments. See description of trade_type field. """ + Can be used for different types of Payments. See description of trade_type field.""" _name = "wechat.order" _description = "Unified Order" @@ -82,7 +82,7 @@ def _compute_refund_fee(self): ) def _body(self): - """ Example of result: + """Example of result: {"goods_detail": [ { diff --git a/wechat/models/wechat_refund.py b/wechat/models/wechat_refund.py index 21b94332..a2eb9b03 100644 --- a/wechat/models/wechat_refund.py +++ b/wechat/models/wechat_refund.py @@ -13,7 +13,7 @@ class WeChatRefund(models.Model): """Records with refund information and payment status. - Can be used for different types of Payments. See description of trade_type field. """ + Can be used for different types of Payments. See description of trade_type field.""" _name = "wechat.refund" _description = "Unified Refund"