-
-
Notifications
You must be signed in to change notification settings - Fork 152
[FIX][18.0] connector_importer: take full control of what are the required_keys #162
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
base: 18.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,9 +53,18 @@ def required_keys(self, create=False): | |
| The recordset will use this to show required fields to users. | ||
| """ | ||
| req = dict(self.required) | ||
| req.update(self.work.options.mapper.get("required_keys", {})) | ||
|
|
||
| if self.required_keys_ignore_mapper: | ||
| req = self.work.options.mapper.get("required_keys", {}) | ||
| else: | ||
| req.update(self.work.options.mapper.get("required_keys", {})) | ||
|
|
||
| return req | ||
|
|
||
| @property | ||
| def required_keys_ignore_mapper(self): | ||
| return self.work.options.mapper.get("required_keys_ignore_mapper", False) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I remember well, we decided to use WDYT?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It has been a long time since we discussed this topic, but AFAIR The present commit body states: The business use case for this was around updating product.product records with weight and size values provided by an external system. The external system reads the product barcode and creates unique records based on it. So here required_keys_ignore_mapper and required_keys worked in pair. If we set the default as True, it will ignore the value in self.required 3e9b0c0#diff-1dc9a52e0c26498d8a6b7eeb06f5c031c5f862c67263f047f2cd187be6c37811L55-L56 and create some issues when we use the importer in order to create records if we didn't check all required columns. But I agree required_keys on the mapper should contain all required keys according to the DB schema if we want take full control of it |
||
|
|
||
| translatable = [] | ||
|
|
||
| def translatable_keys(self, create=False): | ||
|
|
||
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.
if this case you should not use update before