-
-
Notifications
You must be signed in to change notification settings - Fork 63
connector_search_engine: improve state update wiz #189
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: 16.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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -216,12 +216,14 @@ def _jobify_batch_sync(self, force_export: bool = False) -> None: | |||||
| description=description, identity_key=identity_exact | ||||||
| ).batch_sync(force_export) | ||||||
|
|
||||||
| def _jobify_batch_recompute(self, force_export: bool = False) -> None: | ||||||
| def _jobify_batch_recompute( | ||||||
| self, force_export: bool = False, binding_ids: list | None = None | ||||||
| ) -> None: | ||||||
| self.ensure_one() | ||||||
| description = _("Prepare a batch recompute of index '%s'") % self.name | ||||||
| self.with_delay( | ||||||
| description=description, identity_key=identity_exact | ||||||
| ).batch_recompute(force_export) | ||||||
| ).batch_recompute(force_export, binding_ids=binding_ids) | ||||||
|
Member
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. Strictly speaking this job description is now inaccurate because it is now a partial recompute? So maybe this method should be split too? |
||||||
|
|
||||||
| @api.model | ||||||
| def generate_batch_sync_per_index(self, domain: list | None = None) -> None: | ||||||
|
|
@@ -256,11 +258,16 @@ def _get_domain_for_recomputing_binding(self, force_export: bool = False) -> lis | |||||
| states.append("recomputing") | ||||||
| return [("index_id", "=", self.id), ("state", "in", states)] | ||||||
|
|
||||||
| def batch_recompute(self, force_export: bool = False) -> None: | ||||||
| def batch_recompute( | ||||||
| self, force_export: bool = False, binding_ids: list | None = None | ||||||
|
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.
Suggested change
Member
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. What do you think about doing another method? ( |
||||||
| ) -> None: | ||||||
| """Recompute all the bindings of the index marked as to_recompute.""" | ||||||
| self.ensure_one() | ||||||
| domain = self._get_domain_for_recomputing_binding(force_export) | ||||||
| bindings = self.env["se.binding"].search(domain) | ||||||
| if binding_ids: | ||||||
| bindings = self.env["se.binding"].browse(binding_ids) | ||||||
| else: | ||||||
| domain = self._get_domain_for_recomputing_binding(force_export) | ||||||
| bindings = self.env["se.binding"].search(domain) | ||||||
| bindings_count = len(bindings) | ||||||
| for batch in bindings._batch(self.batch_recomputing_size): | ||||||
| description = _( | ||||||
|
|
||||||
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.