feat: add dlv_account_move_copy_ref — copy customer ref on duplicate of customer invoice/credit note, with OK-popup warning

This commit is contained in:
Kristof Bernaert
2026-10-04 18:43:39 +02:00
parent aa0bafca84
commit 2dc424a7d0
9 changed files with 203 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
# dlv_account_move_copy_ref
## Overview
In core Odoo the reference of an invoice (`account.move.ref`, label
**Customer Reference** on customer documents) is not copied when the invoice is
duplicated. This addon makes it copy, and warns the user afterwards.
## How it works
- **Python** (`models/account_move.py`): `ref` gets `copy=True`. `copy_data()`
removes it again for every move that is not `out_invoice` / `out_refund`, so
vendor bills and journal entries keep the core behaviour. An explicit `ref`
in the `default` dict always wins (credit note reversal sets its own).
- **JS** (`static/src/js/duplicate_warning.js`): patches
`FormController.duplicateRecord`. After the duplicate, if the new record is an
`account.move` customer invoice/credit note with a non-empty `ref`, a modal alert dialog (OK button)
warning is shown: "'Customer Reference' was also copied, check
whether it is still relevant or should be removed." (nl: "'Referentie klant'
werd ook gekopieerd, kijk na of dit relevant is of dient verwijderd te
worden.")
## Scope
- Only the Duplicate action in the form view shows the warning. Server-side
`copy()` calls (e.g. recurring entries) copy the reference silently.
- No warning when `ref` is empty.
## Compatibility
- Odoo 16.0 (Community and Enterprise)
- Depends on: `account`
## Credits
bv Domus La Vila — https://domuslavila.eu
License: LGPL-3