Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Artificial Intelligence
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    • Referral Program
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

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

Subscribe

Get notified when there's activity on this post

This question has been flagged
javascriptpopupv15
2 Replies
6101 Views
Avatar
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
Avatar
Discard
Avatar
meriem
Author Best Answer

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
Avatar
Discard
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

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
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
How to override js method in Odoo 15?
javascript v15
Avatar
Avatar
Avatar
Avatar
3
Nov 25
5946
Onclick event for a button javascript Odoo 15
javascript v15
Avatar
Avatar
2
May 22
16400
How to add 'load_fields ' in odoo 15 ?
javascript v15
Avatar
Avatar
2
Apr 22
6509
Extend an exisiting Widget
javascript widget v15
Avatar
Avatar
1
Jul 25
6106
Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
javascript fetch v15
Avatar
Avatar
Avatar
Avatar
Avatar
10
Dec 24
36261
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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