Hi everyone ! In the Quotes page of the MyAccount ...
# suitecommerce
s
Hi everyone ! In the Quotes page of the MyAccount section, I would like to override the native status filters, because, it currently filters on the entityStatus field, but I would like to filter on the status field. So, I've written an extension to override the core functionality, and below is my code. When I test it, I can see the first console.log and the first function (the status list is changed on the front-end with ones that I've set up here), but I cannot see the other console.log inside the two other functions. Also, this code is not executed so the back-end is still filtering on entityStatus. Can anyone help me please ? I don't know if I try to override the right functions neither or if there is another way to do this ! Thanks 🙂
Copy code
define('OverrideQuoteFilters.EntryPoint', [
  'Quote.List.View',
  'Quote.Model',
  'Utils',
], function (QuoteListView, QuoteModel, Utils) {
  'use strict';
  console.log('Step 1');

  // Overriding the filter to stick with the quote status instead of entityStatus
  // OK
  QuoteListView.prototype.filterOptions = [
    {
      value: 'ALL',
      name: Utils.translate('Show all statuses'),
      selected: true,
    },
    {
      value: 'A',
      name: Utils.translate('Open'),
    },
    {
      value: 'B',
      name: Utils.translate('Processed'),
    },
    {
      value: 'C',
      name: Utils.translate('Closed'),
    },
    {
      value: 'V',
      name: Utils.translate('Expired'),
    },
    {
      value: 'X',
      name: Utils.translate('Voided'),
    },
    {
      value: 'Y',
      name: Utils.translate('Undefined'),
    },
  ];

  // Overriding the method to fetch the quotes based on the status instead of entityStatus
  QuoteModel.prototype.setExtraListFilters = function () {
    console.log('Step 2');
    if (this.data.filter && this.data.filter !== 'ALL') {
      // this.filters.entitystatus_operator = 'and';
      // this.filters.entitystatus = ['entitystatus', 'is', this.data.filter];
      this.filters.status_operator = 'and';
      this.filters.status = ['status', 'is', this.data.filter];
    }
  };

  QuoteModel.prototype._getQuoteStatus = function (estimate_id) {
    console.log('Step 3');
    const estimates = nlapiSearchRecord(
      'estimate',
      null,
      [['internalid', 'is', estimate_id], 'and', ['mainline', 'is', 'T']],
      // [new nlobjSearchColumn('entitystatus')]
      [new nlobjSearchColumn('status')]
    );

    return estimates[0];
  };
});
c
Might be having a context problem? After
'use strict;'
try putting your function overrides into this:
Copy code
return {
	mountToApp: function (application) {
    ... your code here ....
}
Like here: https://developers.suitecommerce.com/develop-your-first-extension.html#add-an-entry-point-javascript-file