Skip to content

Commit c799445

Browse files
committed
Use jobs for updating tags for better performance
1 parent 760e74d commit c799445

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

partner_tag_smart_assignation/models/res_partner_category.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,19 @@ class ResPartnerCategory(models.Model):
5555
@api.model
5656
def create(self, vals):
5757
record = super().create(vals)
58-
record.update_partner_tags()
58+
record.with_delay(
59+
channel="root.res_partner",
60+
priority=100
61+
).update_partner_tags()
5962
return record
6063

6164
def write(self, vals):
6265
res = super().write(vals)
6366
if "tag_filter_condition_id" in vals or "model" in vals:
64-
self.update_partner_tags()
67+
self.with_delay(
68+
channel="root.res_partner",
69+
priority=100
70+
).update_partner_tags()
6571
return res
6672

6773
@api.constrains(

0 commit comments

Comments
 (0)