Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pattern_import_export/wizard/import_pattern_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ class ImportPatternWizard(models.TransientModel):
)
import_file = fields.Binary(string="File to import", required=True)
filename = fields.Char()
company_id = fields.Many2one(
string="Company",
comodel_name="res.company",
help="If set, import data in the context of the specified company.\n"
"Allow to set company dependent fields in the right company\n"
"Default company is the active one.",
)

def action_launch_import(self):
"""
Expand All @@ -38,7 +45,8 @@ def action_launch_import(self):
"pattern_config_id": self.pattern_config_id.id,
}
)
pattern_file_import.with_delay(
company = self.company_id or self.env.company
pattern_file_import.with_company(company.id).with_delay(
priority=self.pattern_config_id.job_priority
).split_in_chunk()
return pattern_file_import
1 change: 1 addition & 0 deletions pattern_import_export/wizard/import_pattern_wizard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
options="{'no_create_edit': True}"
invisible="context.get('hide_pattern_config_id')"
/>
<field name="company_id" />
<field name="filename" invisible="1" />
<field
name="import_file"
Expand Down