İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

Custom JavaScript Not Working in POS Module in Odoo 17

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
developmentdevelopementpospoint_of_sale
2 Cevaplar
7886 Görünümler
Avatar
Technology Pill Business Solution

I am currently working on a custom module for Odoo 17 and facing an issue with JavaScript customization in the Point of Sale (POS) module. I am trying to override the add_product method in the POS, but my changes don't seem to take effect. I've ensured that my JavaScript file is included in the point_of_sale.assets bundle, but I'm not seeing the expected behavior or any console logs that I've added for debugging.


I included the JavaScript file in the point_of_sale.assets bundle in my module's __manifest__.py. Here's a snippet of the code for reference:


odoo.define('give_and_get_order_module.CustomOrder', function(require) {
    'use strict';

    var models = require('point_of_sale.models');
    var OrderSuper = models.Order.prototype;

    models.Order.include({
        add_product: function(product, options) {
            console.log("Custom add_product method called");
            if (!options || !options.quantity) {
                options = options || {};
                options.quantity = -1;
            }
            return OrderSuper.add_product.apply(this, [product, options]);
        },
    });
});

And the relevant part of my __manifest__.py:

'assets': {
    'point_of_sale.assets': [
        'give_and_get_order_module/static/src/js/custom_order.js',
    ],
},

I would appreciate any insights or suggestions on what I might be missing or doing wrong. Is there a specific aspect of POS module customization in Odoo 17 that I need to be aware of?

Thank you in advance for your help!

0
Avatar
Vazgeç
Avatar
Jainesh Shah(Aktiv Software)
En İyi Yanıt

Hey Technology Pill Business Solution,


I hope you are doing well.


For inheriting add_product function, we need to follow the steps defined below:

1. Create models.js file under static > src > overrides > models directory.

2. Use the below code for inheriting Order from base models.js using Patch.


/* @odoo-module /


import { Order, Orderline, Payment } from "@point_of_sale/app/store/models";

import { patch } from "@web/core/utils/patch";


patch(Order.prototype, {

    async add_product(product, options) {

// Your custom code

        return super.add_product(...arguments);

    },

});


3. Insert custom JS path in manifest.

Note:- Add ‘point_of_sale’ in your customer module’s depends.

- Odoo.define is deprecated in Odoo V17.


Hope this will help you.

Thanks & Regards,
Email:   odoo@aktivsoftware.com      

Skype: kalpeshmaheshwari

0
Avatar
Vazgeç
Avatar
Maciej Burzymowski
En İyi Yanıt

From your code, it seems like you’re correctly including your JavaScript file in the 'point_of_sale.assets' bundle and your method override also looks correct. However, there are a few things you might want to check:

  1. Order of JS files: Ensure that your JavaScript file is loaded after the original file you’re trying to override. The order of JavaScript files in the assets bundle can affect the behavior of your customization.
  2. Module Dependency: Make sure that your custom module depends on the 'point_of_sale' module. You can specify this in the 'depends' section of your '__manifest__.py' file.
  3. Browser Cache: Clear your browser cache or try in incognito mode. Sometimes, the browser might be loading a cached version of your JavaScript file.
  4. Server Restart: After making changes to the '__manifest__.py' file, you need to restart your Odoo server and upgrade your module.

If you’ve checked all of these and your method override is still not working, it might be due to some changes in Odoo 17’s POS module. In Odoo 17, there are new ways to load custom models and fields. You might need to inherit the 'pos.session' model and overwrite the '_pos_ui_models_to_load()' method. Also, creating a custom screen involves patching the 'PosStore' and overriding the '_processData' function.

I hope this helps! If you’re still facing issues, please provide more details about the behavior you’re observing and any error messages you’re seeing. I’ll do my best to assist you further. 

Best regards,
Maciej Burzymowski


0
Avatar
Vazgeç
Enjoying the discussion? Don't just read, join in!

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

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
How to update point of sale order state?
pos point_of_sale
Avatar
Avatar
1
Kas 25
368
Pos product shows 0.0 units sold
pos point_of_sale
Avatar
Avatar
Avatar
3
Nis 25
1889
How to have checkboxes for the variables of each product
pos point_of_sale
Avatar
Avatar
1
Ağu 24
2971
How to delete POS Sessions! Odoo 16 Çözüldü
pos point_of_sale
Avatar
Avatar
Avatar
Avatar
3
May 24
13094
POS Session wont close Çözüldü
pos point_of_sale
Avatar
Avatar
1
Eyl 23
4728
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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