From 076ad12f85dc40aeaaa7d1ad151f3eab6c86888e Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Thu, 25 Aug 2022 17:29:00 +0200 Subject: [PATCH] edi: fix record and type copy on fields --- edi_oca/models/edi_exchange_record.py | 10 ++++++---- edi_oca/models/edi_exchange_type.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/edi_oca/models/edi_exchange_record.py b/edi_oca/models/edi_exchange_record.py index bfb7bf176..18834c6ce 100644 --- a/edi_oca/models/edi_exchange_record.py +++ b/edi_oca/models/edi_exchange_record.py @@ -20,8 +20,8 @@ class EDIExchangeRecord(models.Model): _order = "exchanged_on desc, id desc" _rec_name = "identifier" - identifier = fields.Char(required=True, index=True, readonly=True) - external_identifier = fields.Char(index=True, readonly=True) + identifier = fields.Char(required=True, index=True, readonly=True, copy=False) + external_identifier = fields.Char(index=True, readonly=True, copy=False) type_id = fields.Many2one( string="Exchange type", comodel_name="edi.exchange.type", @@ -38,9 +38,10 @@ class EDIExchangeRecord(models.Model): required=False, readonly=True, model_field="model", + copy=False, ) related_name = fields.Char(compute="_compute_related_name", compute_sudo=True) - exchange_file = fields.Binary(attachment=True) + exchange_file = fields.Binary(attachment=True, copy=False) exchange_filename = fields.Char( compute="_compute_exchange_filename", readonly=False, store=True ) @@ -53,6 +54,7 @@ class EDIExchangeRecord(models.Model): edi_exchange_state = fields.Selection( string="Exchange state", readonly=True, + copy=False, default="new", selection=[ # Common states @@ -72,7 +74,7 @@ class EDIExchangeRecord(models.Model): ("input_processed_error", "Error on process"), ], ) - exchange_error = fields.Text(readonly=True) + exchange_error = fields.Text(string="Exchange error", readonly=True, copy=False) # Relations w/ other records parent_id = fields.Many2one( comodel_name="edi.exchange.record", diff --git a/edi_oca/models/edi_exchange_type.py b/edi_oca/models/edi_exchange_type.py index 76bee1360..d535170dc 100644 --- a/edi_oca/models/edi_exchange_type.py +++ b/edi_oca/models/edi_exchange_type.py @@ -45,7 +45,7 @@ class EDIExchangeType(models.Model): comodel_name="queue.job.channel", ) name = fields.Char(required=True) - code = fields.Char(required=True) + code = fields.Char(required=True, copy=False) direction = fields.Selection( selection=[("input", "Input"), ("output", "Output")], required=True )