Quotes - Defaulting the tax rate in tax rate select

Hi,

How can I default the tax rate for a quote? We have only 1 tax rate and want it displayed by default.

I've looked in studio and dropdowns, but cannot see an obvious way to default it - I thought 'Tax Rate' would have been a field in Studio that I could default, but this is not the case. So I'm suspecting that I need to look elsewhere or make a code-level change.

Could someone please point me in the right direction?

We're on SugarCRM 7.9.2.0

Thanks in advance,

Gary.

Parents Reply Children
  • Thanks Greg.

    I wish I was aware of that before I coded the defaulting in JS!

    Regards,

    Gary.

  • SOLUTION(S)

    Here's my solution anyhow to re-default the tax rate in javascript. Thanks @andopes for the suggestion of altering the SugarLogic field. Had I have known it was a bug this would have been a simpler temp workaround. Without that knowledge, I didn't want to hardcode the rate into a formula.

    This solution tested on 7.10.0.0

    Added file custom/modules/Quotes/clients/base/views/create/create.js

    ({
        extendsFrom: 'CreateView',

        initialize: function (options) {
            this._super('initialize', [options]);

            console.log("Custom Quotes Create View JS create.js loaded.");

           //
           // Default tax rate to first found tax rate in TaxRates module.
           //
           var trId = this.model.get("taxrate_id"); // current tax rate id. Will be empty for a new Quote.
           var self = this;

           if (_.isEmpty(trId)) {

               // Get All Tax Rates
               var taxrateBeanCollection = app.data.createBeanCollection("TaxRates");

               taxrateBeanCollection.fetch({
                   success: function() {

                   if (taxrateBeanCollection.models.length > 0) {
                       var taxRateBeanModel = taxrateBeanCollection.models[0];

                       var trId = taxRateBeanModel.get("id"); // field name as it is in TaxRates
                       var trName = taxRateBeanModel.get("name"); // field name as it is in TaxRates
                       var trValue = taxRateBeanModel.get("value"); // field name as it is in TaxRates

                       console.log("First discovered TaxRate", trId, trName, trValue);

                       self.model.set("taxrate_id", trId); // field name as it is in Quotes
                       self.model.set("taxrate_name", trName); // field name as it is in Quotes
                       self.model.set("taxrate_value", trValue); // field name as it is in Quotes
                   }

               }}, this);

           }
       }
    })
  • Can we please bring this back as a default and/or add the ability to set tax based on a client status? I know, I know, I can pay a developer to make it happen but somethings should be base functionality. This is one of them. 

  • Hello,

    Update on the 29.04.2020 : in v10 the default tax rate is still missing on Quotes. The good news is that the workaround from Gary Smart is still working.