İç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

POS - Add invoice number Odoo V17

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
invoicepospoint_of_sale1717.4
1 Cevapla
2419 Görünümler
Avatar
Edgar Vasquez Vergara

Hello community, I have been trying for several days to update the ticket generated from the POS at the end of the purchase so that it is printed on the thermal ticket machine, I need to add the invoice number, the code that I am implementing so far is the following:


# models/custom_pos.py #
from odoo import models, fields
class PosOrder(models.Model):    _inherit = 'pos.order'
     invoice_id = fields.Many2one('account.move', string='Factura')


/* static/src/js/receipt_order.js */
odoo.define('custom_receipts_for_pos.receipt_order', function (require) 
"use strict";
var models = require('point_of_sale.models');   
var OrderSuper = models.Order.prototype;
models.Order = models.Order.extend({
        initialize: function (attributes, options) {
            OrderSuper.initialize.apply(this, arguments);
            this.invoice_id = this.invoice_id || false;
        },
        export_for_printing: function () {
            var result = OrderSuper.export_for_printing.apply(this, arguments);
            result.invoice_id = this.invoice_id;
            return result;
        },
    });
});


Since I have not been able to load the invoice_id in the JavaScript, I am not doing the xml view, but it should be something similar to this:


< !-- views/post_custom.xml-- >
< odoo>
    < template id="pos_ticket_custom" inherit_id="point_of_sale.receipt">
        < xpath expr="//div[@class='pos-receipt']" position="inside">
            < t t-if="order.invoice_id">
                < div>
                    < strong>Número de Factura:< /strong> < span t-esc="order.invoice_id.name"/>
                < /div>
            < /t>
        < /xpath>
    < /template>
< /odoo>


In case you didn't read the subject, the version is Odoo 17 and I'm testing in the Community and Enterprise version and it doesn't work


HELP!

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

Hello Edgar Vasquez Vergara,


To print the invoice number on a POS receipt in Odoo v17, you can simply try this approach.


Js file :


//Code 1 in Comment//


Python file:-


//Code 2 in Comment//


xml file:-


//Code 3 in comment//



Hope this Helps,

If you need any help in customization feel free to contact us.


Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

0
Avatar
Vazgeç
Jainesh Shah(Aktiv Software)

Code 1 :
/ @odoo-module /

import { useState } from "@odoo/owl";
import { ReceiptHeader } from "@point_of_sale/app/screens/receipt_screen/receipt/receipt_header/receipt_header";
import { usePos } from "@point_of_sale/app/store/pos_hook";
import { useService } from "@web/core/utils/hooks";
import { patch } from "@web/core/utils/patch";

patch(ReceiptHeader.prototype, {
/**
* Extends the setup method of the ReceiptHeader component to include invoice number handling.
*
* This patched setup method initializes the component state with an `invoiceNumber` field set to `0`,
* retrieves the POS orders from the `pos` service, and if an order is eligible for invoicing (i.e.,
* `to_invoice` is true and `server_id` is present), it calls the `generate_invoice_number` method
* on the `orm` service to fetch the invoice number for the order. The retrieved invoice number is then
* stored in the component state.
*
* This process ensures that the invoice number is available in the component's state and can be used
* for rendering on the receipt screen template.
*/
async setup(){
super.setup();
this.state = useState({
invoiceNumber: ""
});
this.pos = usePos();
this.orm = useService("orm");
console.log(this.pos.orders.length,'===', this.pos.orders[0].to_invoice, '====', this.pos.orders[0].server_id );
if (this.pos.orders.length && this.pos.orders[0].to_invoice && this.pos.orders[0].server_id){
const InvNumber = await this.orm.call('pos.order', 'generate_invoice_number', [this.context, this.pos.orders[0].server_id]);
this.state.invoiceNumber = InvNumber
}
},
});

Code 2 :

class PosOrder(models.Model):
"""Inherited: Pos Order"""

_inherit = "pos.order"

def generate_invoice_number(self, data):
"""
Generate the invoice number for a given POS order.

This method retrieves the invoice number for a POS order identified by the provided `data`.
It uses the `pos.order` model to browse the specific order and fetch its associated account move name,
which is used as the invoice number. If the order or account move is not found, an empty string is returned.

Returns:
str: The invoice number associated with the POS order. Returns an empty string if the invoice number
cannot be found.

"""
return self.env["pos.order"].sudo().browse(int(data)).account_move.name or ""

Code 3:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<!--
This template extension modifies the ReceiptHeader view in the Point of Sale module.
It adds a new element to display the invoice number if it is present in the component's state.
-->
<t t-inherit="point_of_sale.ReceiptHeader" t-inherit-mode="extension">
<xpath expr="//div[hasclass('cashier')]" position="after">
<div class="fw-bolder" t-if="this.state.invoiceNumber">
<span class="fs-3" t-esc="state.invoiceNumber"/>
</div>
</xpath>
</t>
</templates>

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 can we post accounting entries for POS orders that remain in a 'Paid' state instead of being posted, even after the session has been closed?
invoice pos point_of_sale journal_entry
Avatar
0
Ara 24
1688
Invoice number in Odoo POS voucher
invoice pos invoicing point_of_sale
Avatar
Avatar
1
Ağu 15
4303
How to add customer previous balance and new balance lines on POS invoice
invoice pos customer point_of_sale odoo12
Avatar
0
Ara 22
5276
How to update point of sale order state?
pos point_of_sale
Avatar
Avatar
1
Kas 25
371
restrict user acces to the transfert button in pos odoo17 CE
pos 17
Avatar
0
Eyl 25
648
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