custom line_items.js not working

I am completely new to SuiteCRM and I am working on my initial deployment.

I would like to change the way “discount” works on quote -> product line items. Instead of discount, I want it to function as a probability. For example, if I key in 20 and percent is selected, I want it to make the total equal to 20% of the list price rather than discount the price by 20 percent. Here is what I have tried.

I copied the file line_items.js from /modules/AOS_Products_Quotes to /custom/modules/AOS_Products_Quotes/
I then edited what I think is the relevant section of code to read:


    else if(dis == 'Percentage')
    {
      if(discount > 100)
      {
        document.getElementById(key + 'product_discount' + ln).value = 0;
        discount = 0;
      }
      discount = discount/100;
      discount = (1-discount) * listPrice;
      productUnitPrice = listPrice - discount;
      document.getElementById(key + 'product_unit_price' + ln).value = format2Number(listPrice - discount);
    }

And…nothing changes. The Sales Price field still reflects the discount field acting as a percent discount. I’ve tried clearing browser cache, etc., but to no avail.

What am I doing wrong?

Not all files are customizable… but this one looks like it is, the includes for it seem to be:


modules/AOS_Products_Quotes/Line_Items.php:35:        $html .= '<script src="modules/AOS_Products_Quotes/line_items.js"></script>';

modules/AOS_Products_Quotes/Line_Items.php:36:        if (file_exists('custom/modules/AOS_Products_Quotes/line_items.js')) {

modules/AOS_Products_Quotes/Line_Items.php:37:            $html .= '<script src="custom/modules/AOS_Products_Quotes/line_items.js"></script>';

So it seems to be looking in custom. Did you keep the correct uppercase characters? It’s Line_Items.php but line_items.js

There must have been a typo in my js file somewhere. I deleted the custom file and started over from scratch and it works now!