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

  • 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: 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    _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();
    },
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    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é

  • Hi - Thank you I'll take a quick look and feedback :) 

  • Hi That does seem to work but I now get this error in console and a "saving" box sticks after save. Any ideas why that may be?

  • Hum, can you share the code that you are using? 

    On my test the error was not happening, but I copied all the quote-data-editablelistbutton.js instead of extending it. 

  • That was the same as what I did, I was planning to copy the whole thing then extend when it works but I just copy/pasted at the moment.

  • Hi Daniel,

    Can I ask why you need to refresh the whole quote screen, or is it only specific field updates you need?

    .

    CRM Business Consultant