AnsweredAssumed Answered

Sugar 7.9: Custom Date Fields in Quotes causing problems

Question asked by on Jun 18, 2017

Hello... we are customizing the Quotes module and adding Line Items with a custom Date field to the screen.


It was working fine until the customer tested with this sequence:

1. Create a new Quote

2. Create a Group on the Quote

3. Create a line item in the Group   [screenshot1]

4. Create a second item in the Group:  the first line item vanishes [screenshot2] and you can not add more items to the Group.


On saved Quotes, everything seems to work just fine: can re-arrange, add and delete Groups and items without this occurring.



In the browser's console this fatal error is created:


sidecar.min.js:11 FATAL[2017-6-18 20:41:1]: Uncaught TypeError: Cannot read property 'place' of
      undefined at
      components_c1484f73362868394871bbc5f4ee9950.js on line 432
write @ sidecar.min.js:11
components_c1484f73362868394871bbc5f4ee9950.js:432 Uncaught TypeError: Cannot read property
   'place' of undefined
at n._dispose (components_c1484f73362868394871bbc5f4ee9950.js:432)
at n.dispose (sidecar.min.js:13)
at sidecar.min.js:13
at Function.m.each.m.forEach (eval at module.exports (sidecar.min.js:1), <anonymous>:5:2410)
at n._disposeFields (sidecar.min.js:13)
at n._render (sidecar.min.js:13)
at n._super (sidecar.min.js:13)
at n._render (components_391278ca226cbd7f1c148cfbf287a7e4.js:13659)
at n.render (sidecar.min.js:13)
at n.<anonymous> (sidecar.min.js:14)


Which comes from _dispose method in the stock Date.js Javascript controller for the Date field.



As a workaround, we have copied this file to the custom directory and wrapped the line in a catch/try block:


 _dispose: function() {
// FIXME: new date picker versions have support for plugin removal/destroy
// we should do the upgrade in order to prevent memory leaks

   if (this._hasDatePicker) {
     try {
       $(window).off('resize', this.$(this.fieldTag).data('datepicker').place);
     catch (e) {


Any better ideas?