Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3780 Widoki

Hello, Im using odoo 10. I want to add a field to pos receipt from res.partner. I try to load the field to JS using:

models.load_fields("res.partner", ['credit']);

and call it in xml:

    t-esc="widget.pos.get_client().credit"

but it doesn't seem to be working.It is functional in odoo 12 but not in Odoo 10. How can I load 'credit' field from res.partner in pos receipt?

Awatar
Odrzuć
Najlepsza odpowiedź

Hi, 
You can load the models using the method,


models.load_fields("res.partner", ['credit']);


var ReceiptScreenWidget = screens.ScreenWidget.extend({
        template: 'ReceiptScreenWidget',
        show: function(){
            this._super();
            var self = this;
            var order = this.pos.get_order();
            this.render_receipt();
            }
        },
       
        get_receipt_render_env: function() {
            var order = this.pos.get_order();
            this.pos.last_receipt_render_env = {
                widget: this,
                pos: this.pos,
                order: order,
                receipt: order.export_for_printing(),
                orderlines: order.get_orderlines(),
                paymentlines: order.get_paymentlines(),
            };
            return this.pos.last_receipt_render_env;
        },
       //You can add the functions here , if you need to add new function and assign it to pos , also based on that function you can access the details
       
    gui.define_screen({name:'receipt', widget: ReceiptScreenWidget});

    return {
        ReceiptScreenWidget: ReceiptScreenWidget
    };


// in this code ge the partner credit details


Hope it helps

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
cze 23
42675
1
wrz 21
8774
0
maj 24
2278
1
sie 20
9178
2
cze 20
4224