From 7bd08a0951fea53c6e0d986481c24b17bdb1e5bd Mon Sep 17 00:00:00 2001 From: Riddhi Kansara Date: Fri, 6 Jul 2018 10:17:48 +0530 Subject: [PATCH 1/8] [ADD]Added Upstream Patch for l10n_be_hr_payroll module. --- addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_data.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_data.xml b/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_data.xml index bd88ef69..ee60b5cc 100644 --- a/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_data.xml +++ b/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_data.xml @@ -160,7 +160,7 @@ elif salary <= 2510.47: 165 python - result = (((employee.marital in ['divorced', 'single', 'widower']) or (employee.marital=='married' and employee.spouse_fiscal_status=='without income')) and (employee.resident_bool!=True)) + result = (((employee.marital in ['divorced', 'single', 'widower']) or (employee.marital in ['married', 'cohabitant'] and employee.spouse_fiscal_status=='without income')) and (employee.resident_bool!=True)) code wage = categories.BASIC From f6612b79dbe3d98f674bb60f7fb1911e7c299c06 Mon Sep 17 00:00:00 2001 From: Riddhi Kansara Date: Fri, 6 Jul 2018 11:43:14 +0530 Subject: [PATCH 2/8] [ADD]Added Upstream Patch for l10n_be_hr_payroll_fleet module. --- addons/l10n_be_hr_payroll_fleet/models/fleet.py | 3 ++- addons/l10n_be_hr_payroll_fleet/models/hr_contract.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/l10n_be_hr_payroll_fleet/models/fleet.py b/addons/l10n_be_hr_payroll_fleet/models/fleet.py index 543c4b72..372b3b3a 100644 --- a/addons/l10n_be_hr_payroll_fleet/models/fleet.py +++ b/addons/l10n_be_hr_payroll_fleet/models/fleet.py @@ -13,7 +13,8 @@ class FleetVehicle(models.Model): co2_fee = fields.Float(compute='_compute_co2_fee', string="CO2 Fee") total_depreciated_cost = fields.Float(compute='_compute_total_depreciated_cost', - string="Total Cost (Depreciated)", help="This includes all the depreciated costs and the CO2 fee") + string="Total Cost (Depreciated)", track_visibility="onchange", + help="This includes all the depreciated costs and the CO2 fee") total_cost = fields.Float(compute='_compute_total_cost', string="Total Cost", help="This include all the costs and the CO2 fee") fuel_type = fields.Selection(required=True, default='diesel') atn = fields.Float(compute='_compute_car_atn', string="ATN") diff --git a/addons/l10n_be_hr_payroll_fleet/models/hr_contract.py b/addons/l10n_be_hr_payroll_fleet/models/hr_contract.py index 26bd27ad..ebb2349d 100644 --- a/addons/l10n_be_hr_payroll_fleet/models/hr_contract.py +++ b/addons/l10n_be_hr_payroll_fleet/models/hr_contract.py @@ -25,7 +25,7 @@ class HrContract(models.Model): 'car_id.log_contracts.recurring_cost_amount_depreciated') # the fleet vehicle to avoid these dependencies def _compute_car_atn_and_costs(self): for contract in self: - if contract.car_id: + if not contract.new_car and contract.car_id: contract.car_atn = contract.car_id.atn contract.company_car_total_depreciated_cost = contract.car_id.total_depreciated_cost elif contract.new_car and contract.new_car_model_id: From 268fefd28b9c03ce14791c10c73f98b74ba5c265 Mon Sep 17 00:00:00 2001 From: Riddhi Kansara Date: Tue, 10 Jul 2018 13:36:16 +0530 Subject: [PATCH 3/8] [ADD]Added Upstream Patch for hw_scanner module. --- addons/hw_scanner/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hw_scanner/controllers/main.py b/addons/hw_scanner/controllers/main.py index b5b63608..c1bb85f3 100644 --- a/addons/hw_scanner/controllers/main.py +++ b/addons/hw_scanner/controllers/main.py @@ -4,7 +4,7 @@ import logging import time from os import listdir -from os.path import join +from os.path import join, isdir try: from queue import Queue, Empty except ImportError: From c055a18ec04d342eb756c1ca2149fc5c8d428ad5 Mon Sep 17 00:00:00 2001 From: Riddhi Kansara Date: Tue, 10 Jul 2018 13:55:23 +0530 Subject: [PATCH 4/8] [ADD]Added Upstream Patch for l10n_be_hr_payroll module. --- .../l10n_be_hr_payroll/views/l10n_be_hr_payroll_view.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/l10n_be_hr_payroll/views/l10n_be_hr_payroll_view.xml b/addons/l10n_be_hr_payroll/views/l10n_be_hr_payroll_view.xml index 400cab2b..939a7d40 100644 --- a/addons/l10n_be_hr_payroll/views/l10n_be_hr_payroll_view.xml +++ b/addons/l10n_be_hr_payroll/views/l10n_be_hr_payroll_view.xml @@ -131,8 +131,8 @@ - - + + @@ -148,8 +148,8 @@ - - + + From 68d53a77cba850556ef5af8f2d30107b6a956669 Mon Sep 17 00:00:00 2001 From: Riddhi Kansara Date: Thu, 19 Jul 2018 16:42:36 +0530 Subject: [PATCH 5/8] [ADD]Added Upstream Patch for board module --- addons/board/static/src/js/dashboard.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/addons/board/static/src/js/dashboard.js b/addons/board/static/src/js/dashboard.js index 855dc03d..5fce73ae 100644 --- a/addons/board/static/src/js/dashboard.js +++ b/addons/board/static/src/js/dashboard.js @@ -131,6 +131,9 @@ FormRenderer.include({ 'click .oe_dashboard_link_change_layout': '_onChangeLayout', 'click .oe_dashboard_column .oe_close': '_onCloseAction', }), + custom_events: _.extend({}, FormRenderer.prototype.custom_events, { + switch_view: '_onSwitchView', + }), /** * @override @@ -140,6 +143,7 @@ FormRenderer.include({ this.noContentHelp = params.noContentHelp; this.actionsDescr = {}; this._boardSubcontrollers = []; // for board: controllers of subviews + this._boardFormViewIDs = {}; // for board: mapping subview controller to form view id }, /** * Call `on_attach_callback` for each subview @@ -266,6 +270,11 @@ FormRenderer.include({ hasSelectors: false, }); return view.getController(self).then(function (controller) { + self._boardFormViewIDs[controller.handle] = _.first( + _.find(action.views, function (descr) { + return descr[1] === 'form'; + }) + ); self._boardSubcontrollers.push(controller); return controller.appendTo(params.$node); }); @@ -384,6 +393,16 @@ FormRenderer.include({ $action.find('.oe_content').toggle(); this.trigger_up('save_dashboard'); }, + /** + * Let FormController know which form view it should display based on the + * window action of the sub controller that is switching view + * + * @private + * @param {OdooEvent} event + */ + _onSwitchView: function (event) { + event.data.formViewID = this._boardFormViewIDs[event.target.handle]; + }, }); }); From bbce466361634d0ae4a1a53fc423789ab6780924 Mon Sep 17 00:00:00 2001 From: Riddhi Kansara Date: Thu, 19 Jul 2018 16:51:45 +0530 Subject: [PATCH 6/8] [ADD]Added Upstream Patch for board module --- addons/board/static/tests/dashboard_tests.js | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/addons/board/static/tests/dashboard_tests.js b/addons/board/static/tests/dashboard_tests.js index 5b9e05cc..b6910c7c 100644 --- a/addons/board/static/tests/dashboard_tests.js +++ b/addons/board/static/tests/dashboard_tests.js @@ -272,6 +272,51 @@ QUnit.test('can open a record', function (assert) { form.destroy(); }); +QUnit.test('can open record using action form view', function (assert) { + assert.expect(1); + + var form = createView({ + View: FormView, + model: 'board', + data: this.data, + arch: '
' + + '' + + '' + + '' + + '' + + '' + + '
', + mockRPC: function (route) { + if (route === '/web/action/load') { + return $.when({ + res_model: 'partner', + views: [[4, 'list'], [5, 'form']], + }); + } + return this._super.apply(this, arguments); + }, + archs: { + 'partner,4,list': + '', + 'partner,5,form': + '
', + }, + intercepts: { + do_action: function (event) { + assert.deepEqual(event.data.action, { + res_id: 1, + res_model: 'partner', + type: 'ir.actions.act_window', + views: [[5, 'form']], + }, "should do a do_action with correct parameters"); + }, + }, + }); + + form.$('tr.o_data_row td:contains(yop)').click(); + form.destroy(); +}); + QUnit.test('can drag and drop a view', function (assert) { assert.expect(4); From 1260eab56605f4935d3b3cb01160d26ea30da118 Mon Sep 17 00:00:00 2001 From: Riddhi Kansara Date: Thu, 19 Jul 2018 17:04:30 +0530 Subject: [PATCH 7/8] [ADD]Added Upstream Patch for hw_proxy module --- addons/hw_proxy/controllers/main.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py index 7c7020e1..64e7b009 100644 --- a/addons/hw_proxy/controllers/main.py +++ b/addons/hw_proxy/controllers/main.py @@ -21,6 +21,8 @@ BANNED_DEVICES = { "0424:9514", # Standard Microsystem Corp. Builtin Ethernet module "1d6b:0002", # Linux Foundation 2.0 root hub "0424:ec00", # Standard Microsystem Corp. Other Builtin Ethernet module + "0424:2514", # Standard Microsystems Corp. USB 2.0 Hub (rpi3b+) + "0424:7800", # Standard Microsystems Corp. (rpi3b+) } @@ -100,15 +102,16 @@ class Proxy(http.Controller): """ if debug is None: resp += """(debug version)""" - devices = subprocess.check_output("lsusb").split('\n') + devices = subprocess.check_output("lsusb").decode('utf-8').split('\n') count = 0 resp += "
\n" for device in devices: device_name = device[device.find('ID')+2:] - device_id = device_name.split()[0] - if not (device_id in BANNED_DEVICES): - resp += "
"+device_name+"
\n" - count += 1 + if device_name: # to avoid last empty line + device_id = device_name.split()[0] + if not (device_id in BANNED_DEVICES): + resp += "
"+device_name+"
\n" + count += 1 if count == 0: resp += "
No USB Device Found
" @@ -124,7 +127,7 @@ class Proxy(http.Controller): %s - """ % subprocess.check_output('lsusb -v', shell=True) + """ % subprocess.check_output('lsusb -v', shell=True).decode('utf-8') return request.make_response(resp,{ 'Cache-Control': 'no-cache', From 1a1e197981f095c51f5f2a0f3beb396653ea2620 Mon Sep 17 00:00:00 2001 From: Riddhi Kansara Date: Thu, 19 Jul 2018 17:13:31 +0530 Subject: [PATCH 8/8] [ADD]Added Upstream Patch for hw_scale module --- addons/hw_scale/controllers/main.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/addons/hw_scale/controllers/main.py b/addons/hw_scale/controllers/main.py index 6d1a4e7d..8fdb6c6e 100644 --- a/addons/hw_scale/controllers/main.py +++ b/addons/hw_scale/controllers/main.py @@ -28,7 +28,7 @@ except ImportError: def _toledo8217StatusParse(status): """ Parse a scale's status, returning a `(weight, weight_info)` pair. """ weight, weight_info = None, None - stat = ord(status[status.index('?') + 1]) + stat = status[status.index(b'?') + 1] if stat == 0: weight_info = 'ok' else: @@ -68,17 +68,17 @@ Toledo8217Protocol = ScaleProtocol( parity=serial.PARITY_EVEN, timeout=1, writeTimeout=1, - weightRegexp="\x02\\s*([0-9.]+)N?\\r", - statusRegexp="\x02\\s*(\\?.)\\r", + weightRegexp=b"\x02\\s*([0-9.]+)N?\\r", + statusRegexp=b"\x02\\s*(\\?.)\\r", statusParse=_toledo8217StatusParse, commandDelay=0.2, weightDelay=0.5, newWeightDelay=0.2, - commandTerminator='', - weightCommand='W', - zeroCommand='Z', - tareCommand='T', - clearCommand='C', + commandTerminator=b'', + weightCommand=b'W', + zeroCommand=b'Z', + tareCommand=b'T', + clearCommand=b'C', emptyAnswerValid=False, autoResetWeight=False, ) @@ -98,15 +98,15 @@ ADAMEquipmentProtocol = ScaleProtocol( weightRegexp=r"\s*([0-9.]+)kg", # LABEL format 3 + KG in the scale settings, but Label 1/2 should work statusRegexp=None, statusParse=None, - commandTerminator="\r\n", + commandTerminator=b"\r\n", commandDelay=0.2, weightDelay=0.5, newWeightDelay=5, # AZExtra beeps every time you ask for a weight that was previously returned! # Adding an extra delay gives the operator a chance to remove the products # before the scale starts beeping. Could not find a way to disable the beeps. - weightCommand='P', - zeroCommand='Z', - tareCommand='T', + weightCommand=b'P', + zeroCommand=b'Z', + tareCommand=b'T', clearCommand=None, # No clear command -> Tare again emptyAnswerValid=True, # AZExtra does not answer unless a new non-zero weight has been detected autoResetWeight=True, # AZExtra will not return 0 after removing products @@ -165,8 +165,8 @@ class Scale(Thread): if not char: break else: - answer.append(char) - return ''.join(answer) + answer.append(bytes(char)) + return b''.join(answer) def _parse_weight_answer(self, protocol, answer): """ Parse a scale's answer to a weighing request, returning