summaryrefslogtreecommitdiff
path: root/addons/pos_hr
diff options
context:
space:
mode:
authorJoseph Caburnay <jcb@odoo.com>2021-02-17 08:22:48 +0000
committerJoseph Caburnay <jcb@odoo.com>2021-02-17 08:33:56 +0000
commit176046304cc21daa839290df070170fa6ce2509d (patch)
treee024a4d96859fd4949ae58bcd119bb5dc04a106b /addons/pos_hr
parentff44dbf31a3732a8ebced7ff907fff3b2440afc4 (diff)
[FIX] pos_hr: loading crash when employee record is deleted
To reproduce: 0. Login as admin. 1. Install pos_hr. 2. Open a pos session without activating the Authorized employees feature. 3. Make an order as Mitchell admin but **don't** validate, order is just in the localStorage. 4. Go back to the backend (without closing the browser). 5. Close the session. 6. Edit the pos config and activate authorized employees. 7. Delete the employee record linked to the admin user. 8. Open a new session using the modified pos config. 9. [Crash] Because of missing employee. Solution: We just make sure to prevent field access on missing undefined object. closes odoo/odoo#66319 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons/pos_hr')
-rw-r--r--addons/pos_hr/static/src/js/models.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/pos_hr/static/src/js/models.js b/addons/pos_hr/static/src/js/models.js
index 52ada147840..9b4c8f4aff1 100644
--- a/addons/pos_hr/static/src/js/models.js
+++ b/addons/pos_hr/static/src/js/models.js
@@ -88,7 +88,7 @@ models.Order = models.Order.extend({
export_as_JSON: function () {
const json = super_order_model.export_as_JSON.apply(this, arguments);
if (this.pos.config.module_pos_hr) {
- json.employee_id = this.employee.id;
+ json.employee_id = this.employee ? this.employee.id : false;
}
return json;
},