Wednesday, January 13, 2021
15 changes · master
Enhancements to existing features
This update reorganizes and simplifies internal mail and discussion channel tests so they are easier for maintainers to understand and update. It does not change customer-facing behavior, but it helps keep future mail-related changes safer and more reliable.
Original PR description
Purpose of this commit is to move moderation tests directly into mail channel test file. That way it is easier to maintain or update them as they are linked to that specific model and not global to mail.thread. Also containing * remove unnecessary tests or merge tests belonging to the same category; * make tests more readable; Followup of odoo/odoo@e9571a4 Followup of odoo/odoo@1fadb3ec5d8d9c87888d6c814a6c9e65ae0a9f4a Task ID-2421795 Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Mail channel moderation tests were reorganized to better reflect everyday user scenarios and permission rules. The update also improves related notifications and user-facing error messages, making moderation behavior clearer and more reliable.
Miscellaneous changes
Do not update the date_planned of section/note purchase lines when the date is changed on the order. Based on f3ebab6eb52e3dc8be1f030aecfff348a22f7e09 opw-2429853 Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#64430
Original PR description
Do not update the date_planned of section/note purchase lines when the date is changed on the order. Based on f3ebab6eb52e3dc8be1f030aecfff348a22f7e09 opw-2429853 Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#64430
The picking_type and currency were taken from the current company, even if the purchase order is created in another company. Fixes #35026 X-original-commit: d080a5ea6b63832a6df00dce60c0b531d306241a Forward-port of: #64245 -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#64469
Original PR description
The picking_type and currency were taken from the current company, even if the purchase order is created in another company. Fixes #35026 X-original-commit: d080a5ea6b63832a6df00dce60c0b531d306241a Forward-port of: #64245 -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#64469
Steps: - Install website_sale and payment_authorize - Set up a tunnel (e.g. ngrok) - Log in to Authorize.Net backend - Go to Account > Response/Receipt URLs > Add Url - Enter the tunnel URL - In Odoo, go to Website > Configuration > eCommerce > Payment Acquirers - Edit "Authorize.Net" - Credentials tab: - State: Test Mode - API Login Id, Transaction and Signature key - Save, then Generate Client Key - Configuration tab: - Payment Flow: Payment from Odoo - Stop t
Original PR description
Steps: - Install website_sale and payment_authorize - Set up a tunnel (e.g. ngrok) - Log in to Authorize.Net backend - Go to Account > Response/Receipt URLs > Add Url - Enter the tunnel URL - In…
Steps:
- Install website_sale and payment_authorize
- Set up a tunnel (e.g. ngrok)
- Log in to Authorize.Net backend
- Go to Account > Response/Receipt URLs > Add Url
- Enter the tunnel URL
- In Odoo, go to Website > Configuration > eCommerce > Payment Acquirers
- Edit "Authorize.Net"
- Credentials tab:
- State: Test Mode
- API Login Id, Transaction and Signature key
- Save, then Generate Client Key
- Configuration tab:
- Payment Flow: Payment from Odoo
- Stop the server
- Replace https://github.com/odoo/odoo/blob/1b9b99dc2643910c1412b564affccf02ba1e55d9/addons/payment_authorize/models/authorize_request.py#L46 with `resp = {'messages': {'resultCode': 'Error', 'message': [{'code': 'E00027', 'text': 'An error occurred during processing. Call Merchant Service Provider.'}]}}`
- Restart the server
- Go to "Website" > "Go to Website" > Shop
- Add a product to the basket
- Check out the basket
- Choose "Credit Card (powered by Authorize) Test Mode"
- Pay Now
- Enter any card data (e.g. 4111 1111 1111 1111 - 01/22 - 900)
Bug:
When the Pay Now process is done, the customer is redirected to
`/shop?error=invalid_token_id`. No errors are shown.
Explanation:
The patch simulates an error from Authorize.Net happening during their
process. Using the special card numbers won't trigger the wanted
behavior.
When getting an error from Authorize.net, a `UserError` is raised. This
error is then caught in the controller to return a formatted message.
However, returning a dict in this part of the code embeds it inside
`{'result': [...]}`. The error message is, thus, not blocking the form's
redirection and the user gets redirected to the form action, i.e.
`/shop/payment/token`. This route requires `pm_id`, but, in this
scenario, it's an empty string. This leads to another redirection to
`/shop/?error=invalid_token_id` as seen here:
https://github.com/odoo/odoo/blob/1b9b99dc2643910c1412b564affccf02ba1e55d9/addons/website_sale/controllers/main.py#L938-L941
Letting the error bubble up forces the backend to return a blocking
error response. This makes the fronted display the Authorize.Net error
underneath the provider selection, and prevents it from redirecting.
opw:2419260
Forward-Port-Of: odoo/odoo#64462
Forward-Port-Of: odoo/odoo#64358task-2414811 Forward-Port-Of: odoo/odoo#63785
Original PR description
task-2414811 Forward-Port-Of: odoo/odoo#63785
Summernote uses execCommand and, worth, obsolete queryCommandState function to customize the edited content. Here we try to hack the function to solve some problems by making the DOM and style easier to understand for the base functions for the duration of their executions. This won't obviously solves all problems but this is an improvement while waiting for the new Odoo editor coming in future versions. The original problem this solves is handling bold text in blog posts. Posts are usi
Original PR description
Summernote uses execCommand and, worth, obsolete queryCommandState function to customize the edited content. Here we try to hack the function to solve some problems by making the DOM and style easier to understand for the base functions for the duration of their executions. This won't obviously solves all problems but this is an improvement while waiting for the new Odoo editor coming in future versions. The original problem this solves is handling bold text in blog posts. Posts are using font-weight: 300 which is enough to confuse summernote. Hitting bold on a selected paragraph wraps its content in a `<b>` tag but hitting bold again does nothing... having a `<b>` rendered as fw-400 is enough to break it. What this commit does is: before any execCommand or queryCommandState being used to modify the DOM or retrieve its state, the whole DOM is forced to fw-400 and `<b>` elements to fw-700. Forward-Port-Of: odoo/odoo#55145
Since 'move_line_ids' isn't inside the view, `account_type` is never computed and then, the accrual account is never displayed/editable on the view. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#64484
Original PR description
Since 'move_line_ids' isn't inside the view, `account_type` is never computed and then, the accrual account is never displayed/editable on the view. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#64484
Consider a model with a field F and a computed editable field G that depends on F. Assume we open a form view, and both F and G have a default value. The first onchange should return F and G with their respective default values. In other words, the field G should not be recomputed even if its dependency F was assigned a default value. The use-case that showed the issue is batch payments. When adding a new payment in the one2many field of a batch, the new payment should use the batch
Original PR description
Consider a model with a field F and a computed editable field G that depends on F. Assume we open a form view, and both F and G have a default value. The first onchange should return F and G with their respective default values. In other words, the field G should not be recomputed even if its dependency F was assigned a default value. The use-case that showed the issue is batch payments. When adding a new payment in the one2many field of a batch, the new payment should use the batch's payment method by default. The default value for the payment's method is assigned by context on the one2many field in the view. Before this patch, the new payment's method was given by the computation of the field, and its default value was ignored. Side note: another test was fixed, but that's because the test was not consistent with the way Odoo 14.0 manages defaults and onchanges. Forward-Port-Of: odoo/odoo#64359
…ing amount check for more advanced cases Reconciliation models can now create partial payment on invoices. Because of that, the default behavior is not anymore to fully pay the invoice and create an open balance write off. In some cases, though, this is what we want (exchange difference, ...). The solution for that is to create a reconciliation model with write off lines (telling it it must only apply if there is a 90% percent match on the amount, for example), and then create another one
Original PR description
…ing amount check for more advanced cases Reconciliation models can now create partial payment on invoices. Because of that, the default behavior is not anymore to fully pay the invoice and create an…
…ing amount check for more advanced cases Reconciliation models can now create partial payment on invoices. Because of that, the default behavior is not anymore to fully pay the invoice and create an open balance write off. In some cases, though, this is what we want (exchange difference, ...). The solution for that is to create a reconciliation model with write off lines (telling it it must only apply if there is a 90% percent match on the amount, for example), and then create another one not checking the amount to just match the things to reconcile partially by using the partner. However, as it is now, reconciliation models always bypass the check made on the amount in case the statement line's label matches the invoice's payment reference exactly. This can lead to cases where we are matching elements we shouldn't with the rule doing the write off. Example: - use only two 'invoice matching' reconciliation models, in the following application sequence: - model 1, matching partner if with amount matching percentage is 90%, and doing a write-off for the unmatched amount - model 2, matching partner with no amount matching percentage, and no write off - create an invoice with payment refrence INV1 for partner A, amount: 100 - create an invoice with payment refernce INV2 for partner A, amount: 200 - create a statement with two lines: - line 1, with 99 for partner A, label= INV1. - line 2, with 1 for partner A, label= INV2. - Open the reconciliation widget ==> Before the fix: model 1 is applied on both statement lines, as their label match payment references. This is what we want for line 1, but probably not for line 2, which will create a write off of 199, while we'd have wished for a partial payment, leaving the invoice with 199 open. ==> After the fix The behavior is the same unless the config_parameter is set. If it is: - line 1 will be matched by model 1 (as 99 - 9,9 < 100 < 99 + 9,9). INV1 will be paid with a write off of 1. - line 2 will not be matched by model 1 (as 200 is not between 1 - 0,1 and 1 + 0,1), but it will be by model 2 (since line 2 and INV 2 share the same partner). So, INV2 will be partially reconciled with line 2. OPW 2419030 Forward-Port-Of: odoo/odoo#64409
Steps to reproduce the bug: - Let's consider an australian company C with l10n_au_aba installed - Go to bank journal, fill BSB field and save Bug: The BSB field kept empty opw:2431204 Forward-Port-Of: odoo/enterprise#15744
Original PR description
Steps to reproduce the bug: - Let's consider an australian company C with l10n_au_aba installed - Go to bank journal, fill BSB field and save Bug: The BSB field kept empty opw:2431204 Forward-Port-Of: odoo/enterprise#15744
STEPS: * activate and switch to another language * send signature request * open preview * click ``Resend`` * open ``Settings >> Technical >> Mails`` menu BEFORE: ``Resend`` button ignores current language AFTER: mail is sent in user's languaged --- opw-2428352 Forward-Port-Of: odoo/enterprise#15724
Original PR description
STEPS: * activate and switch to another language * send signature request * open preview * click ``Resend`` * open ``Settings >> Technical >> Mails`` menu BEFORE: ``Resend`` button ignores current language AFTER: mail is sent in user's languaged --- opw-2428352 Forward-Port-Of: odoo/enterprise#15724
Steps: - Enable debug mode - Go to Settings > Translations > Languages - Edit "English (US)" and change the Date Format to "%d/%m/%Y" - Go to Rental - Create a new Rental Order - Add any product that can be rented - Select a period - Click Add Bug: The dates in the description of the line are not displayed using the format set earlier. Explanation: Passing `dt_format='short'` to `format_datetime()` bypasses date format customization. The only way to use the customization is to
Original PR description
Steps: - Enable debug mode - Go to Settings > Translations > Languages - Edit "English (US)" and change the Date Format to "%d/%m/%Y" - Go to Rental - Create a new Rental Order - Add any product that can be rented - Select a period - Click Add Bug: The dates in the description of the line are not displayed using the format set earlier. Explanation: Passing `dt_format='short'` to `format_datetime()` bypasses date format customization. The only way to use the customization is to pass it `dt_format=False` as seen here: https://github.com/odoo/odoo/blob/bda051d1a681d149f197675516ade1c731391c5a/odoo/tools/misc.py#L1300-L1303 The same applies to `format_date()` and `format_time()`. This commit fixes date and time formatting for new Rental Orders. opw:2429366 Forward-Port-Of: odoo/enterprise#15695
- action name is wrong. - target model is wrong. Forward-Port-Of: odoo/enterprise#15676
Original PR description
- action name is wrong. - target model is wrong. Forward-Port-Of: odoo/enterprise#15676
- Install sale_subscription - Go to Subscriptions > Configuration > Subscription Templates - Create a Template with "Create Invoice" set to "Send" - Create a Subscription with the created Template - Save and start Subscription - In debug mode, generate invoice - Go to Settings > Technical > Emails and send the email If customer replies to the email, the reply will not appear in Invoice chatter. By default, it will be sent to the Salesperson. The email sent for the Invoice generated fr
Original PR description
- Install sale_subscription - Go to Subscriptions > Configuration > Subscription Templates - Create a Template with "Create Invoice" set to "Send" - Create a Subscription with the created Template - Save and start Subscription - In debug mode, generate invoice - Go to Settings > Technical > Emails and send the email If customer replies to the email, the reply will not appear in Invoice chatter. By default, it will be sent to the Salesperson. The email sent for the Invoice generated from Subscriptions does not have the required data to be routed correctly in the Invoice chatter. opw-2423853 Forward-Port-Of: odoo/enterprise#15616