From de1e2cf038b953ac2b257dd4cf7860a9d61c6a17 Mon Sep 17 00:00:00 2001
From: "Andrea Grazioso (agr-odoo)" <agr@odoo.com>
Date: Fri, 18 Oct 2019 11:34:06 +0000
Subject: [PATCH] [FIX] point_of_sale: User associated with non-existing
 Employee

* Install pos_hr
* Create new user [DEMO] (change password and save the user id)
* In POS session settings, uncheck "Login with Employees"
* Log in with [DEMO]
* Start a new POS session
* From the Employee page delete the record matching [DEMO] user id
* Process a transaction from the POS

Several error message will popup. This is due to
https://github.com/odoo/odoo/commit/26274dbb9720743461be2a70de02bf4c1ea377f4
which introduced a faulty matching between the id of user who start the pos
and an employee with the same id.
Assigning the single properties as before the change fix the issue

opw-2087591

closes odoo/odoo#39052

X-original-commit: c51e91cd755a3dc48bb41378528a39e0df434eab
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
---
 addons/point_of_sale/static/src/js/models.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 47c8fc191384..a8de515d5753 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -307,7 +307,8 @@ exports.PosModel = Backbone.Model.extend({
                 });
                 if (user.id === session.uid) {
                     self.user = user;
-                    self.employee = user;
+                    self.employee.name = user.name;
+                    self.employee.role = user.role;
                     self.employee.user_id = [user.id, user.name];
                 }
             });
-- 
GitLab