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
@@ -0,0 +1,20 @@
from odoo import fields, models
CUSTOMER_MOVE_TYPES = ("out_invoice", "out_refund")
class AccountMove(models.Model):
_inherit = "account.move"
# Core has copy=False. Flipped to True here; copy_data() below limits the
# effect to customer invoices and credit notes.
ref = fields.Char(copy=True)
def copy_data(self, default=None):
data_list = super().copy_data(default)
if default and "ref" in default:
return data_list
for move, data in zip(self, data_list):
if move.move_type not in CUSTOMER_MOVE_TYPES:
data.pop("ref", None)
return data_list