Skip to Content
Menu
This question has been flagged
1 Reply
5775 Views

Hi, 

I try to show a POPUP or Warning in the POS, for example, if a specific partner is select in ProductScreen, what I did wrong?

CODE:

--------------------------

odoo.define('pos_warning', function (require) {
"use strict";

var core = require('web.core');
var models = require('point_of_sale.models');
var screen = require('point_of_sale.screens');
var _t = core._t;

models.load_fields("res.partner", "sale_warn");
models.load_fields("res.partner", "sale_warn_msg");
screen.ProductScreenWidget = screen.ProductScreenWidget.include({
        line_select: function(event,$line,id){
                var self = this
                var partner = this.pos.db.get_partner_by_id(id);
                if(partner.sale_warn === 'no-message' | $line.hasClass('highlight')){
                        return this._super(event,$line,id);
                        }
                else
                        {
                                self.gui.show_popup('alert',{
                                'title': _t(partner.sale_warn_msg),
                                'body': _t('Para actualizar su estatus de pago, favor comunicarse con su proveedor y evitar suspensión en el servicio.'),
                                //title: _t(partner.sale_warn_msg)
                                });
                                if(partner.sale_warn === 'warning')
                                                {
                                                        console.log('warning')
                                                        self._super(event,$line,id);
                                                };


                        }
                }
        });


});

Avatar
Discard
Best Answer
`line_select` method is part of class `ClientListScreenWidget`not `ProductScreenWidget` 

screen.ClientListScreenWidget = screen.ClientListScreenWidget.include({ ....


Avatar
Discard
Related Posts Replies Views Activity
0
Dec 19
3
1
Nov 24
105
4
Oct 24
1428
0
Oct 22
4147
0
Sep 22
38