Skip to content

Conversation

Kev-Roche
Copy link
Contributor

This module add an import type allowing to: create only, update only or both.

@Kev-Roche Kev-Roche force-pushed the 14.0-add-pattern_import_export_import_type branch 7 times, most recently from e7c8f6c to cdb3a14 Compare September 1, 2023 20:29
Comment on lines 12 to 17
def _load_records_write(self, values):
import_type = self._context.get("pattern_import_type", None)
if import_type:
if import_type in ("update_and_creation", "update_only"):
return super()._load_records_write(values)
else:
raise ValidationError(_("Import Type not allowing updating record."))
else:
return super()._load_records_write(values)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _load_records_write(self, values):
import_type = self._context.get("pattern_import_type", None)
if import_type:
if import_type in ("update_and_creation", "update_only"):
return super()._load_records_write(values)
else:
raise ValidationError(_("Import Type not allowing updating record."))
else:
return super()._load_records_write(values)
def _load_records_write(self, values):
import_type = self._context.get("pattern_import_type")
if import_type and import_type not in ("update_and_creation", "update_only"):
raise ValidationError(_("Import Type not allowing updating record."))
else:
return super()._load_records_write(values)

@Kev-Roche Kev-Roche force-pushed the 14.0-add-pattern_import_export_import_type branch from cdb3a14 to 712241e Compare September 4, 2023 14:43
@Kev-Roche Kev-Roche force-pushed the 14.0-add-pattern_import_export_import_type branch from 712241e to 9a40f91 Compare September 5, 2023 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants