-
Notifications
You must be signed in to change notification settings - Fork 106
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] shopinvader_locomotive: avoid unnecessary partner exports #1578
base: 14.0
Are you sure you want to change the base?
[14.0][IMP] shopinvader_locomotive: avoid unnecessary partner exports #1578
Conversation
bc97da5
to
95b102a
Compare
@skip_if(lambda self, record, **kwargs: self.no_connector_export(record)) | ||
def on_record_write(self, record, fields=None): | ||
# skip export if updating only fields that are not relevant | ||
if set(fields).issubset(set(self._get_export_not_triggered_fields())): |
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.
Could this be an issue?
>>> set(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not iterable
I would check if fields
is set first, and _get_export_not_triggered_fields
, because it can be overridden to return None
or False
depending on a company setting in the future, for instance.
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.
Great points. Made modifications and added tests to cover the mentioned scenarios
95b102a
to
8d1fa38
Compare
with patch( | ||
"odoo.addons.shopinvader_locomotive.component.event_listeners.ShopinvaderBindingListener._get_export_not_triggered_fields", | ||
mock_get_export_not_triggered_fields, | ||
): |
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.
Is pre-commit happy about that?
with patch( | |
"odoo.addons.shopinvader_locomotive.component.event_listeners.ShopinvaderBindingListener._get_export_not_triggered_fields", | |
mock_get_export_not_triggered_fields, | |
): | |
method_path = ( | |
"odoo.addons.shopinvader_locomotive.component.event_listeners." | |
"ShopinvaderBindingListener._get_export_not_triggered_fields" | |
) | |
with patch(method_path, mock_get_export_not_triggered_fields): |
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.
pre-commit
issues fixed and changes pass them now
8d1fa38
to
00afd15
Compare
00afd15
to
5c44d63
Compare
/ocabot merge minor |
shopinvader_locomotive: avoid unnecessary partner exports by not executing the export if the updated fields contain only:
external_id
last_login_time