enable edit for Product discount_price

Hi Guys,

I need a few words of wisdom here..

While creating a Product, before you select the product template, the field discount_price is enabled for edit..

But after we select a product template, that field is auto filled, and disabled.

What is the best to do in this case? - I need that field to remain enabled so the client can either use the calculated value, or change it to something else...

  • I managed to figure it out..

    For anyone who needs, I overrided the 3 JS classes:

    • custom\modules\Products\clients\base\views\create\create.js
    • custom\modules\Products\clients\base\views\create-actions\create-actions.js
    • custom\modules\Products\clients\base\views\record\record.js

    In each of then I added these 2 functions:

    loadData : function(options) {
    this.context.get('model').on("change:discount_price", function(model, value){
    console.log('entrou CHANGE');
    _.defer(function(){
    $('input[name=discount_price]').attr('disabled',false);
    });
    }, this);
    },

    editClicked : function() {
    this.setButtonStates(this.STATE.EDIT);
    this.toggleEdit(true);

    _.defer(function(){
    $('input[name=discount_price]').attr('disabled',false);
    });
    },

    this way when we edit the Product record, the field will be enabled for edit,

    and everytime a productTemplate is choosen,

    after the price is auto-filled, it will remain enabled for edit, in case you need to change the price manually.