1

I uploaded some invoices in bulk to odoo, and I have a problem with the currency. Currently the currency is in USD but the values are being calculated with MXN. The lines of the invoice are in USD but the total appears with MXN. To correct it I can edit the invoice and change it to MXN, then to USD again which triggers a recalculation of the invoice and the problem is corrected. The problem is that there are more than 2000 invoices. I am trying to do a server action with this code:

    for invoice in records:
      # invoice.write({'currency_id': 33})
      invoice._onchange_currency()
      invoice._compute_amount()
      # invoice.update({'currency_id': 2})
      #for line in invoice['invoice_line_ids']:
      #  precio = line['price_unit']
      #  line['product_uom_id'] = 1
      #  line['price_unit'] = precio

But this does not trigger the calculation of the invoice. Is there any other method that does this or that allows me to simulate the aforementioned manual correction to correct these values?

Legna
  • 460
  • 6
  • 19

0 Answers0