From 80c9239d69f11561982d9795574d4d236d960bd9 Mon Sep 17 00:00:00 2001 From: Kev-Roche Date: Wed, 6 Sep 2023 19:33:13 +0200 Subject: [PATCH] [14.0][IMP] support company dependent fields --- pattern_import_export/models/pattern_file.py | 7 +++++++ pattern_import_export/wizard/import_pattern_wizard.py | 1 + 2 files changed, 8 insertions(+) diff --git a/pattern_import_export/models/pattern_file.py b/pattern_import_export/models/pattern_file.py index ccbe4879..07c7147c 100644 --- a/pattern_import_export/models/pattern_file.py +++ b/pattern_import_export/models/pattern_file.py @@ -29,6 +29,13 @@ class PatternFile(models.Model): chunk_ids = fields.One2many("pattern.chunk", "pattern_file_id", "Chunk") date_done = fields.Datetime() + company_id = fields.Many2one( + comodel_name="res.company", + default=lambda self: self.env.company.id, + required=False, + string="Company", + ) + @api.depends("chunk_ids.nbr_error", "chunk_ids.nbr_success") def _compute_stat(self): for record in self: diff --git a/pattern_import_export/wizard/import_pattern_wizard.py b/pattern_import_export/wizard/import_pattern_wizard.py index fbe5449e..bf0469e5 100644 --- a/pattern_import_export/wizard/import_pattern_wizard.py +++ b/pattern_import_export/wizard/import_pattern_wizard.py @@ -36,6 +36,7 @@ def action_launch_import(self): "datas": self.import_file, "kind": "import", "pattern_config_id": self.pattern_config_id.id, + "company_id": self.env.company.id, } ) pattern_file_import.with_delay(