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

[IMP] snailmail: Failed letters usability #29685

Conversation

aprieels
Copy link
Contributor

@aprieels aprieels commented Dec 20, 2018

Improve the behavior of snailmail when errors happen by making something similar to what mail does.

  • Add a message to the chatter with an icon representing the status of the letters
  • Show all Snailmail errors in the systray
  • Re-send automatically on the letters with an error that might have been fixed
  • Anticipate Missing required fields errors when the address is not complete

Task #1907998

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo robodoo added seen 🙂 CI 🤖 Robodoo has seen passing statuses labels Dec 20, 2018
addons/snailmail/static/src/js/mail_manager.js Outdated Show resolved Hide resolved
addons/snailmail/static/src/js/message.js Outdated Show resolved Hide resolved
addons/snailmail/static/src/js/message.js Outdated Show resolved Hide resolved
addons/snailmail/static/src/js/systray_messaging_menu.js Outdated Show resolved Hide resolved
addons/snailmail/static/tests/chatter_snailmail_tests.js Outdated Show resolved Hide resolved
addons/snailmail/static/tests/chatter_snailmail_tests.js Outdated Show resolved Hide resolved
addons/snailmail/static/tests/chatter_snailmail_tests.js Outdated Show resolved Hide resolved
addons/snailmail/static/tests/chatter_snailmail_tests.js Outdated Show resolved Hide resolved
@@ -82,7 +82,7 @@ def test_write_mail_with_tracking(self):
'partner_id': self.env.ref('base.res_partner_12').id,
})

with self.assertQueryCount(__system__=5, demo=5): # test_mail only: 5 - 5
with self.assertQueryCount(__system__=6, demo=6): # test_mail only: 5 - 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check with @Xavier-Do or @tde-banana-odoo for changes of query counts

@C3POdoo C3POdoo added the RD research & development, internal work label Dec 20, 2018
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from 2b52a70 to 63ac6da Compare December 24, 2018 08:42
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Dec 24, 2018
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from 63ac6da to b64ac12 Compare December 24, 2018 10:09
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Dec 24, 2018
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from b64ac12 to 694286a Compare December 24, 2018 13:34
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Dec 24, 2018
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from 694286a to 3e07ba6 Compare December 26, 2018 10:53
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Dec 26, 2018
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from 1bf2b0c to 1b98afc Compare December 27, 2018 09:41
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Dec 27, 2018
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from 1b98afc to f728bb7 Compare December 27, 2018 09:52
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Dec 27, 2018
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from f728bb7 to 2a3ffc7 Compare December 27, 2018 12:04
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Dec 27, 2018
addons/snailmail/models/snailmail_letter.py Outdated Show resolved Hide resolved
addons/snailmail/models/snailmail_letter.py Outdated Show resolved Hide resolved
addons/snailmail/models/snailmail_letter.py Outdated Show resolved Hide resolved
addons/snailmail/models/snailmail_letter.py Outdated Show resolved Hide resolved
addons/snailmail/models/snailmail_letter.py Outdated Show resolved Hide resolved
addons/snailmail/models/mail_message.py Show resolved Hide resolved
addons/snailmail/static/src/xml/thread.xml Outdated Show resolved Hide resolved
addons/snailmail/models/snailmail_letter.py Outdated Show resolved Hide resolved
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from 2a3ffc7 to 65c8ae2 Compare December 28, 2018 13:44
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Dec 28, 2018
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from ac6884d to 448b5aa Compare January 10, 2019 06:59
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Jan 10, 2019
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from 448b5aa to 9f3ada3 Compare January 16, 2019 08:50
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Jan 16, 2019
@aprieels aprieels force-pushed the master-snailmail-failed-letters-usability-anp branch from 9f3ada3 to 2f72994 Compare January 16, 2019 08:56
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Jan 16, 2019
@pimodoo
Copy link
Collaborator

pimodoo commented Jan 17, 2019

@Xavier-Do Is it ok for you now?

'model': letter.model,
'last_message_date': letter.message_id.date,
'module_icon': '/snailmail/static/img/snailmail_failure.png',
'snailmail_status': letter.message_id.snailmail_status,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snailmail_error on message should be letter.state == 'error' no?
same for status

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you also want that we use letter.error_code if letter.state == 'error' for snailmail_status?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works as expect yes.

@pimodoo pimodoo force-pushed the master-snailmail-failed-letters-usability-anp branch from 2f72994 to 6d6ad09 Compare January 17, 2019 14:45
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Jan 22, 2019
@pimodoo pimodoo force-pushed the master-snailmail-failed-letters-usability-anp branch from bf80506 to 63ca7d6 Compare January 22, 2019 15:52
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Jan 22, 2019
When a letter is sent through snailmail and encounter an error, it used
to create an activity to the user to notify him that there was an error
with its letter.

When a user had this activity, he didn't have any clues of what was the
error and how to manage it. So we decided to better handle snailmail
errors and give the possibility to the user to easily fix the source of
the snailmail errors.

First to give a better feedback on the letters in errors, we've made
features similar to ones existing for emails:
 - We add a mail message on the document that sent the letter, and put a
   small paper plane icon, which is red when an error occurs (like the
   envelope for email)
 - As letters can be sent in batch, we've also added an entry in the
   systray to easily manage the different documents having snailmail
   errors like for emails.

Then we identified, the most common errors encountered with the
snailmail letters and give proper way to let the user fix them:
 - Missing Required Field:
    - The address is not complete, some of the fields are empty.
    - We open a wizard allowing the user to modify the partner address
      and we try to resend all letters having this error on the modified
      partner.
    - We also try to avoid this error, by opening the wizard before
      sending the letter, but it only works for single documents, not
      for batch.
 - Trial/Credit Error:
    - The user has not enough credits to send letters anymore.
    - We open a wizard that give a redirection lnk to add credits on its
      iap account.
 - No Price Available:
    - The destination country is not supported by any of our providers,
      and we cannot do anything to send this letter.
 - Format Error:
    - The format of the pdf report send by the user is refused by our
      providers, because some visual stuffs are not respected, for
      example blank zone to print barcode or margins.
    - We show a wizard to the user letting him check a setting option
      that add a cover page in the envelope and the documents will be
      send with this extra page containing the address.
 - Unknown Error:
    - This is not one of the listed error above.
    - A wizard suggesting the user to contact support is displayed.

The cron that try to resend letters on error, has been addapted to only
try to send the error of type Trial/No Credit, because the account might
have been reloaded, and other errors, won't change if they have not been
fixed locally.
@pimodoo pimodoo force-pushed the master-snailmail-failed-letters-usability-anp branch from 63ca7d6 to 0e1eec3 Compare January 24, 2019 13:37
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Jan 24, 2019
@pimodoo
Copy link
Collaborator

pimodoo commented Jan 24, 2019

robodoo r+ rebase-ff

@robodoo
Copy link
Contributor

robodoo commented Jan 24, 2019

Merge method set to rebase and fast-forward

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Jan 25, 2019
robodoo pushed a commit that referenced this pull request Jan 25, 2019
When a letter is sent through snailmail and encounter an error, it used
to create an activity to the user to notify him that there was an error
with its letter.

When a user had this activity, he didn't have any clues of what was the
error and how to manage it. So we decided to better handle snailmail
errors and give the possibility to the user to easily fix the source of
the snailmail errors.

First to give a better feedback on the letters in errors, we've made
features similar to ones existing for emails:
 - We add a mail message on the document that sent the letter, and put a
   small paper plane icon, which is red when an error occurs (like the
   envelope for email)
 - As letters can be sent in batch, we've also added an entry in the
   systray to easily manage the different documents having snailmail
   errors like for emails.

Then we identified, the most common errors encountered with the
snailmail letters and give proper way to let the user fix them:
 - Missing Required Field:
    - The address is not complete, some of the fields are empty.
    - We open a wizard allowing the user to modify the partner address
      and we try to resend all letters having this error on the modified
      partner.
    - We also try to avoid this error, by opening the wizard before
      sending the letter, but it only works for single documents, not
      for batch.
 - Trial/Credit Error:
    - The user has not enough credits to send letters anymore.
    - We open a wizard that give a redirection lnk to add credits on its
      iap account.
 - No Price Available:
    - The destination country is not supported by any of our providers,
      and we cannot do anything to send this letter.
 - Format Error:
    - The format of the pdf report send by the user is refused by our
      providers, because some visual stuffs are not respected, for
      example blank zone to print barcode or margins.
    - We show a wizard to the user letting him check a setting option
      that add a cover page in the envelope and the documents will be
      send with this extra page containing the address.
 - Unknown Error:
    - This is not one of the listed error above.
    - A wizard suggesting the user to contact support is displayed.

The cron that try to resend letters on error, has been addapted to only
try to send the error of type Trial/No Credit, because the account might
have been reloaded, and other errors, won't change if they have not been
fixed locally.

closes #29685
@robodoo
Copy link
Contributor

robodoo commented Jan 25, 2019

Merged, thanks!

@robodoo robodoo closed this Jan 25, 2019
@aprieels aprieels deleted the master-snailmail-failed-letters-usability-anp branch May 15, 2019 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI 🤖 Robodoo has seen passing statuses RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants