diff --git a/g2p_entitlement_voucher/models/entitlement.py b/g2p_entitlement_voucher/models/entitlement.py index 41c11a84..d98fd9e2 100644 --- a/g2p_entitlement_voucher/models/entitlement.py +++ b/g2p_entitlement_voucher/models/entitlement.py @@ -41,7 +41,7 @@ def _compute_show_voucher_buttons(self): rec.show_print_voucher_button = True def generate_vouchers_action(self): - err, message, vouchers = self.program_id.get_manager( + err, message, sticky, vouchers = self.program_id.get_manager( constants.MANAGER_ENTITLEMENT ).generate_vouchers(self) return { @@ -50,7 +50,7 @@ def generate_vouchers_action(self): "params": { "title": _("Voucher"), "message": message, - "sticky": True, + "sticky": sticky, "type": "success", "next": { "type": "ir.actions.act_window_close", diff --git a/g2p_entitlement_voucher/models/entitlement_manager.py b/g2p_entitlement_voucher/models/entitlement_manager.py index 746250d6..880d7006 100644 --- a/g2p_entitlement_voucher/models/entitlement_manager.py +++ b/g2p_entitlement_voucher/models/entitlement_manager.py @@ -67,7 +67,7 @@ def approve_entitlements(self, entitlements): ) if self.auto_generate_voucher_on_approval: - err, message, vouchers = self.generate_vouchers(entitlements) + err, message, sticky, vouchers = self.generate_vouchers(entitlements) return res @@ -75,7 +75,7 @@ def generate_vouchers(self, entitlements=None): """Generate Voucher. :param entitlements: A recordset of entitlements - :return: err, message, vouchers recordset + :return: err, message, sticky, vouchers recordset """ if not entitlements: entitlements = self.env["g2p.entitlement"].search( @@ -91,6 +91,7 @@ def generate_vouchers(self, entitlements=None): ) if entitlements_count < self.MIN_ROW_JOB_QUEUE: err_count = 0 + sticky = False return_list = None for cycle_entitlements in cycle_entitlements_list: cycle = cycle_entitlements[0].cycle_id @@ -112,7 +113,7 @@ def generate_vouchers(self, entitlements=None): ) else: message = _(f"{entitlements_count} Vouchers Generated.") - return err_count, message, return_list + return err_count, message, sticky, return_list else: for cycle_entitlements in cycle_entitlements_list: cycle = cycle_entitlements[0].cycle_id @@ -120,7 +121,12 @@ def generate_vouchers(self, entitlements=None): self._generate_vouchers_async( cycle, cycle_entitlements, cycle_entitlements_count ) - return -1, _(f"Started Voucher generation for {entitlements_count}."), None + return ( + -1, + _(f"Started Voucher generation for {entitlements_count}."), + True, + None, + ) def _generate_vouchers(self, entitlements): # TODO: Handle errors diff --git a/g2p_program_assessment/models/program_membership.py b/g2p_program_assessment/models/program_membership.py index cbfa6649..62278c7b 100644 --- a/g2p_program_assessment/models/program_membership.py +++ b/g2p_program_assessment/models/program_membership.py @@ -141,7 +141,7 @@ def reject_application_assessment(self): "params": { "title": _("Reject"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close", diff --git a/g2p_program_assessment/wizard/create_entitlement_wizard.py b/g2p_program_assessment/wizard/create_entitlement_wizard.py index d8c1ae98..d922ef63 100644 --- a/g2p_program_assessment/wizard/create_entitlement_wizard.py +++ b/g2p_program_assessment/wizard/create_entitlement_wizard.py @@ -122,7 +122,7 @@ def create_entitlement(self): "params": { "title": _("Entitlement"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close", diff --git a/g2p_programs/models/accounting/fund_management.py b/g2p_programs/models/accounting/fund_management.py index a75f5c41..cdc002d1 100644 --- a/g2p_programs/models/accounting/fund_management.py +++ b/g2p_programs/models/accounting/fund_management.py @@ -78,7 +78,7 @@ def post_fund(self): "params": { "title": _("Program Fund"), "message": message, - "sticky": True, + "sticky": False, "type": kind, }, } @@ -96,7 +96,7 @@ def cancel_fund(self): "params": { "title": _("Program Fund"), "message": message, - "sticky": True, + "sticky": False, "type": kind, }, } @@ -114,7 +114,7 @@ def reset_draft(self): "params": { "title": _("Program Fund"), "message": message, - "sticky": True, + "sticky": False, "type": kind, # types: success,warning,danger,info }, } diff --git a/g2p_programs/models/entitlement.py b/g2p_programs/models/entitlement.py index c43af08e..5a3d67be 100644 --- a/g2p_programs/models/entitlement.py +++ b/g2p_programs/models/entitlement.py @@ -199,7 +199,7 @@ def approve_entitlement(self): "params": { "title": _("Entitlement"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close", diff --git a/g2p_programs/models/managers/cycle_manager.py b/g2p_programs/models/managers/cycle_manager.py index cf9271a4..91a02b29 100644 --- a/g2p_programs/models/managers/cycle_manager.py +++ b/g2p_programs/models/managers/cycle_manager.py @@ -125,7 +125,7 @@ def approve_cycle(self, cycle, auto_approve=False, entitlement_manager=None): "params": { "title": _("Cycle"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close", @@ -457,14 +457,17 @@ def add_beneficiaries(self, cycle, beneficiaries, state="draft"): if len(beneficiaries) == 0: message = _("No beneficiaries to import.") kind = "warning" + sticky = False elif len(beneficiaries) < self.MIN_ROW_JOB_QUEUE: self._add_beneficiaries(cycle, beneficiaries, state, do_count=True) message = _("%s beneficiaries imported.", len(beneficiaries)) kind = "success" + sticky = False else: self._add_beneficiaries_async(cycle, beneficiaries, state) message = _("Import of %s beneficiaries started.", len(beneficiaries)) kind = "warning" + sticky = True return { "type": "ir.actions.client", @@ -472,7 +475,7 @@ def add_beneficiaries(self, cycle, beneficiaries, state="draft"): "params": { "title": _("Enrollment"), "message": message, - "sticky": True, + "sticky": sticky, "type": kind, "next": { "type": "ir.actions.act_window_close", diff --git a/g2p_programs/models/managers/entitlement_manager.py b/g2p_programs/models/managers/entitlement_manager.py index 30169450..be5b2bbc 100644 --- a/g2p_programs/models/managers/entitlement_manager.py +++ b/g2p_programs/models/managers/entitlement_manager.py @@ -472,7 +472,7 @@ def validate_entitlements(self, cycle): "params": { "title": _("Entitlement"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close", diff --git a/g2p_programs/models/managers/payment_manager.py b/g2p_programs/models/managers/payment_manager.py index cede5863..bba3103c 100644 --- a/g2p_programs/models/managers/payment_manager.py +++ b/g2p_programs/models/managers/payment_manager.py @@ -123,16 +123,20 @@ def prepare_payments(self, cycle, entitlements=None): if payments: kind = "success" message = _("%s new payments was issued.", len(payments)) + sticky = False else: kind = "danger" message = _("There are no new payments issued!") + sticky = False else: self._prepare_payments_async(cycle, entitlements, entitlements_count) kind = "success" message = _("Preparing Payments Asynchronously.") + sticky = True else: kind = "danger" message = _("All entitlements selected are not approved!") + sticky = False return { "type": "ir.actions.client", @@ -140,7 +144,7 @@ def prepare_payments(self, cycle, entitlements=None): "params": { "title": _("Payment"), "message": message, - "sticky": True, + "sticky": sticky, "type": kind, "next": { "type": "ir.actions.act_window_close", diff --git a/g2p_programs/models/managers/program_manager.py b/g2p_programs/models/managers/program_manager.py index 43590ae2..929c904c 100644 --- a/g2p_programs/models/managers/program_manager.py +++ b/g2p_programs/models/managers/program_manager.py @@ -160,17 +160,19 @@ def enroll_eligible_registrants(self, state=None): count = self._enroll_eligible_registrants(state, do_count=True) message = _("%s Beneficiaries enrolled.", count) kind = "success" + sticky = False else: self._enroll_eligible_registrants_async(state, members_count) message = _("Eligibility check of %s beneficiaries started.", members_count) kind = "warning" + sticky = True return { "type": "ir.actions.client", "tag": "display_notification", "params": { "title": _("Enrollment"), "message": message, - "sticky": True, + "sticky": sticky, "type": kind, "next": { "type": "ir.actions.act_window_close", diff --git a/g2p_programs/models/program_membership.py b/g2p_programs/models/program_membership.py index eef630ff..831d9478 100644 --- a/g2p_programs/models/program_membership.py +++ b/g2p_programs/models/program_membership.py @@ -208,7 +208,7 @@ def enroll_eligible_registrants(self): "params": { "title": _("Enrollment"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close", @@ -226,7 +226,7 @@ def enroll_eligible_registrants(self): "params": { "title": _("Enrollment"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close", diff --git a/g2p_programs/models/programs.py b/g2p_programs/models/programs.py index 3c50c697..3e83c605 100644 --- a/g2p_programs/models/programs.py +++ b/g2p_programs/models/programs.py @@ -340,7 +340,7 @@ def create_new_cycle(self): "params": { "title": _("Cycle"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close", @@ -358,7 +358,7 @@ def create_new_cycle(self): "params": { "title": _("Cycle"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close", @@ -417,7 +417,7 @@ def end_program(self): "params": { "title": _("Program"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close", @@ -444,7 +444,7 @@ def reactivate_program(self): "params": { "title": _("Project"), "message": message, - "sticky": True, + "sticky": False, "type": kind, "next": { "type": "ir.actions.act_window_close",