Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cooperator: Confirmation e-mail is sent too soon #76

Open
carmenbianca opened this issue Jun 12, 2023 · 2 comments
Open

cooperator: Confirmation e-mail is sent too soon #76

carmenbianca opened this issue Jun 12, 2023 · 2 comments
Labels
bug no stale Use this label to prevent the automated stale action from closing this PR/Issue.

Comments

@carmenbianca
Copy link
Member

carmenbianca commented Jun 12, 2023

Module

cooperator

Describe the bug

In the create() method of subscription.request, there is this line:

        subscription_request._send_confirmation_mail()

I have two objections to this:

  1. Most importantly, programmatically, this is Bad. Odoo already violates this rule a little bit, but constructors shouldn't have side effects beyond creating the thing you want to be created. Sending an e-mail is an especially egregious side effect.
  2. Functionally, this isn't great. The request is created in draft, and I wouldn't expect Odoo to send e-mails of in-draft objects until I click on a button that is semantically equivalent to 'I have finished filling in most/all the fields; this record is no longer in draft'.

The reason, I believe, that this line exists, is for people who submit their subscription request online. The flow is this:

  1. User fills in their details on the online form.
  2. User clicks on 'submit'.
  3. Odoo validates the data.
  4. Assuming it's valid, Odoo creates the request record.
  5. While creating the request record, an e-mail is sent that assures the user that the request was correctly received and that the cooperative will process their request.

To Reproduce

Affected versions: All, I think. 14.0 at least.

Steps to reproduce the behavior:

  1. Create a request.

Expected behavior
I see two obvious solutions:

  1. Add a state after draft. When switching to this state, send the e-mail. The name of this state could be confirmed, processing, sen[d|t], or some such. This implies a change in workflow for people working with this module. There is a reverted commit in [14.0] cooperator: Multi-company e-mail templates #73 that does this.
  2. Just remove the line, and in the cooperator_website code, add a line to send the e-mail after the request is created. This implies a change (reduction) in functionality: confirmation e-mails are no longer sent when requests are manually created in the back-end.

Additional context
Add any other context about the problem here. (e.g. OS, Python version, ...)

Copy link

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Dec 10, 2023
@carmenbianca
Copy link
Member Author

bump

@huguesdk huguesdk added no stale Use this label to prevent the automated stale action from closing this PR/Issue. and removed stale PR/Issue without recent activity, it'll be soon closed automatically. labels Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug no stale Use this label to prevent the automated stale action from closing this PR/Issue.
Projects
None yet
Development

No branches or pull requests

2 participants