'Fetch RM rate as per today\'s valuation rate and calculate totals'

def calculate_sm_cost(self):

    total_sm_cost = 0
    base_total_sm_cost = 0
    for d in self.get(u'scrap_items'):
        d.base_rate = (d.rate * self.conversion_rate)
        d.amount = (flt(d.rate, self.precision(u'rate', d)) * flt(d.stock_qty, self.precision(u'stock_qty', d)))
        d.base_amount = (d.amount * self.conversion_rate)
        total_sm_cost += d.amount
        base_total_sm_cost += d.base_amount
    self.scrap_material_cost = total_sm_cost
    self.base_scrap_material_cost = base_total_sm_cost
