تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
1972 أدوات العرض

 ProductScreen add a fucntiom to it if can sample code if please


الصورة الرمزية
إهمال
أفضل إجابة

Hi,

Here is sample code:


odoo.define('uni_pos.ProductScreen_PosLineDiscount', function(require) {

   'use strict';

   const Registries = require('point_of_sale.Registries');

   const ProductScreen = require('point_of_sale.ProductScreen');


    const PosLineDiscount = (ProductScreen) => class extends ProductScreen {


        async _clickProduct(event) {

            if (!this.currentOrder) {

                this.env.pos.add_new_order();

            }

            const product = event.detail;

            const options = await this._getAddProductOptions(product);

            // Do not add product if options is undefined.

            if (!options) return;

            // Add the product after having the extra information.

            this.currentOrder.add_product(product, options);

//            this.currentOrder.get_selected_orderline().set_discount(5)

            console.log('Product Add')


            try {

              NumberBuffer.reset();

            }

            catch(err) {

              console.log(err)

            }

        }

    };

    Registries.Component.extend(ProductScreen, PosLineDiscount);

    return ProductScreen;


});




Hope it helps

الصورة الرمزية
إهمال