Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Umělá inteligence
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

New employee Button in POS

Odebírat

Get notified when there's activity on this post

This question has been flagged
Odoo17
3655 Zobrazení
Avatar
vision valley , 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
Zrušit
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Displaying Many2one field on mobile devices identical to desktop view in Odoo 17
Odoo17
Avatar
Avatar
1
čvc 25
2735
Update the discount in POS order
Odoo17
Avatar
0
lis 24
3016
ADD new group under other
Odoo17
Avatar
Avatar
1
říj 24
4227
Odoo 17 kanban second Progress bar
Odoo17
Avatar
0
říj 24
2907
Time sheets - Non DB User Employees
Odoo17
Avatar
0
říj 24
2455
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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