Files

21 lines
640 B
Python

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