Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
2 Respuestas
1297 Vistas
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
Mejor respuesta

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)
Mejor respuesta

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

});

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

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