AnsweredAssumed Answered

How to populate currency type based on Quotes for Quoted line item

Question asked by Sundar Kumar on Jan 15, 2020
Latest reply on Jan 17, 2020 by André Lopes

When i am changing the Product Template Field from Quoted Line Item, Currency Type fields are getting populated automatically from Product Catalog record. But i want to display currency values based on Quotes module currency type.

 

For eg:

Quote Currency Type: € (EUR)

Product Catalog Currency Type: $ (USD)

When i am selecting product template field from quoted line item, it should always display the currency values in € (EUR)

 

I have done changes in custom/modules/Products/clients/base/fields/quote-data-relate/quote-date-relate.js file. But it's still showing Product Catalog currency type.

 

({

     extendsFrom: 'ProductsQuoteDataRelateField',
     initialize: function(options){
     this._super('initialize',[options]);
     this.model.on('change:product_template_name',this.triggeronChange, this);     
     },

triggeronChange: function(){
          var self=this;
          var  attr = this.model.attributes,
          product_template_id = attr.product_template_id,//LineItem ID
          product_template_name = attr.product_template_name;//LineItem Name
          
if(attr.product_template_id){
     var Quotecurrency_id = self.context.parent.get('model').get("currency_id");
          var Quotebase_rate = self.context.parent.get('model').get("base_rate");
          if (self.model.get('id') == undefined) {
               self.model.set('currency_id',Quotecurrency_id);
               self.model.set('base_rate',Quotebase_rate);
                                   
          }
     }
},
          
          
     
})

Outcomes