-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[14.0][IMP] add default_value for import and export #114
Open
chafique-delli
wants to merge
2
commits into
shopinvader:14.0
Choose a base branch
from
akretion:14.0-imp-pattern_import_export_custom_header
base: 14.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[14.0][IMP] add default_value for import and export #114
chafique-delli
wants to merge
2
commits into
shopinvader:14.0
from
akretion:14.0-imp-pattern_import_export_custom_header
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chafique-delli
force-pushed
the
14.0-imp-pattern_import_export_custom_header
branch
2 times, most recently
from
February 7, 2023 11:11
bc4a28c
to
f228775
Compare
ping @sebastienbeau |
chafique-delli
force-pushed
the
14.0-imp-pattern_import_export_custom_header
branch
from
February 7, 2023 16:35
f228775
to
d4326da
Compare
sebastienbeau
requested changes
Feb 17, 2023
_inherit = "base" | ||
|
||
def _pattern_format2json(self, row): | ||
pattern_config_ctx = self._context.get("pattern_config") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config = self._context["pattern_config"]["pattern_file"].pattern_config_id
Comment on lines
17
to
23
for custom_header in pattern_config.custom_header_ids: | ||
value = "" | ||
if custom_header.name in row: | ||
value = row[custom_header.name] | ||
if not value and custom_header.import_default_value: | ||
value = custom_header.import_default_value | ||
new_row[custom_header.initial_header_name] = value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
for custom_header in pattern_config.custom_header_ids: | |
value = "" | |
if custom_header.name in row: | |
value = row[custom_header.name] | |
if not value and custom_header.import_default_value: | |
value = custom_header.import_default_value | |
new_row[custom_header.initial_header_name] = value | |
new_row = { | |
header.initial_header_name: row.get(header.name) or header.import_default_value | |
for header in custom_header_ids | |
} | |
if new_row: | |
row = new_row |
chafique-delli
force-pushed
the
14.0-imp-pattern_import_export_custom_header
branch
from
February 17, 2023 11:06
d4326da
to
ae76975
Compare
chafique-delli
force-pushed
the
14.0-imp-pattern_import_export_custom_header
branch
from
December 22, 2023 13:24
4baccd8
to
515c654
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cc @sebastienbeau