How to show new fields that are in account.move in the POS receipt.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
posted a new thread
Hi,
class AccountMove(models.Model):
_inherit = 'account.move'
@api.model def _load_pos_data_fields(self, config_id):
result = super()._load_pos_data_fields(config_id)
result.append('field name')
return result
Hope it helps
I currently have the following:
.py:
from odoo import models, fields, api
class AccountMove(models.Model):
_inherit = 'account.move'
@api.model
def _load_pos_data_fields(self, config_id):
fields = super(AccountMove, self)._load_pos_data_fields(config_id)
fields.extend(['registry'])
return fields
.js
/** @odoo-module */
import { patch } from "@web/core/utils/patch";
import { PosStore } from "@point_of_sale/app/store/pos_store";
patch(PosStore.prototype, {
getReceiptHeaderData(order) {
const data = {
...super.getReceiptHeaderData(...arguments),
invoice: order.account_move,
};
console.log("Order Data:", order); // Verifica el contenido de order
console.log("Receipt Header Data:", data);
console.log("Mi Campo Personalizado:", data.invoice ? data.invoice.registry : "No definido");
return data;
},
});
xml:
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="hn_akos_cp_pos_update.ReceiptHeader" t-inherit="point_of_sale.ReceiptHeader" t-inherit-mode="extension">
<xpath expr="//div[@t-if='props.data.cashier']" position="after">
<t t-if='props.data.invoice'>
<div style="text-align: justify;">Factura Relacionada:
<t t-esc='props.data.invoice.registry' style="text-decoration: underline;" />
</div>
</t>
</xpath>
</t>
</templates>
But it doesn't work for me, I don't know if it's the js I have wrong.
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
InscribirsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
1
jun 25
|
841 | ||
|
1
jun 25
|
1662 | ||
|
0
nov 21
|
1591 | ||
|
1
nov 19
|
6158 | ||
|
3
jun 25
|
657 |