Skip to content

Commit

Permalink
connector_search_engine: allow recompute specific bindings
Browse files Browse the repository at this point in the history
_jobify_batch_recompute and batch_recompute now accept a binding_ids param

to force the records to be computed.

Known limitation: can be used only to recompute.

In the future, it would be nice if we can simply chain groups of jobs
to export records once recomputed.
  • Loading branch information
simahawk committed Feb 26, 2024
1 parent cc3d828 commit 2d391aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion connector_search_engine/wizards/se_binding_state_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ class SeBindingStateUpdater(models.TransientModel):
selection=lambda self: self.env["se.binding"]._fields["state"].selection,
required=True,
)
do_it_now = fields.Boolean(help="Don't wait for the cron to process these records")

def doit(self):
res_ids = self.env.context.get("active_ids")
self.env["se.binding"].browse(res_ids).write({"state": self.state})
bindings = self.env["se.binding"].browse(res_ids)
bindings.write({"state": self.state})
if self.do_it_now and self.state == "to_recompute":
bindings.index_id._jobify_batch_recompute(binding_ids=bindings.ids)
8 changes: 7 additions & 1 deletion connector_search_engine/wizards/se_binding_state_updater.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
<field name="arch" type="xml">
<form string="Se Binding State Updater">
<group>
<field name="state" />
<group colspan="2">
<field name="state" />
<field
name="do_it_now"
attrs="{'invisible': [('state', '!=', 'to_recompute')]}"
/>
</group>
</group>
<footer>
<button name="doit" string="OK" class="btn-primary" type="object" />
Expand Down

0 comments on commit 2d391aa

Please sign in to comment.