Skip to content

Commit 2d391aa

Browse files
committed
connector_search_engine: allow recompute specific bindings
_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.
1 parent cc3d828 commit 2d391aa

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

connector_search_engine/wizards/se_binding_state_updater.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ class SeBindingStateUpdater(models.TransientModel):
1414
selection=lambda self: self.env["se.binding"]._fields["state"].selection,
1515
required=True,
1616
)
17+
do_it_now = fields.Boolean(help="Don't wait for the cron to process these records")
1718

1819
def doit(self):
1920
res_ids = self.env.context.get("active_ids")
20-
self.env["se.binding"].browse(res_ids).write({"state": self.state})
21+
bindings = self.env["se.binding"].browse(res_ids)
22+
bindings.write({"state": self.state})
23+
if self.do_it_now and self.state == "to_recompute":
24+
bindings.index_id._jobify_batch_recompute(binding_ids=bindings.ids)

connector_search_engine/wizards/se_binding_state_updater.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
<field name="arch" type="xml">
1212
<form string="Se Binding State Updater">
1313
<group>
14-
<field name="state" />
14+
<group colspan="2">
15+
<field name="state" />
16+
<field
17+
name="do_it_now"
18+
attrs="{'invisible': [('state', '!=', 'to_recompute')]}"
19+
/>
20+
</group>
1521
</group>
1622
<footer>
1723
<button name="doit" string="OK" class="btn-primary" type="object" />

0 commit comments

Comments
 (0)