Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

await this.showPopup(''); don't show the Popup

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
javascriptpopupv15
2 Odpowiedzi
4962 Widoki
Awatar
meriem
I  wanted to show the CreateOrderPopup in Odoo15 BUT it's not showing and there is no error message. I created 2 logs : ffffffff and QQQQQ the fffffffff is shown in the logs but the QQQQQ which is after calling " await this.showPopup('CreateOrderPopup'); " it's not being shown.
I have this in the JS file :
odoo.define("point_of_sale.CreateOrderButton", function (require) {
    "use strict";

    const PosComponent = require("point_of_sale.PosComponent");
    const ProductScreen = require("point_of_sale.ProductScreen");
    const Registries = require("point_of_sale.Registries");
   
    class CreateOrderButton extends PosComponent {
        async onClick() {
            console.log("ffffffffffffffffffff");
           await this.showPopup('CreateOrderPopup');
            console.log('QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ');
        };
        
    }
    CreateOrderButton.template = "CreateOrderButton";
    
    ProductScreen.addControlButton({
        
        component: CreateOrderButton,
        condition: function () {
            return (
                this.env.pos.config.iface_create_sale_order &&
                this.env.pos.get_order().get_client() &&
                this.env.pos.get_order().get_orderlines().length !== 0
                
            );
        },
    });

    Registries.Component.add(CreateOrderButton);
});

But the CreateOrderPopup is not showing when I click on the button. Also the QQQQ logs don't get shown

For the CreateOrderPopUp i have :

odoo.define("point_of_sale.CreateOrderPopup", function (require) { "use strict"; const AbstractAwaitablePopup = require("point_of_sale.AbstractAwaitablePopup"); const Registries = require("point_of_sale.Registries"); const framework = require("web.framework"); class CreateOrderPopup extends AbstractAwaitablePopup { setup() { super.setup(); this.createOrderClicked = false; } async createDraftSaleOrder() { await this._createSaleOrder("draft"); } async createConfirmedSaleOrder() { await this._createSaleOrder("confirmed"); } async createDeliveredSaleOrder() { await this._createSaleOrder("delivered"); } async createInvoicedSaleOrder() { await this._createSaleOrder("invoiced"); } async _createSaleOrder(order_state) { var current_order = this.env.pos.get_order(); framework.blockUI(); await this.rpc({ model: "sale.order", method: "create_order_from_pos", args: [current_order.export_as_JSON(), order_state], }) .catch(function (error) { throw error; }) .finally(function () { framework.unblockUI(); }); // Delete current order this.env.pos.removeOrder(current_order); this.env.pos.add_new_order(); // Close popup return await super.confirm(); } } CreateOrderPopup.template = "CreateOrderPopup"; Registries.Component.add(CreateOrderPopup); return CreateOrderPopup; });

both templates are created and they are all called like this in the manifest file :
"assets": { "point_of_sale.assets": [ "pos_order_to_sale_order/static/src/css/pos.css", "pos_order_to_sale_order/static/src/js/CreateOrderPopup.js", "pos_order_to_sale_order/static/src/js/CreateOrderButton.js", ], 'web.assets_qweb': [ "pos_order_to_sale_order/static/src/xml/CreateOrderPopup.xml", "pos_order_to_sale_order/static/src/xml/CreateOrderButton.xml", ],


Why does the PopUp stops the QQQQ log from showing in the logs and itself in the POS

0
Awatar
Odrzuć
Awatar
meriem
Autor Najlepsza odpowiedź

Thank you for your reply. But still nothing is working and No errors!!

Also, 

this.env.pos.config.iface_create_sale_order &&
this.env.pos.get_order().get_client() &&
this.env.pos.get_order().get_orderlines().length !== 0

is not being read correctly, because the button is not being shown correctlyl!!

0
Awatar
Odrzuć
Awatar
Cybrosys Techno Solutions Pvt.Ltd
Najlepsza odpowiedź

Hi,

Try the following code

odoo.define('point_of_sale.CreateOrderPopup', function(require){
'use strict';

const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup');
const Registries = require('point_of_sale.Registries');
const { _lt } = require('@web/core/l10n/translation');
const framework = require("web.framework");

class CreateOrderPopup extends AbstractAwaitablePopup {
setup() {
super.setup();
this.createOrderClicked = false;
}

async createDraftSaleOrder() {
await this._createSaleOrder("draft");
}

async createConfirmedSaleOrder() {
await this._createSaleOrder("confirmed");
}

async createDeliveredSaleOrder() {
await this._createSaleOrder("delivered");
}

async createInvoicedSaleOrder() {
await this._createSaleOrder("invoiced");
}

async _createSaleOrder(order_state) {
var current_order = this.env.pos.get_order();

framework.blockUI();

await this.rpc({
model: "sale.order",
method: "create_order_from_pos",
args: [current_order.export_as_JSON(), order_state],
})
.catch(function (error) {
throw error;
})
.finally(function () {
framework.unblockUI();
});

// Delete current order
this.env.pos.removeOrder(current_order);
this.env.pos.add_new_order();
 
// Close popup
return await super.confirm();
}

 
}
//Create Order popup
CreateOrderPopup.template = 'CreateOrderPopup';
CreateOrderPopup.defaultProps = {
confirmText: _lt('Ok'),
title: _lt('Confirm ?'),
body: '',
};

Registries.Component.add(CreateOrderPopup);

return CreateOrderPopup;
});
odoo.define("point_of_sale.CreateOrderButton", function (require) {
"use strict";

const PosComponent = require("point_of_sale.PosComponent");
const ProductScreen = require("point_of_sale.ProductScreen");
const Registries = require("point_of_sale.Registries");
const { useListener } = require('web.custom_hooks');
 
class CreateOrderButton extends PosComponent {
async onClick() {
await this.showPopup('CreateOrderPopup',{
title : this.env._t("enter title"),
body : this.env._t("Enter your body message")
});
};
 
}
CreateOrderButton.template = "CreateOrderButton";
 
ProductScreen.addControlButton({
 
component: CreateOrderButton,
condition: function () {
return (
this.env.pos.config.iface_create_sale_order &&
this.env.pos.get_order().get_client() &&
this.env.pos.get_order().get_orderlines().length !== 0
 
);
},
});

Registries.Component.add(CreateOrderButton);
 
return CreateOrderButton;
});

Regards

0
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
How to override js method in Odoo 15?
javascript v15
Awatar
Awatar
Awatar
Awatar
3
lis 25
4371
Onclick event for a button javascript Odoo 15
javascript v15
Awatar
Awatar
2
maj 22
15118
How to add 'load_fields ' in odoo 15 ?
javascript v15
Awatar
Awatar
2
kwi 22
5321
Extend an exisiting Widget
javascript widget v15
Awatar
Awatar
1
lip 25
4756
Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
javascript fetch v15
Awatar
Awatar
Awatar
Awatar
Awatar
10
gru 24
33913
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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