Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

POS - Add invoice number Odoo V17

Odebírat

Get notified when there's activity on this post

This question has been flagged
invoicepospoint_of_sale1717.4
1 Odpovědět
2420 Zobrazení
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
Zrušit
Avatar
Jainesh Shah(Aktiv Software)
Nejlepší odpověď

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
Zrušit
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!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
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
pro 24
1688
Invoice number in Odoo POS voucher
invoice pos invoicing point_of_sale
Avatar
Avatar
1
srp 15
4303
How to add customer previous balance and new balance lines on POS invoice
invoice pos customer point_of_sale odoo12
Avatar
0
pro 22
5276
How to update point of sale order state?
pos point_of_sale
Avatar
Avatar
1
lis 25
371
restrict user acces to the transfert button in pos odoo17 CE
pos 17
Avatar
0
zář 25
648
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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