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
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
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.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Jun 25
|
863 | ||
|
1
Jun 25
|
1707 | ||
|
0
Nov 21
|
1601 | ||
|
1
Nov 19
|
6194 | ||
|
3
Jun 25
|
677 |