Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion child_compassion/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# pylint: disable=C8101
{
"name": "Compassion Children",
"version": "18.0.1.1.0",
"version": "18.0.1.1.1",
"category": "Compassion",
"author": "Compassion CH",
"license": "AGPL-3",
Expand Down
6 changes: 3 additions & 3 deletions child_compassion/data/ir_cron.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
<field name="state">code</field>
<field name="code">
for record in model.search([]):
record.with_delay(channel="root.child_compassion").refresh_worldbank_data()
record.with_delay(channel="root.child_compassion").refresh_capital_city()
record.with_delay(channel="root.child_compassion").refresh_factbook_data()
record.with_delay_sh("refresh_worldbank_data", channel="root.child_compassion")
record.with_delay_sh("refresh_capital_city", channel="root.child_compassion")
record.with_delay_sh("refresh_factbook_data", channel="root.child_compassion")
</field>
<field
name="model_id"
Expand Down
24 changes: 0 additions & 24 deletions child_compassion/data/queue_job.xml

This file was deleted.

7 changes: 7 additions & 0 deletions child_compassion/migrations/18.0.1.1.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from openupgradelib import openupgrade


def migrate(cr, version):
openupgrade.load_data(
cr, "child_compassion", "data/ir_cron.xml", "refresh_worldbank_data"
)
14 changes: 0 additions & 14 deletions child_compassion/models/child_compassion.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,20 +562,6 @@ def child_waiting_hold(self):
def child_consigned(self, hold_id):
"""Called on child allocation."""
self.write({"state": "N", "hold_id": hold_id, "date": fields.Datetime.now()})
# Cancel planned deletion
jobs = (
self.env["queue.job"]
.sudo()
.search(
[
("name", "=", "Job for deleting released children."),
("func_string", "like", self.ids),
("state", "=", "enqueued"),
]
)
)
jobs.button_done()
jobs.unlink()
self.get_infos()
Comment thread
ecino marked this conversation as resolved.
return True

Expand Down
2 changes: 1 addition & 1 deletion child_compassion/models/field_office_disaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def process_commkit(self, commkit_data):
"action_id": action_id,
"object_id": fo_disaster.id,
}
message_obj.with_delay(eta=600).create(message_vals)
message_obj.with_delay_sh("create", message_vals, eta=600)
fo_ids.append(fo_disaster.id)

return fo_ids
2 changes: 1 addition & 1 deletion child_compassion/views/child_holds_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<field name="binding_model_id" ref="model_compassion_hold" />
<field
name="code"
>records.delayable().release_hold().set(channel="root.gmc_pool.child_compassion").split(5).delay()</field>
>records.with_delay_sh("release_hold", channel="root.gmc_pool.child_compassion", split=5)</field>
</record>

<menuitem
Expand Down
14 changes: 7 additions & 7 deletions crm_compassion/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ def contract_waiting(self):
contract.origin_id.event_id.ambassador_sponsorship_config_id
)
if notif_template and contract.ambassador_id:
self.env["partner.communication.job"].with_delay(
self.env["partner.communication.job"].with_delay_sh(
"create",
{
"config_id": notif_template.id,
"partner_id": contract.ambassador_id.id,
"object_ids": contract.id,
},
channel="root.partner_communication",
identity_key=f"{self._name}."
f"send_ambassador_notification.{contract.id}",
priority=50,
description="Send ambassador notification",
).create(
{
"config_id": notif_template.id,
"partner_id": contract.ambassador_id.id,
"object_ids": contract.id,
}
)
return res
6 changes: 4 additions & 2 deletions gift_compassion/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ def _trigger_gifts(self):
and move_line.contract_id.child_id
and not existing_gift_for_invl
):
self.env["sponsorship.gift"].with_delay(
self.env["sponsorship.gift"].with_delay_sh(
"create_from_invoice_line",
move_line.id,
priority=50,
channel="root.gift_compassion",
identity_key=f"gift_from_inv_line_{move_line.id}",
).create_from_invoice_line(move_line)
)
3 changes: 2 additions & 1 deletion gift_compassion/models/sponsorship_gift.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,13 @@ def data_to_json(self, mapping_name=None):
return json_data

@api.model
def create_from_invoice_line(self, invoice_line):
def create_from_invoice_line(self, invoice_line_id):
"""Creates a sponsorship.gift record from an invoice_line
:param invoice_line: account.invoice.line record
:return: sponsorship.gift record
"""
gifts = self.env[self._name]
invoice_line = self.env["account.move.line"].browse(invoice_line_id)
product = invoice_line.product_id
sponsorship = invoice_line.contract_id
if not product.sponsorship_gift_type_id:
Expand Down
5 changes: 3 additions & 2 deletions interaction_resume/models/abstract_interaction_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ def _get_interaction_data(self, partner_id):
def create(self, vals_list):
res = super().create(vals_list)
for partner in res.mapped("partner_id"):
partner.with_delay(
partner.with_delay_sh(
"fetch_interactions",
channel="root.partner_communication",
priority=100,
identity_key=f"{partner._name}.fetch_interactions.{partner.id}",
).fetch_interactions()
)
return res

def unlink(self):
Expand Down
5 changes: 3 additions & 2 deletions interaction_resume/models/crm_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ def message_post(self, **kwargs):
res = super().message_post(**kwargs)
for claim in self:
if claim.partner_id:
claim.partner_id.with_delay(
claim.partner_id.with_delay_sh(
"fetch_interactions",
channel="root.partner_communication",
priority=100,
identity_key=f"{claim.partner_id._name}.fetch_interactions.{claim.partner_id.id}",
).fetch_interactions()
)
return res
5 changes: 3 additions & 2 deletions interaction_resume/models/partner_communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ def send(self):
# Refresh the interactions after sending the communication
if not self.env.context.get("skip_interaction_fetch"):
for partner in self.mapped("partner_id"):
partner.with_delay(
partner.with_delay_sh(
"fetch_interactions",
channel="root.partner_communication",
priority=100,
identity_key=f"{partner._name}.fetch_interactions.{partner.id}",
).fetch_interactions()
)
return res
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ def log_interaction(self):
)
message = self.partner_id.message_post(body=formatted_message)
# Only keep the note within one minute
message.with_delay(
message.with_delay_sh(
"unlink",
channel="root.partner_communication",
eta=60,
priority=500,
description="Delete new interaction log after 1 minute",
).unlink()
)
self.partner_id.fetch_interactions()
return True
3 changes: 1 addition & 2 deletions message_center_compassion/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"license": "AGPL-3",
"website": "https://github.com/CompassionCH/compassion-modules",
"development_status": "Production/Stable",
"depends": ["base", "queue_job", "fastapi"],
"depends": ["mail", "queue_job_optional", "fastapi"],
"external_dependencies": {
"python": ["pyjwt"],
},
Expand All @@ -49,7 +49,6 @@
"views/compassion_mapping_view.xml",
"views/import_json_mapping_view.xml",
"views/compassion_settings_view.xml",
Comment thread
ecino marked this conversation as resolved.
"data/queue_job.xml",
],
"demo": ["demo/res_users.xml"],
"installable": True,
Expand Down
7 changes: 0 additions & 7 deletions message_center_compassion/data/queue_job.xml

This file was deleted.

10 changes: 7 additions & 3 deletions message_center_compassion/models/gmc_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,13 @@ def process_messages(self):
new_messages.write({"state": "pending", "failure_reason": False})
priority = min(new_messages.mapped("action_id.priority"))
channel = new_messages[0].action_id.job_channel
new_messages.delayable()._process_messages().set(
priority=priority, channel=channel
).split(10, chain=True).delay()
new_messages.with_delay_sh(
"_process_messages",
priority=priority,
channel=channel,
split=10,
chain=True,
)
return True

def get_answer_dict(self, index=0):
Expand Down
2 changes: 1 addition & 1 deletion partner_auto_match/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"installable": True,
"depends": [
"mail",
"queue_job", # OCA/queue
"queue_job_optional", # OCA/queue
"advanced_translation",
],
"data": [
Expand Down
6 changes: 4 additions & 2 deletions partner_auto_match/models/res_partner_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ def _process_create_infos(self, vals):
def update_partner(self, partner, vals):
filtered_vals = self._process_update_vals(partner, vals)
partner_context = {"skip_check_zip": True, "no_upsert": True}
partner.with_context(**partner_context).with_delay(
partner.with_context(**partner_context).with_delay_sh(
"write",
filtered_vals,
eta=60,
channel="root.res_partner",
).write(filtered_vals)
)

@api.model
def _preprocess_vals(self, vals):
Expand Down
3 changes: 1 addition & 2 deletions partner_communication/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"depends": [
"base_report_to_printer", # OCA/report-print-send
"contacts",
"queue_job", # OCA/queue
"queue_job_optional", # OCA/queue
"mass_mailing_sms",
Comment thread
ecino marked this conversation as resolved.
"utm",
"mail",
Expand All @@ -60,7 +60,6 @@
"views/settings_view.xml",
"views/communication_snippet_view.xml",
"data/default_communication.xml",
"data/queue_job.xml",
],
"qweb": [],
"demo": ["demo/demo_data.xml"],
Expand Down
34 changes: 0 additions & 34 deletions partner_communication/data/queue_job.xml

This file was deleted.

1 change: 0 additions & 1 deletion partner_communication/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@
ir_actions,
ir_attachment,
mail_mail,
queue_job,
res_partner,
)
6 changes: 3 additions & 3 deletions partner_communication/models/communication_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ def write(self, vals):
]
)
jobs_to_update.write({"email_template_id": vals["email_template_id"]})
jobs_to_update.with_delay(
priority=500, channel="root.partner_communication"
).refresh_text()
jobs_to_update.with_delay_sh(
"refresh_text", priority=500, channel="root.partner_communication"
)

return res

Expand Down
Loading
Loading