Commit Graph
140529 Commits
Author SHA1 Message Date
david 9e7c19d3d8 [FIX] delivery: avoid retrospective computation
If we're to change the invoice policy of a product we'd provoke a
chained computation of every sale line and sale order containing such
product. This change goes along with the policy of applying such changes
only to future orders, as stated here: https://github.com/odoo/odoo/pull/61135

closes odoo/odoo#64641

X-original-commit: 806da3d67a5cf9919c6c0f5042b3e00c69825faa
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-01-15 17:50:01 +00:00
oco-odoo e09fd75efd [FIX] account: correct tag inversion for lines of invoices with tags, but no tax
This use case can happen in case an invoice is imported without recreating all the taxes, only keeping the VAT information.

closes odoo/odoo#64638

X-original-commit: 7ad61842c703ceb031b2f917ad8bbc26d7d0b780
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-01-15 17:24:04 +00:00
Laurent Smet 68aa40de06 [IMP] account: introduce a new field on move lines to avoid inverting tax tags
The sign of tax tags sometimes could get inverted explicitly. It typically happened for misc operations, so :
    - manual entries
    - CABA entries
    - writeoffs created from the reconciliation widget

We had to do things this way in stable to fix those use cases, but it's not ideal, as the tags shown to the user were inverted, so it was a bit confusing, as one would have expected to see the exact same tags as on tax configuration.

We fix that by using a boolean field on account.move.line telling whether or not the sign must be inverted. This allows keeping the same tags as in the tax config, and simplifies the computation of the tax report's multiplicator, making the overall model more intuitive for both user and developper.

Task 2363287

closes #62536

closes odoo/odoo#64627

Related: odoo/enterprise#15031
Related: odoo/upgrade#1983
X-original-commit: 4e8581b6846ef8ee4601c994b0d586734a4fe117
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-15 15:40:16 +00:00
jbw 044250c08b [FIX] account: fix available payment methods for payments batch
Previously, in batch payments wizard, available payment methods where
always set to wizard.journal_id.outbound_payment_method_ids when
the batch length was > 1.
Event when the payment type was inbound and not outbound.

closes odoo/odoo#64624

Task: 2439250
X-original-commit: 603dbbe7a784c23b87682655963e82a42137d84c
Related: odoo/enterprise#15791
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-15 15:12:34 +00:00
wan 864f962145 [IMP] base: do not resize module icons
Most of the modules have a square icon but some don't. For instance, the
flags of l10n modules, or other third party modules.
Flags have very specific proportions, and we don't want them to be
resized when rendered.
While we could hardcode a square icon for each problematic icon, it
would be more manipulations, and the flags are already in the repo
without the right proportions; we don't want to duplicate binaries.

The many2many `module_ids` kanban field of the uninstall wizard has also
been updated to look more like the generic kanban view for the modules.

The classes in the kanban view of `fleet_vehicle_model_view_form` seem
to have been copy-pasted and are useless. It has been removed to reduce
future possible side effects of changing css.

closes odoo/odoo#56421

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-01-15 15:56:47 +00:00
wan 8aa68445a6 [IMP] l10n_*: remove icon.png and use country_fla from base
* We are gaining ~1.2MB by doing this.
* The flags are unified with the same looks.
* Some flags were missing.
2021-01-15 15:56:47 +00:00
jbw 209c0b7371 [FIX] web: render custom checboxes unclickable on sample data
Custom checkboxes were clickeable on sample data, generating errors.

closes odoo/odoo#62296

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-01-15 14:52:09 +00:00
jbw fe8a49d81f [IMP] mail: change chatter output for tracked boolean fields
When a tracked boolean value is changed, old and new values are displaye in a chatter message.
Boolean values were not captialised ("true" & "false"). They are now ("True" & "False").
And they now also can be translated.
2021-01-15 14:46:33 +00:00
jbw 9408e0d9db [IMP] account: Improve the validation process thanks to the "to check" boolean
- keep track of to_check changes in chatter
- add "set as checked" button
- make the "to_check" field optional in list view
- vendor bill / customer invoice : remove "entry" from "cancel entry" button.

Task: 2389849
2021-01-15 14:45:59 +00:00
Yannick Tivisse 34349db558 [FIX] hr_work_entry: Fix translation missing terms
closes odoo/odoo#64605

X-original-commit: e451757c7258122dda404fa7f2d251e53de0f42d
Related: odoo/enterprise#15778
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-01-15 13:06:56 +00:00
Thanh Dodeur b70ac725f9 [FIX] mail: prevents excessive extension of the width of the chatter
Before this commit, messages in the chatter that contained non wrapping
content could indefinitely extend the width of the chatter.

opw-2425351

closes odoo/odoo#64608

X-original-commit: f5e3bbd4e9b8f1911ee10efe5c576fe84461c8b4
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-01-15 12:02:42 +00:00
Jorge Pinna Puissant 6af836afb9 [FIX] l10n_cl: missing translation for the invoice report
opw-2424608

closes odoo/odoo#64603

X-original-commit: 9a8ebcc7cb05572681444ddb2511ccea4cee5565
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2021-01-15 11:09:11 +00:00
Jorge Pinna Puissant 0f13e7fbcf [FIX] l10n_cl: missing invoice date on report
Before this commit, the invoice date wasn't shown on the invoice report.

opw-2424608

X-original-commit: 54e88e3ab586dc28a8b92134b22fa89a0ba413ea
2021-01-15 11:09:09 +00:00
Laurent Smet 3a756494fc [FIX] account: Hide 'Cut-off' button on invoice if not posted entry
If the journal entry is not posted, the 'Cut-off' button must not be visible on invoice lines.

closes odoo/odoo#64595

X-original-commit: 28b748a559e1ffb5fb7c3631bf77adba121b2ebf
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-15 10:05:30 +00:00
Julien Castiaux b940d1c25f [FIX] base: allow concurrent insertion of triggers
Create a new cron job with a server action that sleeps 10 seconds, while
the cron is executing, triggers the cron. The trigger fails because the
implicit select performed by the foreign key on the ir_cron conflicts
with the lock acquired to execute the job.

When one access a record that references another table record with a
foreign key, a `KEY SHARE` lock try to acquire the referenced record in
order to prevent other transactions from removing it. The only lock that
conflicts with `KEY SHARE` is `UPDATE`.

When a job is acquired for execution, an `UPDATE` lock type was set on
the row. This ensure no other worker will select the same job but it
also prevent triggering the job as the trigger mechanism involve
inserting rows in the `ir_cron_trigger` table which have a foreign key
to the `ir_cron` table.

The `UPDATE` row lock was replaced by `NO KEY UPDATE` row lock. Just
like `UPDATE` the new row lock conflicts with all other locks BUT the
`KEY SHARE` lock that is acquired by foreign keys. The new lock type
still prevent multiple workers from acquiring the same cron
simultaneously but allow concurrent insertion of new triggers.

closes odoo/odoo#64424

Task: 2368911
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2021-01-12 15:46:01 +00:00
Thibault Delavallée 75f23a6a89 [REF] phone_validation, various: remove phone.validation.mixin and inline it
PURPOSE

Remove complex or technical code adding few value.

RATIONALE

phone.validation.mixin is used in two models: crm.lead and res.partner. It only
add a phone_format method used in onchange. We can inline this code in those
two models and remove the whole mixin itself. It lessens inherit and class
complexity.

SPECIFICATIONS

Remove phone.validation.mixin. Inline code in crm.lead (CRM application)
and res.partner (phone validation module). Make phone_format private as
it is now some internal tool method on those two models.

Everything should behave as before this commit. No functional change is
intended.

LINKS

Task ID-2416789
COM PR odoo/odoo#63333
ENT PR odoo/enterprise#15296
UPG PR odoo/upgrade#2025

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-15 08:14:01 +00:00
oco-odoo 32f28ff948 [REV] account: don't try to support tax exigibility modification on a tax if a draft entry is using it
This reverts commit 9d4b22fbf6469ada08c28bc2afcd5b5492eac52a.

We don't want to support this use case, as this kind of configuration change in the middle of creating an invoice is a very narrow corner case that can be avoided easily. Supporting it for tax exigibility would mean we also need to support it for repartition lines, amounts, affect base, ... This would be a lot of overhead for nothing.

closes odoo/odoo#64580

X-original-commit: ec414a5bb785375d13ea324f345c1eaf5747ddfa
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-14 18:25:08 +00:00
svs-odoo 2c49e56d30 [FIX] stock: click on forecast widget
Before this commit, once a field has the 'forecast_widget', the user is
redirect to the forecast report also when they clicks on the field.

How to reproduce:
  - Creates/Opens a delivery;
  - In Operations list, clicks on the reserved qty. field of one of the
    line -> It opens the forecast report.

The wanted behaviour is the user is redirected to the report only if
they clicks on the widget's button, not on the field itself.

task-2415918

closes odoo/odoo#64575

X-original-commit: 22a2845909c6cf96536aa4e664fca5d1ff3fb589
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
2021-01-14 17:41:22 +00:00
Alexandre Kühn 4011e29a7c [REV] project: revert "[FIX] project : chatter wrong place"
This reverts commit 1c7f135708ccca0ad2d54ec41964d5083f42a01b.

The placement of chatter in `project.project` is intentional:
it's in form sheet bg to prevent it taking 1/3rd of screen width
in XL screen configuration on the right side.

Reason to not want it is because the chatter has no conversation,
and chatter with no conversation is basically just follower widget
and attachment, both of which take up a very small area of screen.
By being aside, they would take about 1/3rd of screen with mostly
blank content.

Task-2410310

closes odoo/odoo#64579

X-original-commit: 2236e228913753eaee8b0d6be47e617bc779bdf3
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-01-14 18:24:00 +00:00
Romain Derie 07b34a42f1 [FIX] website_sale: add tests to ensure correct fiscal position is used
Forward port of tests only of #64477 (12.0) since the fix was already applied
in 14.0 with https://github.com/odoo/odoo/pull/40336

opw-2423215

closes odoo/odoo#64570

X-original-commit: 2891f9e24f10f42fd997e2f42aee80a53bc6acaa
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2021-01-14 16:51:17 +00:00
Damien Abeloos a96300ed1c [FIX] web: fix the RedirectWarningHandler dialog not closing
Impacted versions :
- 14.0 and higher

Steps to reproduce :
```
1. generate an odoo.exceptions.RedirectWarning
2. click on the primary button
```

Current behavior :
```
1. the action (argument of the RedirectWarning) is properly executed
2. the WarningDialog is not closed
```

Expected behavior :
```
1. the action should still be properly executed
2. the WarningDialog should be closed
```

Tests :
Added a test to ensure this behavior will not be overwritten in the future.
The test is for the CrashManager service, and evaluates the following sequence :
```
Entry: CrashManager receives a odoo.exceptions.RedirectWarning (code 200) via rpc_error
Asserts:
	- The RedirectWarning modal (WarningDialog) should be opened
	 	* Upon clicking on the primary button :
	- The modal should be closed
	- The action passed as an argument of the odoo.exceptions.RedirectWarning should be executed
```

Origin :
the incorrect behavior was introduced with :
https://github.com/odoo/odoo/commit/b3d9647695065ea582e4a6b0603f3ebf9fde6976

Task ID: 2430100

closes odoo/odoo#64553

X-original-commit: 892598cb0335926ece12789d81673f5b6370a1fd
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-14 14:22:09 +00:00
Odoo's Mergebot 3974dab54c [FW][FIX] web: restore backbutton support for OWL components
This merge prepares the ground for the restoration of the "backbutton" support for OWL components in enterprise in odoo/enterprise#15731.

Related to task ID: 2347640

closes odoo/odoo#64550

Forward-port-of: odoo/odoo#64465
Related: odoo/enterprise#15766
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2021-01-14 18:35:24 +01:00
Pierre Paridans a3f2a7b83a [FIX] web: make Popover patchable
Allows customization for enterprise.

Task ID: 2347640

X-original-commit: 5ac640611e21e6a7ac1c02e632e4550155c98f9a
2021-01-14 13:53:05 +00:00
Pierre Paridans 3d0773d963 [FIX] web: make OwlDialog patchable
Allows customization for enterprise.

Task ID: 2347640

X-original-commit: 127491b22e427587a3cdf88328826847fa881403
2021-01-14 13:53:04 +00:00
Thibault Delavallée a43ed0305f [IMP] iap, crm_iap_lead_enrich, mail_extension: use global blacklist of email providers for email IAP services
Purpose is to have a blacklist of email providers on which IAP services should
not run. Indeed those are generic mailing providers. Retrieving company
information from them makes no sense. Indeed they would be associated to the
mailing provider and not to the real company or partner using it.

In this commit we define a global domain blacklist in iap and use it in
crm_iap_lead_enrich and mail_extension, replacing existing local custom
code.

Task ID-2322455
PR #64545

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-14 13:36:58 +00:00
Thibault Delavallée 303975370c [IMP] partner_autocomplete: allow to tune timeout parameter of IAP calls
Currently, _rpc_remote_api allows to set a timeout when calling IAP servers.
However API using this tool method does not allow to propagate it. This
renders this parameter quite useless.

This commit adds timeout optional parameter to main API methods of partner
autocomplete. Default timeout is the same as before this commit.

Task ID-2322455
PR #64545
2021-01-14 13:36:58 +00:00
Xavier-Do 87857b1066 [FIX] base: do not update module studio_customization
Since odoo/enterprise@937b9214cb module
'studio_customization' has a dependency on module 'web_studio', in order
to automatically remove customizations when uninstalling 'web_studio'.
As a side effect, this marks 'studio_customization' to be upgraded when
'web_studio' is upgraded.  An error is logged, but the module stays in
state `to upgrade`, thereby blocking the execution of cron jobs.

The fix simply adds an explicit (though not very elegant) condition on
the module name to filter out module 'studio_customization' when marking
modules in method `button_upgrade`.

A cleaner fix would be to use the `imported` flag, but we don't want to
risk breaking existing features in stable and will be done in master
instead.

Slightly linked to closed #43880

closes odoo/odoo#64538

X-original-commit: 572e05284c1a7587e989acebd43f3c07e7e99fb1
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-01-14 12:08:54 +00:00
Nicolas (vin) 85f2c8b58a [IMP] account: Set accounting date to today when posting before lock date
When posting an account move before the tax lock date, Odoo will
automatically set its accounting date to the lock date + 1.

This can cause the chronology to be broken, which is not something we
want when automatically setting the date.

This will change that behavior to set the accounting date to today in
such case.

Task id #2411150

closes odoo/odoo#62787

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-01-14 14:22:37 +00:00
Nicolas (vin) b7406497f3 [IMP] web: improve slightly the tag with color 0
To improve the display of tags, we are increasing slightly
the size of the line in the tag to avoid cutting the bottom of some
letters, as well as making the color of the border lighter.

Task id #2368889

closes odoo/odoo#61481

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-01-06 06:48:07 +00:00
qsm-odoo d7be062403 [FIX] website: make automatic specific view on create
SOC for ir.ui.view creation. If a view is created without a website_id,
it should get one if one is present in the context. Also check that
an explicit website_id in create values matches the one in the context.

Note: it was already the case but kinda by chance and not entirely
correct. Most of the time, the 'arch' field was specified as a creation
value... and as it is a computed field with an inverse method, a COW
was triggered. But this had also the inconvenient of creating an extra
generic view without any arch.

closes odoo/odoo#43245

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-14 11:26:59 +00:00
Jairo Llopis 04362043f6 [FIX] mail: Do not consider reply if no "To:" is found
If an email was sent with empty "To:" and a proper alias in "CC:" (or any of the similar valid headers that conform the `rpc_tos_localparts` array), before 40ae36b7f8c412cd96dc9592d8d1fb90de1e52d2 the email wouldn't get rejected. After that commit it would get bounced.

This comes from the not-so-obvious new python idiom used, `all()`. Check this out:

```python
>>> all([False])
False
>>> all([])
True
```

So, apart from the fix introduced in that commit, which seems valid, we have to make sure `email_to_localparts` actually has contents. Otherwise we are producing false bounces here.

@Tecnativa TT23437

closes odoo/odoo#64528

X-original-commit: 8f094d3c01a6ad150b7945115cda515dbde1f4bc
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-14 10:18:31 +00:00
Temur 52010c6666 [CLA] sign tvibliani
closes odoo/odoo#63969

Manual forward-port of 755bdbeb04a769bf1fcf9157f74d6a5deb4ad48d

closes odoo/odoo#64525

X-original-commit: 60457e78cf4900a9955e8ab9cdf092c83fdb7e38
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-01-14 09:55:11 +00:00
Paul Morelle 97c0a110e8 [FIX] account: fix regexp when partner name contains +
When the name of a partner contains a regular expression operator, such
as grouping parenthesis, +, *, brackets... the resulting regexp may
match wrong names or worse be invalid and lead to an exception.

With this commit, we create a regular expression from only the words
formed from at least 3 of [a-zA-Z0-9], ignoring all other characters,
including those who may have a meaning in a regular expression.

This avoids these issues:
- regexp injection (security issue)
- punctuation resulting in erroneous regular expression ("ABC + SPRL"
  resulted in "(?=.*ABC.*)(?=.*+.*)(?=.*SPRL.*)" which is invalid at
  the ".*+" part)
- false positives due to words that are too small (\b were added, and
  the minimal matching word size is 3)
- accentuation mismatch (both sides are filtered through unaccent)
- special cases in unicode that have a special behavior with lower().

See the discussion on odoo/odoo#63145 for a detailled explaination about
these issues.

OPW-2360687

closes odoo/odoo#64510

X-original-commit: 3c5296863f0030acc5d3dba0ff73a6f1b42d1255
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
2021-01-13 18:42:10 +00:00
Nicolas Pierre c324526ad0 [IMP] purchase_stock: use PO description on receipts
In order to easily compare delivery slip from vendor and receipt, vendor
product name and reference should be visible on the receipt operations.
The receipt description was just the name of the product before, it is
now taking the same description as the PO line, using vendor product
name and reference if it exists.

Task ID-2411544

closes odoo/odoo#62967

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-01-13 15:38:18 +00:00
Adrien Widart fc986dc22d [FIX] account,sale: let a user print his invoices
If a user has no access to Invoicing module, he can not send and print his invoices.

To reproduce the error:
(Need sale_management,account)
1. Connect with admin account
2. Settings > Users & Companies
3. Create/Edit a salesman
	- Remove access rights to Invoicing module
4. Connect with this user
5. Create & Confirm a SO
6. Edit the SO and fill in the "Delivered" field, Save
7. Click on "Create Invoice", "Create Invoice"
7. Connect with admin account
8. Invoicing > Go to the previously created invoice
9. Confirm it
10. Connect with the user account
11. Sales > previously created SO > "1 Invoices"

=> The user can read the invoice, but he can not send and print it. This is an error.

OPW-2389428

closes odoo/odoo#64508

X-original-commit: f64f7ca309f9228e58b1487a286f2302ff8f035e
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-01-13 17:55:25 +00:00
oco-odoo b6616b0945 [FIX] account: reconciliation models: allow disabling bypass of matching 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

closes odoo/odoo#64504

X-original-commit: ed023e208736e58d14649aa2fd91fb00510f20c1
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-13 16:19:49 +00:00
Raphael Collet 7463b721d7 [FIX] project: remove dependency cycle in compute method
The issue was triggered by the fact that editable fields are no longer
computed when they have a default value.

closes odoo/odoo#64503

X-original-commit: f047e0bdbcea2b707ecd24c6badbc3bfff0a71e9
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-01-13 16:19:16 +00:00
Raphael Collet 60e0c99ede [REV] mass_mailing: correctly support mailing domain from default context value
This partially reverts commit 1ec887b773,
which was a hack to deal with the issue.  From now on, the first call to
onchange() no longer computes editable fields when they are given a
default value.

X-original-commit: c01657d345f59e3ccea70a5004732050fae99320
2021-01-13 16:19:15 +00:00
Raphael Collet 4de2ec280c [FIX] core: compute editable field with a default should not recompute
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.

X-original-commit: 2ccc735253405b03927e2b08eab57427e65e4050
2021-01-13 16:19:13 +00:00
Thibault Delavallée d1361d9e3a [IMP] (test_)mail: move and rewrite message tests related to channel or discuss
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@1fadb3ec5d

Task ID-2421795

closes odoo/odoo#64501

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-13 15:54:19 +00:00
Laurent Smet ba0890ebb3 [FIX] account: Fix empty 'account_type' in automatic entry wizard
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.

closes odoo/odoo#64495

X-original-commit: cefbd5f3adebe1c620c070f7767d368e65242d37
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-13 15:26:47 +00:00
qsm-odoo 9fcaeb96ef [FIX] web_editor: solve bold command issues
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. This also
solves issues in some base snippets.

closes odoo/odoo#64483

X-original-commit: 424d9661c5657cbcf10ce40acb94a7a200c2a48b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-13 13:45:35 +00:00
Xavier Dubuc 0be32ad4fd [FIX] mail: fix click event handling when renaming DM
task-2414811

closes odoo/odoo#64473

X-original-commit: b850a4ee4ed6688d7d5d1f51e29015cd279495bb
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-01-13 12:51:35 +00:00
JF Aubert 718d16f386 [FIX] stock: multiwarehouses bugfix
Ease multiple warehouses per company creation.
Clarify unique warehouse code constraint message.

task: 2371755

Fix Replenishment Forecasted Report incorrect warehouse & quantity display.

closes odoo/odoo#62601

Task: 2401496 (ticket: 2393320)
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-01-07 10:37:25 +00:00
nie be2ce0522e [FIX] payment_authorize: Show UserError to user
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

closes odoo/odoo#64482

X-original-commit: 2636b9f5059808b443be67b06fca129cf9d3a913
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-01-13 13:44:00 +00:00
Victor Feyens ca16c531a9 [FIX] purchase,purchase_stock: use correct company on PO creation
The picking_type and currency were taken from the current company, even if the
purchase order is created in another company.

Fixes #35026

closes odoo/odoo#64481

X-original-commit: 75936208c6e76a012027952f43b598e9d20180f3
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-01-13 13:43:33 +00:00
Thibault Delavallée b30648198a [IMP] mail: improve channel tests about moderation
Purpose of this commit is to rewrite channel tests, notably moderation
tests. In this commit we

  * use standard users instead of admin/root: this allows to test ACLs and
    more real life oriented use cases;
  * remove unnecessary tests or merge tests belonging to the same category;
  * add some coverage for corner cases;
  * make tests more readable;

We also improve some notification code and error messages that are not
really helpful for users.

Followup of odoo/odoo@e9571a403e
Task ID-2421795

closes odoo/odoo#64459

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-13 10:10:10 +00:00
Jorge Pinna Puissant eb5f69af00 [FIX] purchase: avoid updating data_planned on section/note
Do not update the date_planned of section/note purchase lines when the
date is changed on the order.

Based on f3ebab6eb52e3dc8be1f030aecfff348a22f7e09

opw-2429853

closes odoo/odoo#64458

X-original-commit: c1d5a077f26d5cb5f42888f21dafd78e3432853f
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2021-01-13 09:58:12 +00:00
Benjamin Frantzen (bfr) bed5c12305 [IMP] l10n_it_edi: added customer reference to FatturaPA
This is mandatory for PA customers, and required by several enterprise customers as well.

Related Ticket: 2425845

closes odoo/odoo#64443

X-original-commit: bb898e663019942a6fd99ce96ce5742a8ff7ea56
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
2021-01-12 16:58:14 +00:00
Prakash Prajapati 5faf9883ca [FIX] sale_timesheet: fix the add to cart traceback on portal
Reproduction step:
   - Create Sale Oder(Add optional product)
   - Customer Preview(portal)
   - Add to cart

closes odoo/odoo#64442

Taskid: 2431351
X-original-commit: b7a98151694cd7e65d168cdc52dbf803c792b52d
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-01-12 16:45:47 +00:00