We have a EUR accounting with some vendors that bill in GBP.
When you reconcile a foreigh currency vendor payment with multiple foreign currency vendor bills, Odoo will create a whole load of journal items to balance the currency exchange differences.
This can be problematic for the partner ledger. When we enter a vendor payment, we edit the journal entry by matching the EUR amount on the journal item for the Purchase account to the total EUR amount of the invoices to reconcile. The difference with the paid amount in EUR is booked in an additional journal item for exchange gains or loss.
You'd think that if the EUR amounts match, Odoo doesn't need to create any journal entries for exchange gain/loss, but unfortunately, Odoo will create lots of them, up to one per reconciled invoice. These journal entries cancel eachother resulting in a zero change in the underlying accounts. That's why I prefer to remove them.
I've tried to write an automated action to get rid of these entries, but I get stuck in the constraints on the database.
My best attempt so far is an automated action on model "Full Reconcile", triggered at creation, executing the following Python code:
for line in record.reconciled_line_ids:
if line.journal_id.code == 'EXCH':
line.remove_move_reconcile()
line.unlink()
Unfortunately, this throws an error as the Full Reconcile still seems to reference the removed exchange moves.
Does anyone have experience writing automated actions, particularly influencing the reconciliation process in v16.0?