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

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);
                                   
          }
     }
},
          
          
     
})
  • You have to create an extended vardefs for Products and remove the entry currency_id from field product_template_name, attribute populate_list.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Thanks Andre for your help.

    I have commented currency_id from product_template_name in populate_list attribute. but now i want to populate currency_id from Quotes module when user changes product_template_id field in the line-items.

    <?php
    // created: 2019-12-23 05:01:24
    $dictionary['Product']['fields']['product_template_name']['populate_list']= array (
            'name' => 'name',
            'category_id' => 'category_id',
            'category_name' => 'category_name',
            'mft_part_num' => 'mft_part_num',
            'list_price' => 'list_price',
            'cost_price' => 'cost_price',
            'discount_price' => 'discount_price',
            'list_usdollar' => 'list_usdollar',
            'cost_usdollar' => 'cost_usdollar',
            'discount_usdollar' => 'discount_usdollar',
            'tax_class' => 'tax_class',
            'weight' => 'weight',
            'type_id' => 'type_id',
            'type_name' => 'type_name',
            'manufacturer_id' => 'manufacturer_id',
            'manufacturer_name' => 'manufacturer_name',
            //~ 'currency_id' => 'currency_id',
            //~ 'base_rate' => 'base_rate',
          );

    ?>

  • This should work exactly like that on version 9.x.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • I am using 9.x version only. After commenting currency_id from populate list, currency type showing same as Quote but currency value conversion is not happening when i am changing product template field