Skip to Content
Menu
This question has been flagged
2 Replies
634 Views

Odoo Version: 16 on Odoo.sh

Problem:

I have invoices that were originally posted in USD, but have now somehow changed to KES (default company currency). Tracking values show a single employee did the change, practically, it's impossible. All the changes (Over 1000) occurred at the exact same time, and we have no customization that allows them to do this. The affected user only has read rights on invoices. I'm thinking there could have been an automated action that affected this, but I can't view the logs from yesterday.


Questions:


  1. What could possibly have caused this issue and how do I find out what's responsible?
  2. Why is tracking showing someone who has no rights as the person responsible?
  3. Has anyone ever encountered this issue, and how did you solve it?

Avatar
Discard
Best Answer

Dear James,

Quick Diagnosis
  1. Check if it's a rate problem
    • Go to: Accounting > Configuration > Currencies
    • Check if USD-KES rate was accidentally set to 1.0 recently.
  2. Verify automated actions
    • Go to: Settings > Technical > Automation > Scheduled Actions
    • Look for tasks related to:
      • Currency updates
      • Invoice batch processing
      • "Recalculate" or "Update" actions
  3. Review user permissions
    • Go to: Settings > Users
    • Open the user shown in tracking
    • Check if they have Technical Settings access (may bypass restrictions)
Immediate Fix
  1. Mass update invoices (if changes are wrong):
    python
    # Run in Settings > Technical > Python Console
    invoices = env['account.move'].search([('currency_id.name','=','KES'), ('state','=','posted')])
    invoices.write({'currency_id': env.ref('base.USD').id})
    env['account.move.line'].search([('move_id','in',invoices.ids)])._compute_amount_currency()
  2. Prevent recurrence:
    • Go to: Settings > Technical > Security > Record Rules
    • Add a rule restricting account.move currency changes:

      ['|', ('currency_id','=',False), ('currency_id','=',company.currency_id.id)]
Why Tracking Shows the Wrong User
  • Automated tasks often show the last admin user who triggered them.
  • The user might have viewed invoices before a system task ran (creating false tracking).
Next Steps
  1. If the issue persists, contact Odoo.sh support for full server logs.
  2. Create a backup before mass updates.

🚀 Did This Solve Your Problem?

If this answer helped you save time, money, or frustration, consider:

✅ Upvoting (👍) to help others find it faster

✅ Marking as "Best Answer" if it resolved your issue

Your feedback keeps the Odoo community strong! 💪

(Need further customization? Drop a comment—I’m happy to refine the solution!)

 

Avatar
Discard
Best Answer

What likely caused it:

  • A server-side process (automated action, scheduled job, script, or import) with sudo() access.
  • Tracking shows a user with no write rights because sudo() bypasses permissions and logs under the acting user.
  • How to find the cause:
  • Check Automated Actions
    Settings → Technical → Automation → Automated Actions
    Look for any on account.invoice or currency_id.
  • Check Scheduled Actions
    Settings → Technical → Automation → Scheduled Actions
    Look for jobs that run on invoice models.
  • Check Logs (if available)
    grep "currency_id" /var/log/odoo/odoo-server.log
    Check Database for changes on the day:
    SELECT id, write_uid, write_date FROM account_invoice
  • WHERE write_date::date = '2025-05-26';

How to prevent this:

  • Disable or review automated/scheduled actions.
  • Avoid sudo() in custom code unless strictly necessary.
  • Use auditlog (community module) for deeper tracking.
  • Take regular backups.


Avatar
Discard
Related Posts Replies Views Activity
2
Jul 25
184
1
Jul 25
414
2
Jul 25
419
2
Jun 25
672
1
May 25
811