Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

how do i show the custom inherited field in pos.order to the receipt order on the Point of Sale client?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
2 Odpowiedzi
1361 Widoki
Awatar
Mangandaralam Sakti

this is my code:

# pos_order_inherit.py

from odoo import models, fields, api

from odoo.exceptions import ValidationError

class PosOrderInherit(models.Model):

​ _inherit = 'pos.order' 

​_description = 'POS Order Inherit'

pos_number = fields.Char(string="Pos Number", readonly=True)

@api.model

​def create(self, vals): 

​ ​if not vals.get('pos_number'): 

​ ​ ​vals['pos_number'] = self.env['ir.sequence'].next_by_code('pos.number.sequence') or '/' 

​ ​return super(PosOrderInherit, self).create(vals)


# pos_order_inherit_view.xml
<?xml version="1.0" encoding="utf-8"?>

<odoo>

​<record id="seq_pos_number" model="ir.sequence">

​ ​<field name="name">POS Number</field>

​ ​<field name="code">pos.number.sequence</field>

​ ​<field name="prefix">POS_NUMBER/</field>

​ ​<field name="padding">5</field>

​ ​<field name="company_id" eval="False"/>

​</record>


​<record id="pos_order_inherit_view_tree" model="ir.ui.view">

​ ​ <field name="name">pos.order.tree.inherit</field>

​ ​<field name="model">pos.order</field>

​ ​<field name="inherit_id" ref="point_of_sale.view_pos_order_tree"/>

​ ​<field name="arch" type="xml">

​ ​ ​<xpath expr="//field[@name='config_id']" position="after"> ​ ​ ​ ​<field name="pos_number" readonly="1"/>

​ ​ ​</xpath>

​ ​</field>

​</record>


​<record id="pos_order_inherit_view_form" model="ir.ui.view">

​ ​<field name="name">pos.order.form.inherit</field>

​ ​<field name="model">pos.order</field>

​ ​ <field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/> <field name="arch" type="xml">

​ ​<xpath expr="//field[@name='name']" position="after">

​ ​ ​<field name="pos_number" readonly="1"/>

​ ​ </xpath>

​ ​</field>

​</record>

​</odoo>


I want to show this inherited field to the receipt order on the PoS client

0
Awatar
Odrzuć
Awatar
lauralordelaure
Najlepsza odpowiedź

To display the custom pos_number field on the Point of Sale (PoS) receipt in Odoo, you need to extend the PoS client-side JavaScript and modify the receipt template. Odoo’s PoS uses a combination of Python (server-side) and JavaScript (client-side) to handle the receipt rendering. Since your field is already added to the pos.order model, you’ll need to:

  1. Extend the PoS data model to include the pos_number field in the client-side order data.
  2. Modify the receipt template to display the pos_number field.

0
Awatar
Odrzuć
lauralordelaure

https://geometrydashlitepc.io

Awatar
Jainesh Shah(Aktiv Software)
Najlepsza odpowiedź

Hello, Alam


    To show the custom field inherited in pos.order to the receipt order on the Point of Sale, please follow below steps.

   

        1) Create a Module, then create a folder structure of staic folder as shown in below image.

       

           

        2) Register the pos assets in __manifest__.py file.

   

         

        3) Print ' pos_order.py ' file add below code snippet.


               //Code 1 in comment//


        4) Print 'payment_screen.js' file add below code snippet.


                //Code 2 in comment//


        5) Print 'order_receipt.xml' file add below code snippet.


               //Code 3 in comment//


       6) Print 'models.js' file add below code snippet.


               //Code 4 in comment//


       7) Do not forget to replace 'your_module_name' to Actual module name in 'order_receipt.xml' file.

       


    Hope this helps !

     

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

       

 

    Thanks & Regards,

    Email:    odoo@aktivsoftware.com           

    Skype: kalpeshmaheshwari

0
Awatar
Odrzuć
Jainesh Shah(Aktiv Software)

Code 1 :

# -*- coding: utf-8 -*-

from odoo import api, models, fields

class PosOrder(models.Model):
_inherit = 'pos.order'

pos_number = fields.Char(string="Pos Number", readonly=True)

@api.model
def create(self,vals):
if not vals.get('pos_number'):
vals['pos_number'] = self.env['ir.sequence'].next_by_code('pos.number.sequence') or '/'
return super(PosOrder,self).create(vals)

def get_pos_number(self):
order = self.search([], limit=1, order='id desc')
pos_number = order.pos_number
return pos_number

Code 2 :

/* @odoo-module */

import { _t } from "@web/core/l10n/translation";
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
import { patch } from "@web/core/utils/patch";
import { OnlinePaymentPopup } from "@pos_online_payment/app/utils/online_payment_popup/online_payment_popup";
import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup";
import { floatIsZero } from "@web/core/utils/numbers";
import { qrCodeSrc } from "@point_of_sale/utils";
import { useService } from "@web/core/utils/hooks";
import { useRef, onPatched, onMounted, useState } from "@odoo/owl";
import { usePos } from "@point_of_sale/app/store/pos_hook";

patch(PaymentScreen.prototype, {
setup() {
super.setup();
this.rpc = useService("rpc");
this.state = useState({ inputValue: this.props.startingValue });
this.pos = usePos();
this.popup = useService("popup");
this.userService = useService("user");
this.action = useService("action");
},

async afterOrderValidation(suggestToSync = false) {
const pos_number = this.pos.orders[0].server_id
const pos_number = await this.orm.call('payment.transaction', 'get_number_of_installment', [pos_number]);
this.pos.get_order().created_pos_number = pos_number
await super.afterOrderValidation(...arguments);
},

});

Code 3 :

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="your_module_name.OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension">
<xpath expr="//div[hasclass('paymentlines')]" position="inside">
<t t-if="props.data.new_pos_number">
<h4>Session Name : <t t-esc="props.data.new_pos_number"/></h4>
</t>
</xpath>
</t>
</templates>

Code 4 :

/* @odoo-module */

import { Order } from "@point_of_sale/app/store/models";
import { usePos } from "@point_of_sale/app/store/pos_hook";
import { patch } from "@web/core/utils/patch";
import { useService } from "@web/core/utils/hooks";

patch(Order.prototype, {
export_for_printing() {
const result = super.export_for_printing(...arguments);
result.new_pos_number = this.pos.get_order().created_pos_number;
return result;
},

});

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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