Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consulting
    • Accounting Firm
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Solar Energy Systems
    • Shoe Maker
    • Serveis de neteja
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

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

Subscriure's

Get notified when there's activity on this post

This question has been flagged
2 Respostes
1319 Vistes
Avatar
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
Avatar
Descartar
Avatar
lauralordelaure
Best Answer

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
Avatar
Descartar
lauralordelaure

https://geometrydashlitepc.io

Avatar
Jainesh Shah(Aktiv Software)
Best Answer

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
Avatar
Descartar
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;
},

});

Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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