Files

39 lines
1.4 KiB
Markdown

# 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