Quote line items bugged 10.3?

Hi, 

I was wondering if some one knows if the following behaviour is a bug (or does have a clue how it can happen). When I create a new quote fill in all the blacnks and add product line items all seems fine. But after the save has finished for some reason all product lines are duplicated in the UI. When I refresh the page again all seems ok again until I save the quote again. 

I couldn't find anything regarding this so be a bug. Anyone out there who noticed same behaviour?

Parents
  • Doing a bit more digging, do you have any customization in custom/modules/Quotes/clients/base/views/record/record.js ? 

  • Yes. But I don't think they are related. 

    ({
        extendsFrom: 'RecordView',
    
        /**
         * @inheritdoc
         */
        initialize: function (options) {
            this._super('initialize', [options]);
            this.context.on('button:send_pdf:click', this.onSendPdf, this);
            this.context.on('button:print_pdf:click', this.onPrintPdf, this);
            this.model.on('change:billing_account_name',this.onBillingAccountChange,this); //needs to be refactored
            this.model.on('change:billing_account_id',this.onBillingAccountChange,this); 
        },
    
        onBillingAccountChange: function (data){
            if(!data.inSync) {
                let billing_account_name = this.model.get('billing_account_name');
                let billing_account_id = this.model.get('billing_account_id');
                this.model.set('shipping_account_name', billing_account_name);
                this.model.set('shipping_account_id', billing_account_id);
            }
        },
    
        onSendPdf: function(){
            var urlParams = $.param({
                'action': 'tcpdf_offer',
                'module': this.module,
                'record': this.model.id,
                'mode' : 'FMail'
            });
    
            var url = '?' + urlParams;
    
            app.alert.show('generating_pdf', {
                level: 'process',
                title: app.lang.get('LBL_GENERATING_PDF')
            });
    
            app.bwc.login(null,_.bind(function(){
                this._triggerDownload(url);
            },this));
    
        },
        onPrintPdf: function(){
          this.model.get('id');
          var urlParams = $.param({
              'action': 'tcpdf_offer',
              'module': this.module,
              'record': this.model.id,
          });
          var url = '?' + urlParams;
    
            app.alert.show('generating_pdf', {
                level: 'process',
                title: app.lang.get('LBL_GENERATING_PDF')
            });
    
          app.bwc.login(null,_.bind(function(){
              this._triggerDownload(url);
          },this));
        },
        _triggerDownload: function(url) {
            app.api.fileDownload(url, {
                success: function() {
                    app.alert.dismiss('generating_pdf');
                },
                error: function(data) {
                    // refresh token if it has expired
                    app.alert.dismiss('generating_pdf');
                    app.error.handleHttpError(data, {});
                }
            }, {iframe: this.$el});
        },
    })

  • Hi

    I noticed that several customizations you had placed at record.js could be moved to custom field templates instead, in order to follow best practices.

    Whenever you want to listen to a field and take some action then it would be better to create a custom field template for that purpose, this way you, probably, will not have a custom record.js anymore.

    This way your solution become even more flexible and safe from custom customization eventually applied by installed packages.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply
  • Hi

    I noticed that several customizations you had placed at record.js could be moved to custom field templates instead, in order to follow best practices.

    Whenever you want to listen to a field and take some action then it would be better to create a custom field template for that purpose, this way you, probably, will not have a custom record.js anymore.

    This way your solution become even more flexible and safe from custom customization eventually applied by installed packages.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children
No Data