Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

New employee Button in POS

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
Odoo17
2362 Vistas
Avatar
jenan soliman

Hello,


I have customized POS screen and I want to add button to select many2many employee when click on the button , the list to slect the employee did not appear the UI, here's the code:

/** @odoo-module **/ 

import { _t } from "@web/core/l10n/translation" ;
import { useBus, useService } from "@web/core/utils/hooks" ;
import { EventBus } from "@odoo/owl" ;
import { registry } from "@web/core/registry" ;
import { ControlButtonsMixin } from "@point_of_sale/app/utils/control_buttons_mixin" ;
import { SelectionPopup } from "@point_of_sale/app/utils/input_popups/selection_popup" ;
import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup" ;
import { ConfirmPopup } from "@point_of_sale/app/utils/confirm_popup/confirm_popup" ;
import { Component, onMounted, useRef } from "@odoo/owl" ;
import { usePos } from "@point_of_sale/app/store/pos_hook" ;
import { AppointmentList } from "@plnx_pos_appointment/app/appointment_screen/appointment_list/appointment_list" ;
import { AppointmentManagementControlPanel } from "@plnx_pos_appointment/app/appointment_screen/appointment_management_control_panel/appointment_management_control_panel" ;





export class EmployeeSelectionScreen extends ControlButtonsMixin(Component) {
static storeOnOrder = false ;
static template = "plnx_pos_appointment.EmployeeSelectionScreen" ;

setup() {
super.setup();
this .pos = usePos();
this .popup = useService( "popup" );
this .orm = useService( "orm" );
this .root = useRef( "root" );
this .numberBuffer = useService( "number_buffer" );
this .selectedEmployees = [];
this .employees = []; // Initialize employees as an empty array
this .employeeFetcher = useService( "employee_fetcher" );
useBus( this .employeeFetcher, "update" , this .render);
this .toggleEmployeeSelection = this .toggleEmployeeSelection.bind( this );
this .confirmSelection = this .confirmSelection.bind( this );

console.log( "POS Context:" , this .pos);

onMounted(() => {
this .fetchEmployees(); // Fetch employees when mounted
});
}




async fetchEmployees() {
try {
this .employees = await this .employeeFetcher.fetchEmployees();
console.log( "Fetched Employees:" , this .employees);
this .render();
} catch (error) {
console.error( "Error fetching employees:" , error);
}
}

toggleEmployeeSelection(employeeId) {
const index = this .state.selectedEmployeees.indexOf(employeeId);
if (index > - 1 ) {
this .selectedEmployees.splice(index, 1 ); // Remove if already selected
} else {
this .state.selectedEmployees.push(employeeId); // Add if not selected
}
}

// Save selected employees to the current POS order
confirmSelection() {
const order = this .pos.get_order();
if (order) {
order.selectedEmployees = this .state.selectedEmployees;
console.log( "Saved employees to order:" , order.selectedEmployees);
} else {
console.warn( "Do not activate order found." );
}
}




}

registry.category( "pos_screens" ).add( "EmployeeSelectionScreen" , EmployeeSelectionScreen);

<templates id ="template" xml :space ="preserve" >
<t t-name ="plnx_pos_appointment.EmployeeSelectionScreen" >
<div class ="popup-content" >
<h3> Select Employees </h3>
<div class = "employee-list" >
<t t-foreach ="employees" t-as ="employee" t-key ="employee.id" >
<div class ="employee-item" >
<input type ="checkbox"
t -att-checked ="selectedEmployee.includes(employee.id)"
t-att-on-click ="toggleEmployeeSelection(employee.id)" />
<span t-esc ="employee.name" />
</div>
</t>
</div>
<div class ="popup-footer" >
<button t-on-click ="cancel" > Cancel </button>
<button t-on-click ="confirmSelection" > Confirm </button>
</div>
</ div>
</t>
</templates>
/** @odoo-module */

import { ProductScreen } from "@point_of_sale/app/screens/product_screen/product_screen" ;
import { usePos } from "@point_of_sale/app/store/pos_hook" ;
import { Component } from "@odoo/owl" ;
import {onMounted} from "@odoo/owl" ;
import { useBus, useService } from "@web/core/utils/hooks" ;



export class SetEmployeeButton extends Component {
static template = "plnx_pos_appointment.SetEmployeeButton" ;

setup() {
this .pos = usePos();
this .selectedEmployees = [];
this .employees = []; // Initialize employees as an empty array
this .employeeFetcher = useService( "employee_fetcher" );

onMounted(() => {
this .fetchEmployees(); // Fetch employees when mounted
});
}




async fetchEmployees() {
try {
this .employees = await this .employeeFetcher.fetchEmployees();
console.log( "Fetched Employees:" , this .employees);
let emp= this .employees
console.log( "length:" , emp.length)
} catch (error) {
console.error( "Error fetching employees:" , error);
}
}






async click() {
this .pos.showScreen( "EmployeeSelectionScreen" );

}


}

ProductScreen.addControlButton({ component: SetEmployeeButton });

<? xml version ="1.0" encoding ="UTF-8" ?>
<templates id ="template" xml :space ="preserve" >

<t t-name ="plnx_pos_appointment.SetEmployeeButton" >


<div class ="control-button o_appointment_button btn btn-light rounded-0 fw-bolder" t-on-click ="click" >
<i class ="fa fa-user-plus me-1" role ="img" aria-label ="Select Employees" title ="Select Employees" ></i>
Select Employees
</div>

</t>

</templates>


0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Displaying Many2one field on mobile devices identical to desktop view in Odoo 17
Odoo17
Avatar
Avatar
1
jul 25
1509
Update the discount in POS order
Odoo17
Avatar
0
nov 24
1844
ADD new group under other
Odoo17
Avatar
Avatar
1
oct 24
2998
Odoo 17 kanban second Progress bar
Odoo17
Avatar
0
oct 24
1947
Time sheets - Non DB User Employees
Odoo17
Avatar
0
oct 24
1602
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now