The Products "Subpanel" on Quotes

I need to run a script when an item is Saved on the Quote.  So you pick a product from the dashlet, it is added to the SubPanel and then you click on the green button to save it.

As it is saved I need to check its 'product_template_id' and if it is one of 4 I need to set a checkbox on the parent quote.  If its not one of the 4 I am looking for then nothing happens.

Right now I have a timer that runs once a second and looks that way, its horrible but it works but I cant really see myself putting this in Production.  Does anyone know where I can attach a script to that save button and check there?

  • Please take a look here: 

    How do I refresh a subpanel when a record is added to a different subpanel? it should give you an idea on how to work with backbone events so you don't need to use timers.

  • I am looking for specific files or functions for this "subpanel".  Its more of a view really and I can find a place to tie into it.

  • Do you need to have this feature in place only on creating/editing a Quote or anytime? I mean, to look for that field on Product Templates only on managing a Quote or anythime the related Product Template is modified anyhow?

    For the first scenario you really need to copy the field from Product Templates to Products (via populate_fields on product_template_name field at Products module). Then you have to create a field on Product Bundles which will somehow rollup that field from Products and finaly to create a field on Quotes which will be a rollup from that field from Product Bundles, according to value from that field you can update your target field.

    For the second scenario a Scheduled Job certainly can do the job.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Only on the record view when editing a quote.  We dont 'create' quotes as they are created behind the scenes, so quotes are only edited.  So this feature would only need to happen when a user hits that green save button and saves a product to a quote.

    Not sure I have to worry about roll up or anything, I just want access to the product being added to the quote on the subpanel as it is being saved.  I need access in JavaScript as I need to check a box on the recordview of the quote.

    I need to set that checkbox so it is available for a JavaScript I have on another subpanel on quotes.  So essentially you cant add a record to this second subpanel UNLESS you add a specific type of record to the products subpanel.  When you add this specific type of procduct to the quote I want this checkbox checked.  I have a logic hook written that sets the checkbox on save of a product, but that doesnt affect the screen so the second subpanel still sees it as unchecked.  I thought about having it check the bean with an API call but that causes timing issues for me.  Checking the value of the checkbox is instant so it works.  I just need a way to set it in JavaScript.

    This would normally be easy for me but I cannot find the JavaScript that handles the save() on the products "subpanel" on a quote.

  • OK, I got the idea.

    So you need to extends the js controlle ProductsQuoteDataEditablelistbuttonField (modules/Products/clients/base/fields/quote-data-editablelistbutton/quote-data-editablelistbutton.js) and override the method _save.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada