【问题标题】:How to update point_of_sale.screens in Odoo 14如何在 Odoo 14 中更新 point_of_sale.screens
【发布时间】:2021-03-06 08:12:44
【问题描述】:

我正在迁移到 Odoo14 并且 PoS 模块已更改。 我有一些继承 ClientListScreenWidget 和 PaymentScreenWidget 等的函数,代码如下:

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

    var screens = require('point_of_sale.screens');

    screens.ClientListScreenWidget.include({
        // Client change alerts
        save_changes: function () {
            if (this.has_client_changed()) {
                if (this.new_client) {
                    if (this.new_client.partner_billing_number === false && this.new_client.billing_name === false) {
                        alert(
                            'El cliente que está seleccionando no tiene la "Razón Social" definida!'
                        )
                    }else if (this.new_client.partner_billing_number !== false && this.new_client.billing_name === false) {
                        alert(
                            'El cliente que está seleccionando no tiene la "Razón Social" definida!'
                        )
                    }else if (this.new_client.partner_billing_number === false && this.new_client.billing_name !== false) {
                        alert(
                            'El cliente que está seleccionando no tiene el "Número de facturación" definido!'
                        )
                    }
                }
            }
            this._super()
        },
        // Client save alerts
        save_client_details: function (partner) {
            let document_type = $('select[name="document_type"]').val()
            let client_document_number = $('input[name="document_number"]').val()
            let client_vat = $('input[name="vat"]').val()
            let client_billing_name = $('input[name="billing_name"]').val()
            let missing_data_message = 'Si desea facturar este pedido para este cliente, tiene que detallar la información faltante!'
            if (!client_billing_name) {
                this.gui.show_popup('alert',{
                    title: 'Falta la "Razón Social" del cliente!',
                    body: missing_data_message
                });
            }
            switch(document_type) {
                case '1':
                case '2':
                case '3':
                case '4':
                    if (!client_document_number) {
                        this.gui.show_popup('alert',{
                            title: 'Falta el "Número de documento" del cliente!',
                            body: missing_data_message
                        });
                    }
                    break;
                case '5':
                    if (!client_vat) {
                        this.gui.show_popup('alert',{
                            title: 'Falta el "NIT" del cliente!',
                            body: missing_data_message
                        });
                    }
            }
            this._super(partner)
        }
    })

});

但屏幕文件在 Odoo14 中不存在。那么我应该如何在 Odoo14 中继承呢?这个文件怎么了?

【问题讨论】:

    标签: javascript customization pos odoo-14


    【解决方案1】:

    替换

    var screens = require('point_of_sale.screens');
    

    有了这个

    var screens = require('point_of_sale.ProductScreen');
    

    【讨论】:

      猜你喜欢
      • 2021-11-20
      • 2021-06-13
      • 2021-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-24
      • 2021-05-24
      • 1970-01-01
      相关资源
      最近更新 更多