[FIX] pos_hr: update order's cashier on validation

Module `pos_hr` allows to switch between cashiers (`hr.employee`) during the
same POS session. The current cashier is printed on receipt and saved in
backend. The story becomes more complicated if order is created by one
cashier (e.g. Mitchel Admin), but validated by another (e.g. Mark Demo). In that
case both receipt and backend must show the cashier who validated the
order (i.e. Mark Demo). However, it wasn't the case before this patch: the receipt got Mark
Demo as cashier and Mitchel Admin was saved in backend.

Fix it by updating employee value on order validation.

opw-2855234

closes odoo/odoo#92549

X-original-commit: b06c9793e13570bc84b1ddb52051e9fb039bc2c8
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
This commit is contained in:
Ivan Yelizariev
2022-06-02 16:54:06 +02:00
parent ef573c692d
commit 7db57de5d8
2 changed files with 19 additions and 0 deletions
+1
View File
@@ -29,6 +29,7 @@ The actual till still requires one user but an unlimited number of employees can
'pos_hr/static/src/js/HeaderLockButton.js',
'pos_hr/static/src/js/CashierName.js',
'pos_hr/static/src/js/LoginScreen.js',
'pos_hr/static/src/js/PaymentScreen.js',
],
'web.assets_tests': [
'pos_hr/static/tests/**/*',
@@ -0,0 +1,18 @@
odoo.define('pos_hr.PaymentScreen', function (require) {
'use strict';
const PaymentScreen = require('point_of_sale.PaymentScreen');
const Registries = require('point_of_sale.Registries');
const PosHrPaymentScreen = (PaymentScreen_) =>
class extends PaymentScreen_ {
async _finalizeValidation() {
this.currentOrder.employee = this.env.pos.get_cashier();
await super._finalizeValidation();
}
};
Registries.Component.extend(PaymentScreen, PosHrPaymentScreen);
return PaymentScreen;
});