diff --git a/__manifest__.py b/__manifest__.py index 52fdc72..5837c07 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -19,7 +19,7 @@ Key Features: - **Odoo Branding**: Removes the "Powered by Odoo" text in the receipt footer. - **Print Margin**: Removes the top, right, and bottom margins from the print page, ensuring the content aligns closely with the paper edges while keeping the default left margin. """, - 'depends': ['point_of_sale', 'pos_restaurant'], + 'depends': ['point_of_sale', 'pos_restaurant', 'pos_hr'], 'data': [], 'assets': { 'point_of_sale._assets_pos': [ diff --git a/static/src/js/orderline.js b/static/src/js/orderline.js index f76946c..31fba7a 100644 --- a/static/src/js/orderline.js +++ b/static/src/js/orderline.js @@ -22,7 +22,21 @@ patch(Orderline.prototype, { patch(PosOrder.prototype, { getCashierName() { - const employee = this.employee_id || this.original_employee_id || this.user_id; + const pos = this.pos || this.models?.env?.services?.pos; + let employee = this.employee_id || this.original_employee_id || this.user_id || null; + + // If employee is just an ID/number, look up the record from the POS store models + if (employee && (typeof employee === 'number' || typeof employee === 'string')) { + const empId = parseInt(employee); + if (pos && pos.models && pos.models['hr.employee']) { + employee = pos.models['hr.employee'].get(empId) || { name: `Employee ${empId}` }; + } else if (pos && pos.employees) { + employee = pos.employees.find(e => e.id === empId) || { name: `Employee ${empId}` }; + } else { + employee = { name: `Employee ${empId}` }; + } + } + const name = employee ? (employee.name || "") : ""; if (!name) { return "";