diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js index 52bbc044d1f..08c4a6d1923 100644 --- a/addons/web/static/src/js/views/form/form_renderer.js +++ b/addons/web/static/src/js/views/form/form_renderer.js @@ -312,30 +312,6 @@ var FormRenderer = BasicRenderer.extend({ }); }); }, - /** - * Enable swipe event to allow navigating through records - * - * @private - */ - _enableSwipe: function () { - var self = this; - this.$('.o_form_sheet').swipe({ - swipeLeft: function () { - this.css({ - transform: 'translateX(-100%)', - transition: '350ms' - }); - self.trigger_up('swipe_left'); - }, - swipeRight: function () { - this.css({ - transform: 'translateX(100%)', - transition: '350ms' - }); - self.trigger_up('swipe_right'); - }, - }); - }, /** * @private * @param {string} name @@ -943,11 +919,6 @@ var FormRenderer = BasicRenderer.extend({ this.$el.toggleClass('o_form_editable', this.mode === 'edit'); this.$el.toggleClass('o_form_readonly', this.mode === 'readonly'); - // Enable swipe for mobile when formview is in readonly mode and there are multiple records - if (config.device.isMobile && this.mode === 'readonly' && this.state.count > 1) { - this._enableSwipe(); - } - // Attach the tooltips on the fields' label _.each(this.allFieldWidgets[this.state.id], function (widget) { var idForLabel = self.idsForLabels[widget.name]; diff --git a/addons/web/static/tests/views/form_mobile_tests.js b/addons/web/static/tests/views/form_mobile_tests.js deleted file mode 100644 index 05a19a27668..00000000000 --- a/addons/web/static/tests/views/form_mobile_tests.js +++ /dev/null @@ -1,92 +0,0 @@ -odoo.define('web.form_mobile_tests', function (require) { -"use strict"; - -var FormView = require('web.FormView'); -var testUtils = require('web.test_utils'); - -var createView = testUtils.createView; - -QUnit.module('Views', { - beforeEach: function () { - this.data = { - partner: { - fields: { - display_name: { string: "Displayed name", type: "char" }, - foo: {string: "Foo", type: "char", default: "My little Foo Value"}, - bar: {string: "Bar", type: "boolean"}, - }, - records: [{ - id: 1, - display_name: "first record", - bar: true, - foo: "yop", - }, { - id: 2, - display_name: "second record", - bar: true, - foo: "blip", - }, { - id: 4, - display_name: "aaa", - state: "ef", - }, { - id: 5, - display_name: "aaa", - foo:'', - bar: false, - }], - onchanges: {}, - }, - }; - } -}, function () { - - QUnit.module('FormView'); - - QUnit.test('switching to next/previous record on swipe in readonly mode', function (assert) { - assert.expect(6); - - // mimic touchSwipe library's swipe method - var oldSwipe = $.fn.swipe; - var swipeLeft, swipeRight; - $.fn.swipe = function (params) { - swipeLeft = params.swipeLeft.bind(this); - swipeRight = params.swipeRight.bind(this); - }; - - var form = createView({ - View: FormView, - model: 'partner', - data: this.data, - arch: '
' + - '' + - '' + - '' + - '
', - viewOptions: { - ids: [1, 2], - index: 0, - }, - res_id: 1, - mockRPC: function (route, args) { - if (route === '/web/dataset/call_kw/partner/read') { - assert.step(args.args[0][0]); - } - return this._super(route, args); - }, - }); - - swipeLeft(); - assert.strictEqual(form.pager.$('.o_pager_value').text(), '2', 'pager value should be 2'); - - swipeRight(); - assert.strictEqual(form.pager.$('.o_pager_value').text(), '1', 'pager value should be 1'); - - assert.verifySteps([1, 2, 1]); - - $.fn.swipe = oldSwipe; - form.destroy(); - }); -}); - -}); diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index b4c0b3cbd53..c42c547c0a7 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -626,7 +626,6 @@ -