-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CO-3965 Schedule activity when a sponsorship is validated and the par…
…tner has "don't inform" as a communication setting (#1522) * payment_mode might be False * notify SDS when partner with no communication has new sponsorship Retrieve the SDS user ID based on partner language and notify him of the new sponsorship and stuff * translatable activity * add migration and rename * linter add new line * Update partner_communication_switzerland/migrations/12.0.1.1.4/post-migration.py Co-authored-by: ecino <[email protected]> * Update partner_communication_switzerland/models/contracts.py Co-authored-by: ecino <[email protected]> * Update partner_communication_switzerland/models/contracts.py Co-authored-by: ecino <[email protected]> Co-authored-by: ecino <[email protected]>
- Loading branch information
Showing
5 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<!-- Activity to inform partners with no communications settings of new sponsorships --> | ||
<record id="activity_check_partner_no_communication" model="mail.activity.type"> | ||
<field name="name">Notify sponsor of new sponsorship</field> | ||
<field name="icon">fa-tasks</field> | ||
<field name="res_model_id" ref="base.model_res_partner"/> | ||
</record> | ||
</odoo> |
20 changes: 20 additions & 0 deletions
20
partner_communication_switzerland/migrations/12.0.1.1.4/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import logging | ||
from openupgradelib import openupgrade | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
@openupgrade.migrate(use_env=True) | ||
def migrate(env, installed_version): | ||
if not installed_version: | ||
return | ||
|
||
# Add activities "for dont inform" sponsors | ||
sponsorships = env["recurring.contract"].search([ | ||
('correspondent_id.global_communication_delivery_preference', '=', 'none'), | ||
('state', 'in', ['waiting','active']), | ||
('correspondent_id.ref', '!=', '1502623')]) | ||
|
||
for sponsorship in sponsorships: | ||
# Add the activity | ||
sponsorship.notify_sds_new_sponsorship() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters