diff --git a/child_compassion/models/compassion_hold.py b/child_compassion/models/compassion_hold.py index 79b27c82c..efbb1d702 100644 --- a/child_compassion/models/compassion_hold.py +++ b/child_compassion/models/compassion_hold.py @@ -486,24 +486,28 @@ def postpone_no_money_hold(self, additional_text=None): } hold.write(hold_vals) - body = ( - "The no money hold for child {local_id} was expiring on " - "{old_expiration} and was extended to {new_expiration} " - "({extension_description} extension).{additional_text}" - ) - hold.message_post( - body=_(body.format(**values)), - subject=_("No money hold extension"), - subtype_xmlid="mail.mt_comment", - ) - - else: - body = _( - "The no money hold for child {local_id} is expiring on " - "{old_expiration} and will not be extended since " - "no sponsorship exists for this child." - ) - hold.message_post(body=body.format(**values)) + # ---------------------------------------------------- + # NOTIFICATION (Only for NO_MONEY_HOLD) + # ---------------------------------------------------- + if hold.type == HoldType.NO_MONEY_HOLD.value: + if hold.child_id.sponsor_id: + body = ( + "The no money hold for child {local_id} was expiring on " + "{old_expiration} and was extended to {new_expiration} " + "({extension_description} extension).{additional_text}" + ) + hold.message_post( + body=_(body.format(**values)), + subject=_("No money hold extension"), + subtype_xmlid="mail.mt_comment", + ) + else: + body = _( + "The no money hold for child {local_id} is expiring on " + "{old_expiration} and will not be extended since " + "no sponsorship exists for this child." + ) + hold.message_post(body=body.format(**values)) ########################################################################## # Mapping METHOD # diff --git a/partner_communication/models/communication_snippet.py b/partner_communication/models/communication_snippet.py index 119109745..e4a2bd322 100644 --- a/partner_communication/models/communication_snippet.py +++ b/partner_communication/models/communication_snippet.py @@ -1,12 +1,26 @@ from odoo import fields, models +class CommunicationSnippetCategory(models.Model): + _name = "communication.snippet.category" + _description = "Communication Snippet Category" + + name = fields.Char(string="Category Name", required=True) + + class CommunicationSnippet(models.Model): _name = "communication.snippet" _description = "Communication Snippet" name = fields.Char(required=True, index=True) snippet_text = fields.Html(required=True, translate=True) + description = fields.Text(string="Description") + + category_id = fields.Many2one( + "communication.snippet.category", + string="Category", + help="Category of the communication snippet", + ) def action_edit_snippet(self): self.ensure_one() diff --git a/partner_communication/security/ir.model.access.csv b/partner_communication/security/ir.model.access.csv index ac4dfc9f3..57d0a57bc 100644 --- a/partner_communication/security/ir.model.access.csv +++ b/partner_communication/security/ir.model.access.csv @@ -11,3 +11,4 @@ access_partner_communication_generate_wizard,access_partner_communication_genera access_partner_communication_download_print_wizard,access_partner_communication_download_print_wizard,model_partner_communication_download_print_job_wizard,base.group_user,1,0,1,0 access_partner_communication_default_config,access_partner_communication_default_config,model_partner_communication_default_config,base.group_user,1,1,1,1 access_communication_snippets,Full access on communication_snippets,model_communication_snippet,base.group_user,1,1,1,1 +access_comm_snippet_category_user,communication.snippet.category,model_communication_snippet_category,base.group_user,1,1,1,1 diff --git a/partner_communication/views/communication_snippet_view.xml b/partner_communication/views/communication_snippet_view.xml index df1276fb9..e96ed7650 100644 --- a/partner_communication/views/communication_snippet_view.xml +++ b/partner_communication/views/communication_snippet_view.xml @@ -8,6 +8,14 @@ + + @@ -20,6 +28,8 @@ + +