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.
closesodoo/odoo#29685
In the background layout footer, it happens that the content is over a
zone that must stay blank. That's why w've added a left-padding to the
footer.
OPW-1928366
closesodoo/odoo#30296
Layouts were not accepted by Pingen due to the fact that the class that we added to the recipient's address was not present in stable versions.
The format was therefore not adapted to Pingen.
We then remove this class to fix layouts in stable versions.
closesodoo/odoo#29976
Sending a letter resulted systematically in an error due to the insertion of the binary of the PDF in the JSON sent to IAP-services.
closesodoo/odoo#29880
Pingen validates the format of documents before sending them. These are the elements that it checks and how when ensure that the constrains are validated:
- The recipient's address should appear in a predefined area
--> Move the address to this area and reduce the font-size if the address is too long
- The destination country should be the last line of the address
--> Sometimes, the Tax ID was in this zone, so we add a margin after the address
- Above the Address Area, there should be a Postage Area that should be completely empty
--> Make the background white to avoid having a background image in this area
--> Crop the header if it takes too much space
- There are margins of 5mm all around the document
--> Crop the footer 5mm above the bottom of the page if it takes too much space
- There is a square in the bottom left of the document that should be empty
--> Add a margin on the left of the footer
closesodoo/odoo#29522
- The price of sending a letter was displayed in the currency of the company, now we express the price in terms of stamps
- Show a different message in the modal depending on the validity of the address
Add new form and tree views for snailmail.letter available in Accounting > Configuration > Management > Snailmail Letters
Add a many2one field to snailmail.letter to link to a mail.activity in case of an error with snailmail
Task #1892473
the fix merged in cb8bd299fc
was only tackling half the problem. When you assign a user to an
activity, the said user will be notified by email. This also occur if
you change the assignee to the next activity even if you change it to
the same user.
This commit ensures that we only write on the user_id field when we
create the next activity and not during the update.
Since commit b6a981405e we require a
certain key in the context to apply the custom snailmail report layout.
This was badly managed and would eventually confilt inside the modal
that links snailmail and the mail composer.
This fix stabilises the biehaviour by properly propagating the context
key.
The previos format displayed the fields 'street' and 'street2' on two different line, making the address too big for the address area allowed by Pingen.
Up until now, when we wanted to post a single document, it's base64 blob
was uploaded to the snailmail server to estimate the cost of the
transaction. We now use the 'batch' apporach that will estimate the
price based on 1 page per document.