Quote line items don't show discount

A customer of ours has been upgraded to 10.3 In the past they ran their Quote module in BWC mode (until 10.2) but we have finally moved them over to the sidecar version of the quotes module. All seems to be fine except for one particular thing. 

On a Quote we have 10 line items. All of these items have a discount (stored in discount_amount on the database) and its percentage. So the discount_select field is 1 (true). When we open the quote in BWC mode we can see the discount amount and the percentage. But when we switch to sidecar that information is gone? 

The 'funny' thing is that the total amount of the bundle is correct ( calculated including the discount) and even the quote total is correct, calculcated including discount. So somewhere the display of the field is going wrong. When I edit the field and fill in lets say 15% the discounts are recalculated etc but as we refresh the quote, after save, the field is blank again. When we open the product we can see that the discount has been changed over there? 

Does this sound familiar for anyone? Or does anyone have a clue where to look for a solution?

  • Hi Jeroen, 

    This sounds very similar to the behavior described on this defect 82730

    Can you try the workaround in a test instance to check if this is the case:

    1 - Navigate to Admin -> Studio -> Quoted Line Items -> Layouts -> List View -> “Restore Default Layout” -> Save & Deploy
    2 – Navigate to Admin -> Quotes Configuration and re-Save the “Worksheet Columns”

    This will force the rebuild of the record view files and should have the discount showing again. 

    Let me know if it helps. 

  • For anyone coming across this who has customizations, and therefore cannot simply restore the default views for Quoted Line items:

    I did a careful comparison of the custom and stock views and found a significant difference between the stock quoted line item discount fieldset and the custom one (which was copied from a previous version's stock instance).

    v11 (I assume also v10, we went from 9 to 11):

                    array(
                        'name' => 'discount_field',
                        'type' => 'fieldset',
                        'css_class' => 'discount-field quote-discount-percent',
                        'label' => 'LBL_DISCOUNT_AMOUNT',
                        'labelModule' => 'Products',
                        'show_child_labels' => false,
                        'sortable' => false,
                        'fields' => array(
                            array(
                                'name' => 'discount_amount',
                                'label' => 'LBL_DISCOUNT_AMOUNT',
                                'type' => 'discount-amount',
                                'discountFieldName' => 'discount_select',
                                'related_fields' => array(
                                    'currency_id',
                                ),
                                'convertToBase' => true,
                                'base_rate_field' => 'base_rate',
                                'showTransactionalAmount' => true,
                            ),
                            array(
                                'type' => 'discount-select',
                                'name' => 'discount_select',
                                'options' => array(),
                            ),
                        ),
                    ),
    

    v9

                    array(
                        'name' => 'discount',
                        'type' => 'fieldset',
                        'css_class' => 'quote-discount-percent',
                        'label' => 'LBL_DISCOUNT_AMOUNT',
                        'fields' => array(
                            array(
                                'name' => 'discount_amount',
                                'label' => 'LBL_DISCOUNT_AMOUNT',
                                'type' => 'discount',
                                'convertToBase' => true,
                                'showTransactionalAmount' => true,
                            ),
                            array(
                                'type' => 'discount-select',
                                'name' => 'discount_select',
                                'no_default_action' => true,
                                'buttons' => array(
                                    array(
                                        'type' => 'rowaction',
                                        'name' => 'select_discount_amount_button',
                                        'label' => 'LBL_DISCOUNT_AMOUNT',
                                        'event' => 'button:discount_select_change:click',
                                    ),
                                    array(
                                        'type' => 'rowaction',
                                        'name' => 'select_discount_percent_button',
                                        'label' => 'LBL_DISCOUNT_PERCENT',
                                        'event' => 'button:discount_select_change:click',
                                    ),
                                ),
                            ),
                        ),
                    ),


    I copied and pasted the new field set definition into my custom quote-data-group-list view:

    custom/modules/Products/clients/base/views/quote-data-group-list/quote-data-group-list.php

    similarly for 

    custom/modules/Products/clients/base/views/record/record.php

    This is where things get interesting...

    For reasons I won't go into I took two paths in two different testing environments:

    Option 1) 9.0.x -> 9.0.6 -> 10.0.4 -> 11.0.1

    Option 2) 9.0,x ->9.0.3-> 10.0.3 -> 10.0.4 -> 11.0.0 -> 11.0.1

    While in the first case the changes above were sufficient, in the second the product line items would show "Loading" forever... 

    The console showed an error:

    Cannot set properties of undefined (setting 'label')

    Which I tracked down to 

    the onDiscountChanged function in 
    modules/Products/clients/base/fields/discount-select/discount-select.js

    and with some digging and some luck, I found that there was a field type in the instance upgraded with the Option 2 path, that was not in the instance upgraded with the option 1 path.

    modules/Products/clients/base/fields/discount-select/*

    by moving this directory to modules/Products/clients/base/fields/discount-select-temp and doing a QRR I found that the Quoted line items worked correctly again.

    , this may be worth reporting on Bug 82730

    FrancescaS