Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Code patch not taking effect. Inheriting the POS invoice_button component

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
pospoint_of_sale18.0l10n_mx
2 Replies
1905 Tampilan
Avatar
Alvaro Brena

ODOO 18

I’m working on a POS module where I’m trying to apply a patch. The component is invoice_button. The issue is that when I run the POS to test it, the patch doesn’t take effect: if I add a console.log inside the onWillInvoiceOrder function, it doesn’t run. However, the console.log does run if I load it before the patch.


Could you guide me on what might be going wrong? I’m attaching some code and the module’s structure.

point_of_sale [invoice_button] -> l10n_mx_edi_pos [invoice_button] -> my_module [invoice_button]

All the other POS assets (JS included) are working as expected.

# Code

import { InvoiceButton } from "@point_of_sale/app/screens/ticket_screen/invoice_button/invoice_button";

import { AddInfoPopup } from "@l10n_mx_edi_pos/app/add_info_popup/add_info_popup";

import { makeAwaitable } from "@point_of_sale/app/store/make_awaitable_dialog";

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


patch(InvoiceButton.prototype, {

async onWillInvoiceOrder(order, newPartner) {

if (this.pos.company.country_id?.code !== "MX") {

return true;

}

const payload = await makeAwaitable(this.dialog, AddInfoPopup, {

order,

newPartner,

});

if (payload) {

order.l10n_mx_edi_cfdi_to_public =

payload.l10n_mx_edi_cfdi_to_public === true ||

payload.l10n_mx_edi_cfdi_to_public === "1";

order.l10n_mx_edi_usage = payload.l10n_mx_edi_usage;

// Add new field for payment term

order.payment_term_id = payload.clientPaymentTerm || 0;

await this.pos.data.ormWrite("pos.order", [order.id], {

l10n_mx_edi_cfdi_to_public: order.l10n_mx_edi_cfdi_to_public,

l10n_mx_edi_usage: order.l10n_mx_edi_usage,

payment_term_id: order.payment_term_id,

});

}

return Boolean(payload);

},

});

# Manifest

"depends": [

"point_of_sale",

"pos_settle_due",

"l10n_mx_edi_pos",

],

"assets": {

"point_of_sale._assets_pos": [

"bck_pos_uso_cfdi/static/src/**/*",

],

},





0
Avatar
Buang
Avatar
D Enterprise
Jawaban Terbai

Hii,

/** @odoo-module **/


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

import { registry } from "@web/core/registry";

import { InvoiceButton } from "@point_of_sale/app/screens/ticket_screen/invoice_button/invoice_button";

import { AddInfoPopup } from "@l10n_mx_edi_pos/app/add_info_popup/add_info_popup";

import { makeAwaitable } from "@point_of_sale/app/store/make_awaitable_dialog";


// Optional: Confirm patch is loaded

console.log("[bck_pos_uso_cfdi] Patching InvoiceButton...");


registry.category("pos_screens").add("patch_invoice_button", {

    async setup() {

        patch(InvoiceButton.prototype, {

            async onWillInvoiceOrder(order, newPartner) {

                console.log("[bck_pos_uso_cfdi] onWillInvoiceOrder triggered");


                if (this.pos.company.country_id?.code !== "MX") {

                    return true;

                }


                const payload = await makeAwaitable(this.dialog, AddInfoPopup, {

                    order,

                    newPartner,

                });


                if (payload) {

                    order.l10n_mx_edi_cfdi_to_public =

                        payload.l10n_mx_edi_cfdi_to_public === true ||

                        payload.l10n_mx_edi_cfdi_to_public === "1";

                    order.l10n_mx_edi_usage = payload.l10n_mx_edi_usage;

                    order.payment_term_id = payload.clientPaymentTerm || 0;


                    await this.pos.data.ormWrite("pos.order", [ order.id ], {

                        l10n_mx_edi_cfdi_to_public: order.l10n_mx_edi_cfdi_to_public,

                        l10n_mx_edi_usage: order.l10n_mx_edi_usage,

                        payment_term_id: order.payment_term_id,

                    });

                }


                return Boolean(payload);

            },

        });


        console.log("[bck_pos_uso_cfdi] Patch applied to InvoiceButton");

    },

});


I hope it is of full use.

1
Avatar
Buang
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Jawaban Terbai

Hi,


You should patch the overridden InvoiceButton from l10n_mx_edi_pos, not the original @point_of_sale one.

1- Update the import.

import { InvoiceButton } from "@l10n_mx_edi_pos/app/screens/ticket_screen/invoice_button/invoice_button";

2- Then apply your patch as you did:

patch(InvoiceButton.prototype, {

  async onWillInvoiceOrder(order, newPartner) {

    console.log("Patched button clicked");  // Debug

    ...

  }

});


3- In your __manifest__.py, ensure your module is loaded after l10n_mx_edi_pos in the assets list:

"assets": {

    "point_of_sale._assets_pos": [

        "l10n_mx_edi_pos/static/src/**/*",  # already loaded before

        "bck_pos_uso_cfdi/static/src/**/*",  # your module after

    ],

},


This ensures your patch runs after all upstream overrides.


Hope it helps

1
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Can I overwrite the “Order” button on the PoS?
pos point_of_sale owl 18.0
Avatar
Avatar
1
Des 25
229
How to update point of sale order state?
pos point_of_sale
Avatar
Avatar
1
Nov 25
760
POS Custom Promotion Popup: Confirm button not triggering applyPromotions()
pos 18.0
Avatar
Avatar
1
Okt 25
1031
Odoo 18: Price tags in Point of Sale (POS) Diselesaikan
pos 18.0
Avatar
Avatar
Avatar
Avatar
Avatar
8
Sep 25
7423
How to print order bill and still have the possibility to make payment.
pos 18.0
Avatar
Avatar
Avatar
Avatar
Avatar
4
Agu 25
2962
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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