Anyway to refresh the Quote screen when adding Product?

Hi everyone.

I'm trying to refresh the quote screen once a new product line is added. I can "force" this change by adding a checkbox and once that checkbox is ticked then it runs this.model.fetch(); which works fine.

However I want to automate this, I tried forcing the checkbox on the product save but it doesn't seem to work.

Is there anyway to refresh the Quote screen when a Product relationship is added?

Thanks,

Daniel

Parents
  • Hi 

    I had a similar request for a different module and at that time what I've done was to customise the button that I wanted to trigger the parent refresh. 

    Transporting this to your scenario a possible approach is to have a look at this button  and add the following code after the save action: 

        _save: function() {
                this.view.layout.trigger('editablelist:' + this.view.name + ':saving', true, this.model.cid);
    
            if (this.view.model.isNew()) {
                this.view.context.parent.trigger('quotes:defaultGroup:save', _.bind(this._saveRowModel, this));
            } else {
                this._saveRowModel();
            }
              //Refreshing the parent Quote data
             var parent = this.context.get("parentModel");
             parent.fetch();
        },
    


    The core code of this button can be found in: 

    Sugar/modules/Products/clients/base/fields/quote-data-editablelistbutton/quote-data-editablelistbutton.js


    Can you check if this will work for you? 

    Cheers, 

    André

Reply
  • Hi 

    I had a similar request for a different module and at that time what I've done was to customise the button that I wanted to trigger the parent refresh. 

    Transporting this to your scenario a possible approach is to have a look at this button  and add the following code after the save action: 

        _save: function() {
                this.view.layout.trigger('editablelist:' + this.view.name + ':saving', true, this.model.cid);
    
            if (this.view.model.isNew()) {
                this.view.context.parent.trigger('quotes:defaultGroup:save', _.bind(this._saveRowModel, this));
            } else {
                this._saveRowModel();
            }
              //Refreshing the parent Quote data
             var parent = this.context.get("parentModel");
             parent.fetch();
        },
    


    The core code of this button can be found in: 

    Sugar/modules/Products/clients/base/fields/quote-data-editablelistbutton/quote-data-editablelistbutton.js


    Can you check if this will work for you? 

    Cheers, 

    André

Children