Commit Graph
141615 Commits
Author SHA1 Message Date
fw-bot 9fd700c82c [IMP] l10n_latam_invoice_document: Remove l10n_ar constraint on base latam module
Documents with `l10n_latam_document_type_id.code == '99'` just exists on **l10n_ar**
https://github.com/odoo/odoo/blob/13.0/addons/l10n_ar/data/l10n_latam.document.type.csv#L74 making this error arise
on other localizations which don't use it.

This was mistakenly introduced on 7748e0e

This method is inherited inside l10n_ar and we add this additional validation.

Original PR: https://github.com/odoo/odoo/pull/64831

closes odoo/odoo#68066

X-original-commit: 109b4b1aaac4d76ef273fb88d27e2b648331a266
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-03-18 11:00:33 +00:00
Nasreddin (bon)andLucas Perais 9a1de0ef05 [FIX] web: compute default locale of Date(Time)Picker at the right time
Issue
        - Install "Accounting"
        - Change user language to arabic
        - Go to Customer Invoices list view
        - Try to filter on field "Created On"

        Traceback is raised from the DatePicker Component

Cause
	The cause is two fold:
	There is an issue in moment that behaves abnormally when its internals
	are not able to extract the month in a locale, and, instead of returning an
	invalid moment, it returns a valid moment with the month set to January
	which just happens to be the first month of moment's default locale
	ref: https://github.com/moment/moment/issues/5600

	Secondly, the defaultProps "locale" of the DatePicker was set to moment.locale()
	at the file's initial loading, that is, before any user locale parameters were loaded
	The bootstrap datepicker was then set with the wrong locale, and the case fell under moment's issue

After this commit, the locale of the DatePicker is always the one of the user, and there is no traceback

opw-2460156

closes odoo/odoo#68059

X-original-commit: e2c46bb80e1e312dd34ac554d79813ef35282e62
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
2021-03-18 09:51:06 +00:00
Aaron Bohy 98ede6e553 [IMP] web: patch/unpatch: better error handling
Before this commit, calling unpatch on an object that hasn't been
patched before crashed (before reaching the code that handles the
case by throwing an Error). This scenario is now properly handled.

This commit also defines specific Error classes for the patch and
unpatch faulty cases, so that they can be elegantly catched (in
tests for example).

closes odoo/odoo#68057

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-03-18 10:25:31 +00:00
Aaron Bohy 6418a55fe4 [IMP] web: patch/unpatch: allow to re-apply a patch
In tests, we might want to disable a specific patch for a specific
test (e.g. to remove a monkey patch done when another addon is
installed, to test the behavior of the current addon).

Before this commit, it was possible to unpatch at the beginning of
the test, but we couldn't re-patch when the test was over.

Feature required by task~2392303
2021-03-18 09:59:53 +00:00
Jairo Llopis 7b62480bef [IMP] sale: change template mail button text
Some customers are scared of clicking on a button that says "Accept &
pay" directly from an email.

So, instead of using the online features, they download the PDF, sign it
and return it.

It seems legit, due to the text that you can read, so as an UX
enhancement, I propose to change that button's text.

@Tecnativa TT27664

closes odoo/odoo#65597

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-03-17 11:22:20 +00:00
Ivan Yelizariev 71523876d5 [FIX] stock: fix search by qty_available
In simple search by qty_available we use optimized method. Before this commit
that method didn't work when product doesn't have stock moves and domain
includes zero qty, e.g. ``[('qty_available', '>=', 0)]``, ``[('qty_available',
'=', 0)]``, etc

The problem comes from https://github.com/odoo/odoo/pull/66652

closes odoo/odoo#68042

X-original-commit: 629ce193e4725919c1aeede000517564f0e8adf1
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2021-03-17 17:46:25 +00:00
Florent de Labarre fa1decdc53 [FIX] sale_project: clearer error message
The error message raised when linking a wrong SOline and a task used
unclear/incomplete information.

This commit improves the displayed message, replacing:
* the SO id by the SO reference, since record ids are not really useful to
    end users.
* the product name by its display name, to include variants details.

closes odoo/odoo#68041

X-original-commit: 8db6e654a50d38001c42247b33392aad90cab821
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-03-17 17:45:07 +00:00
Odoo's Mergebot 276b2093dc [MERGE] mail, various: remove channel listening feature
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models..

PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS SUMMARY

Make subscription work using partners only. Remove channel ability to follow
records. Remove channel auto-follow. Simplify channel notification flow by
using directly members and not a delegation through a channel self-following
trick. Thread notification is simplified and channel specific behavior is now
implemented directly on ``mail.channel`` model.

Remove ``channel_id`` field from follower model. Only partner_id is kept.
Starting from now on followers are partners only.

Remove support of channels when posting a message. Messages now belong to
a single thread using standard ``model`` / ``res_id`` pair even for
``mail.channel`` records. Remove ``channel_ids`` support on ``message_post``
and from Message model. Channel content is now computed like all other
documents.

As a side quest, following updates are necessary

  * remove ``message_channel_ids`` field from ``mail.thread``. Indeed there
    will not be any follower being ``mail.channel`` anymore;
  * remove ``channel_message_ids`` field from ``mail.channel`` as they now
    use standard ``message_ids`` field;
  * remove various ``channel_ids`` linked to followers (server actions, invite
    wizard, ...);
  * remove duplicated ``is_subscribed`` field on ``mail.channel``, duplicate of
    ``is_member``;

With this merge, following features are modified

  * channels cannot follow records anymore;
  * messages cannot belong to a business document AND channels at the
    same time. A channel is now behaving like all other business documents;
  * following a channel using partners to be notified of discussions. Only chat
    or mailing lists notify their members;

Finally various code places are improved: renaming, more modular approach,
... See sub commits for more details. Each commit explains more in details
its change and purpose / specifications.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005

Thanks to @seb-odoo for in-depth review.

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-17 20:18:20 +01:00
Thibault Delavallée 35e6d94d61 [IMP] test_mail: update query counters
After all those changes, query counters can be updated according to latest
runbot state. Some counters decreased, meaning simplifying models leads
to a performance increase. Hopefully. Or bugs. Or both.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:22:28 +00:00
Thibault Delavallée c4dacc24fa [REF] mail, sms: simplify notification recipients structure
Now that recipients in notification process are always partners due to
simplification of MailFollower model we can safely simplify the structure
used to collect and propagate recipients information.

Before this task it was a dictionary with a list of partner related data and
a list of channel related data. It is now simply a list of partner related
data, leading to various code cleaning.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:22:20 +00:00
Thibault Delavallée d08e3676ea [IMP] mail: improve subscription low-level API readability
Purpose of this commit is to make low-level API of subscribe process a bit
easier to understand and use. Notably some parameters are now defined as
named parameters in order to better understand calls.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:22:15 +00:00
Thibault Delavallée e5338146e7 [REF] mail: make message belongs to a single thread without listener channels
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS

In this commit we force messages to belong to a single document using
``model`` / ``res_id`` pair. It is not possible anymore to link a message
to channels using ``channel_ids``. A message belongs to a document and
is displayed in that document's chatter.

This change implies modifying a lot of domains, notably in chatter. Indeed
discuss for channels does not use ``('channel_ids', 'in', [3])`` domains.
They now use ``('model', '=', 'mail.channel'), ('res_id', 'in', [3])`` like
other documents fetching their messages.

This commit also removes ``channel_message_ids`` field on ``mail.channel``
model. As channels are now considered as standard documents they will use
``message_ids`` field like all other documents. Linking a channel on a message
is possible only as a link in message from now on. It is not possible to push
it into a channel anymore (no more listener channels, no more channel link).

Finally a global cleaning also linked to all previous commits is done.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:35 +00:00
Thibault Delavallée df013e76bc [REF] mail: do not support listener channels when posting a message
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS

In this commit we remove support of ``channel_ids`` parameter when posting
a message. This means we do not support notifying channels as side-part
of notification mechanism on a document. Either we post on a channel and
its members are notified, either we post on a business documents and its
followers are notified. There is no possibility to add channels as being
notified when posting a message.

This is done as a followup of removing followers being channel-based and
prepares ground to make channel use model / res_id as all other documents
inheriting form mail.thread.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:20 +00:00
Thibault Delavallée 4cb1f56aba [REF] mail, sms, test_mail: remove now unused channel_id field on Py and JS follower models
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS

As there is no way to add channel-based follower anymore we can remove all
fields and code supporting this feature. Notably we can remove ``channel_id``
field on ``mail.follower`` model as well all code using it, notably compute
methods.

In this commit we also make ``partner_id`` field required as now followers
are always partners. Email, name and active fields are now simple related
fields on the partner.

Code computing data about subscription is also updated and simplified. As
we do not have channels anymore but only partners all custom SQL queries
are now simplified.

JS models for Discuss are also cleaned. Following python change, JS models
are simplified to match the backend models. Channel_id is removed, partner_id
is now required, and various code is updated according to the simplified
model.

Side note: we could probably get rid of specific index on ``partner_id``
field. However we have to ensure we never search for followers without being
in a model / res_id context. This will be done in another cleaning step to
be sure performance are not broken.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:18 +00:00
Thibault Delavallée 1b0a6b7e13 [REF] mail, base_automation: remove now unused channel_ids field on actions server
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

SPECIFICATIONS

Remove ``channel_ids`` field from ``ir.actions.server``. As we removed
support of (un)subscribing channel-based followers there is no need anymore
to have a field to add them through server actions. We can now safely remove
this field as it has no use anymore.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:16 +00:00
Thibault Delavallée 1cff7104c3 [REF] mail: remove now unused channel_id field on invite
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

SPECIFICATIONS

Remove ``channel_id`` field from ``mail.invite.wizard``. As we removed
support of (un)subscribing channel-based followers there is no need anymore
to have a field to add them in invite wizard. We can now safely remove this
field as it has no use anymore.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:15 +00:00
Thibault Delavallée 305af13279 [REF] mail, note, test_mail: remove now unused message_channel_ids field on MailThread
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

SPECIFICATIONS

Remove ``message_channel_ids`` field from ``mail.thread``. As we removed
support of (un)subscribing channel-based followers there is no need anymore
to have a field to access them. We can now safely remove this field as it
has no use anymore.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:13 +00:00
Thibault Delavallée 7991118bfe [REF] mail, various: remove support of channels from message_subscribe API
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

SPECIFICATIONS

Remove ``channel_ids`` argument and support from ``message_subscribe`` and
``message_unsubscribe`` API. Indeed we do not support adding channel-based
followers anymore. Only partners should be added or removed from followers.
It also allows to simplify API and understanding of both methods.

Various addons are updated to match the simplified (un)subscribe API. Some
enterprise addons may also be impacted.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:11 +00:00
Thibault Delavallée 33f5095e6b [IMP] mail: support mentioning people on channels
PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS

Support mentioning partners on channels like done on other documents. When
there is an user input (comment or email) that mentions someone that specific
recipient is not notified. Its notification will be done in Inbox or email
depending on its choice or customer state.

This feature somehow replaces the follower-based support that is now removed
on channels. It allows to ping people and send them notifications. It is
less broad (limited to a post with ping) but already gives flexibility when
using channels.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:15:58 +00:00
Thibault Delavallée b564638c3c [IMP] mail: prevent from adding followers on channels
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

SPECIFICATIONS

Channel now use only their members for notification purpose. Having followers
is redundant with members. Moreover as followers are not taken into account
for notification people may think followers mechanism is broken on channel.

Let us simply prevent from adding followers on channels and remove the widget.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:07:39 +00:00
Thibault Delavallée 018820d26f [REF] mail, test_mail: make channel use its members for notification and remove auto-follow
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models..

PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS

In this commit we remove the auto-follow mechanism on mail.channel. It is
used as a trick to have self-notifying channels. When posting on a channel
it listens itself. When a channel listens to a record its members are notified
depending on channel type. It means that a channel following itself notifies
its members in a magic way.

We decided to remove this magic and instead do a cleaner implementation of
this mechanism. ``_notify_compute_recipients`` method from ``mail.thread`` is
now overridden on channel model. It computes recipients to notify using a
custom SQL instead of the generic one given by ``mail.thread``. Some other
code adaptation is done to ensure notification on channel model is done as
intended on that specific model.

As channel model is somewhat different from classic mail.thread enabled
models let us implement its features in a more traditional way. More overrides
and less magic !

QUERY COUNTERS

Due to changes in ``channel_partner_ids`` fields being a computed inverse
searchable field there may be an additional query when performing a message
post as indicated by ``test_complete_message_post`` test. This is due notably
to message_format fetching channel_ids information. A call to ir rules on
channel is performed that uses ``channel_partner_ids`` as part its rule domain.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:07:33 +00:00
Thibault Delavallée 62dc6a6173 [REF] mail, mass_mailing, hr, {(website_)im_/crm_}livechat: clean use of channel members in various code place
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

SPECIFICATIONS

Purpose of this commit is to better differentiate channel members technical
model from partner members in code :

  * ``channel_partner_ids``: contacts member of a channel, filtering notably
    on active and checking ACLs on res.partner business model. This one
    should be used whenever we deal with members of a channel at business
    level;
  * ``channel_last_seen_partner_ids``: memberships of a channel and technical
    model. This one should be used for internal processes and members
    management;

Also containing

  * clean naming or API of methods managing channel members. This should
    not change anything functionally as only code renaming / cleaning is
    performed;
  * improve performances of channel member auto subscription by aggregating
    all members to add and creating them at once;
  * check the use of ``mail.channel.partner`` and ``res.partner`` records
    through ``channel_last_seen_partner_ids`` and ``channel_partner_ids``
    Channel fields;

Functionally nothing should change with this commit. It only cleans code
in order to prepare future modifications.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:07:25 +00:00
Thibault Delavallée 10af1a949b [REF] mail: remove is_subscribed duplicated field on mail.channel
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

SPECIFICATION

Channel holds two fields computing current user's membership on channel.
``is_subscribed`` is a duplicate of ``is_member``. It is therefore removed
to keep a single field.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:07:15 +00:00
Thibault Delavallée 74dc9795f5 [MOV] mail, im_livechat: split models related to mail channel and reorder some fields definitions
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

SPECIFICATIONS

Purpose is to prepare modifications in models by doing a preparatory cleaning
of some fields and model definitions. Notably

  * move mail.channel.partner im_livechat override in its own file;
  * slightly re-order member-related fields on channel or mail.channel.partner
    models, and split long lines;

This commit should not change anything functionally as it contains is only some
code move and reordering.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:07:01 +00:00
Thibault Delavallée 0568a528fe [IMP] mail, test_mail: use bus mock tools in tests
Purpose is to use available tools, easier for debug and asserts than doing
everything manually. It prepares future changes in channel model that may
have an impact on bus notifications.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:06:57 +00:00
Thibault Delavallée 895e534eb2 [FIX] website_mail_channel: esc-raw the maze !
Purpose of this commit is to remove unnecessary t-raw. When dealing with
numbers (len of a list or an integer coming from controllers) we may use
t-esc instead.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:06:53 +00:00
Thibault Delavallée 1d21bb4bcb [FIX] website_mail_channel: let portal readers access attachments
As reading attachments is not possible for portal users displaying a
message in mailing list frontend crashes if there is any attachment linked
to the message. Moreover downloading it would be impossible as access is
not granted.

In this commit we display attachments as sudo. Indeed if current portal user
has access to the message he should be able to access its attachments as they
are part of it. Moreover missing access tokens are generated on the fly to
enable download of attachments.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:06:49 +00:00
Thibault Delavallée 31abe454b9 [FIX] website_mail_channel: improve (un)subscribe emails content and display
When people (un)subscribe from mail channels through frontend interface
a confirmation email is sent. However if this emails fails if may be
displayed in channel chatter as there is an underlying ``mail.message``.
As this message contains recipient-specific content it is better to avoid
displaying it.

Mail message_type is therefore set to ``user_notification`` meaning only
author and recipient have access to message content. Moreover it is never
displayed in any chatter.

In this commit we also remove custom layouting of mail template bodies. We
instead fall back on rendering template body encapsulated within a notification
layout.

Finally some more information for author is also added: author is set to
channel creator, and email_from to formatted email of the company instead
of its simple version.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:06:42 +00:00
Thibault Delavallée 3591355146 [FIX] bus: fix test about bus notifications linked to bundles
Bus holds tests about bus notifications sent when changing bundles. Currently
it checks that exactly 4 notifications are sent during the test, being of
type ``bundle_changed``. However if other notifications are sent during
``bundle_changed_notification`` tour test fails even if notifications are
not linked to bundle events at all.

In this commit we fix this test by checking that we have 4 ``bundle_changed``
notifications sent during the tour. Other notifications are ignored for that
specific test.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:06:39 +00:00
Thibault Delavallée ca1ff19f55 [FIX] hr_holidays: make ooo tests less dependent on channel_info members ordering
Purpose of this test is to avoid failing tests due to list ordering not
being always predictable in channel_info.

Some out of office tests are dependent on channel_info ordering. Indeed one
test relies on members list ordering (using [0] and [1]) instead of fetching
the right member in the given result list. In this commit we

  * ensure members in channel_info effectively match expected members;
  * check content of the right channel info member instead of relying on
    list order;

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:06:36 +00:00
Thibault Delavallée 276b63170d [FIX] mail: make channel_id and partner_id required on mail.channel.partner
Purpose of this commit is to enforce model cleanliness by avoiding ugly
defined ``mail.channel.partner`` records.

``mail.channel.partner`` model is a decorated many2many relationship between
channels and partners (members). Both ``partner_id`` and ``channel_id`` fields
should be required. Members of a channel are always partners and belonging to
a channel is mandatory in that decorated m2m table.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:06:33 +00:00
Thibault Delavallée 930c6fd46c [IMP] mail, test_mail: allow to bypass user / channel group-based subscription
A context key is added allowing to bypass user / channel synchronization
when creating users. This is used notably in tests to avoid subscribing
new test users to "general" channel created as default data.

Purpose is to avoid interferences in query-based performance tests. It also
avoids unnecessary data creation and/or update when it is not necessary
especially in tests.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:06:26 +00:00
Swapnesh Shah c150c865d4 [FIX] sale: remove duplicate access rights
Access Rights for model `res.partner` for group `sales_team.group_sale_manager` is already defined in the same file.
https://github.com/odoo/odoo/blob/master/addons/sale/security/ir.model.access.csv#L24

closes odoo/odoo#64295

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-03-17 17:31:52 +00:00
Benoit Socias d41083e2fb [FIX] base: make the tests of sorted ir.filters work
Before this commit ir_filter tests were calling model.search() with an
array as order. It was not a problem because none of the tested filters
was actually using the sort and the falsy empty array was therefore
ignored by model.search().

After this commit ir_filter test calls model.search() with a string as
order.

task-2453416
See https://github.com/odoo/odoo/pull/65554

closes odoo/odoo#68036

X-original-commit: f326ba2d14e4fdd811426c6381b7e5bc3c1d657b
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-03-17 16:08:52 +00:00
Nicolás Mac Rouillon af13260873 [FIX] sale_coupon(_delivery): Filter the taxes by company.
In this case for scenario with multi-company, the new line of the reward product, should be set with the taxes for company of the current sale order.
Before this change the taxes that are selected were for the all companies setted in the product.

closes odoo/odoo#68029

X-original-commit: eb6ba44a6bfd0ebfce887edc307e0306765e5183
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-03-17 15:09:46 +00:00
Swapnesh Shah c734e975a3 [FIX] sale_timesheet: fix typo in view
Cf #52073

closes odoo/odoo#68024

X-original-commit: 1efece5e44c2a69435184b98cb7a984acc881e90
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-03-17 14:21:23 +00:00
Goffin Simon ad59ebeace [FIX] hr_holidays: Impossible to delete a refused Time-Off request
Steps to reproduce the bug:

-Create a time-Off request R1 for 27/01
-Refuse R1
-Create another Time-Off request R2 for the same date 27/01
-Set R1 in draft
-Try to delete R1

Bug:

A ValidationError was raised:

You can not set 2 time off that overlaps on the same day for the same employee.

opw:2447540

closes odoo/odoo#68005

X-original-commit: 22db3d4168b61f2904e331ac570a1df4904d9791
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-03-17 11:29:14 +00:00
David Tran f86f92d462 [FIX] sale: do not overwrite invoice values specified by
`_prepare_invoice`

Since a3afb98, the `invoice_line_ids` value is replaced in
`_create_invoice`.
This broke some custom client overrides based on overrides of
`_prepare_invoice`.

This commit brings back the old behavior, ensuring that the
`invoice_line_ids` values
specified by `_prepare_invoice` are extended but not replaced.

closes odoo/odoo#68015

X-original-commit: 9beceb0fd4572bdada30cf4ded235c1ff634083c
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-03-17 12:43:07 +00:00
oco-odoo 167655e2ce [FIX] account: make tax report duplication work properly
Before this, due to the order the lines were interated on (their sequence), some lines were duplicated without parent, making the duplicate report's layout different from its parent. We now ensure we treat the lines in an order that guarantees the parent line has always been copied before its children.

closes odoo/odoo#68011

X-original-commit: c815342b986851e0a4733ed5bf9fbcc7f8fb7442
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-03-17 11:59:42 +00:00
root 9404c2815e [IMP] sale: set id on invoice block for easier xpath
Before this commit it was rather painful/cluncky to find a way to remove this block.
By setting a name on the block we can easily xpath it to replace it or add extra content within.
This makes it easier for external devs to influence this view.

closes odoo/odoo#68010

X-original-commit: d418e4e16a46a0d499e606598b3524eabd19e5fd
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-03-17 11:57:32 +00:00
Laurent Smet fbe1cca0d6 [FIX] account: Set 'move_id.ref' as payment memo with vendor bill
The current behavior was to set the label as memo in the payment register wizard.
However, this is to restrictive when a vendor bill hasn't any payment reference but a bill reference.
In that case, the user is expecting to have the bill 'ref' in the payment 'memo'.

Since the matching rules in the reconciliation widget are matching line.name, then line.move_id.ref and then line.move_id.name, the same logic is applied here to construct the payment 'memo'.

closes odoo/odoo#68004

Opw: 2440389
X-original-commit: 92ceb86d58f4d78c8a4256f29d101d3730517b93
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-03-17 11:08:05 +00:00
Julien Castiaux e5cf8cc8b7 [REF] Lunch: Use dynamic daily crons for auto emails
The Lunch module can automatically send an email to a supplier with the
daily orders at a configured time. It can also remind the users via chat
so they don't forget to order their sanddwish.

Before, two high frequency cron jobs were responsible to check every 20
and 5 minutes if we reached the moment when to send the email to the
suppliers or the notification to the users. Together the two crons were
executed 360 times a day.

The new model uses a dedicated daily cron per supplier record and per
alert record, the dedicated cron is created on the fly and its moment of
execution automatically updated to reflect the supplier/alert record.

See also #41858 for prior work.

closes odoo/odoo#63749

Task: 2416741
Related: odoo/upgrade#2044
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2021-03-17 02:10:41 +00:00
oco-odoo 758f09890a [FIX] account: forbid making refunds on incompatible journals
It shouldn't be possible to create refunds on misc journals, as the tax report would compute the wrong multiplicator sign, and hence end up being entirely wrong.

Introducing the constraint also allowed finding an issue within _move_autocomplete_invoice_lines_create: some tests directly create an invoice by giving it line_ids instead of using the invoice_line_ids helper. The former implementation of this function made it so that the default type wasn't set in the context properly, and these tests were putting their invoices on misc journals. We fix this here as well.

closes odoo/odoo#67965

X-original-commit: fdc96de0e411760f84a78c36543f9157332346de
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-03-16 14:23:32 +00:00
Nasreddin (bon) 9857b96b97 [FIX] website_blog: display post_date on latests blogs
Issue

	- Install 'Blogs' module
	- Create a blog post
	- Set published_date to 01/01/1997
	- Go to website
	- Edit any page and add a 'Blog Posts' Block
	- Set 'Layout' to 'Cards' (or 'Horizontal')
	- Save

	In snippet cards, the blog post date is not the published date.

Cause

	Displaying update date ('write_date' field) instead of
	the published date ('post_date' field).

Solution

	Replace 'write_date' by 'post_date'.

opw-2443104

closes odoo/odoo#67985

X-original-commit: 681e709b239c2456c71d1c16bb40de055dfb927c
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-03-16 16:54:39 +00:00
Mathias Markl 6ca12a2545 [IMP] base: performance improvement when installing a module
closes odoo/odoo#67316

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-03-16 11:50:29 +00:00
Victor Feyens 4b2c6ff064 [REM] l10n_fr: duplicate method (_prepare_all_journals)
defined first 4y ago in https://github.com/odoo/odoo/commit/d56baebc8e7f654304eca59b3c58ceb80846c659
then 2y ago in https://github.com/odoo/odoo/commit/182b4d86f443eefcc647fb44f0b1f5fe406637d4

Merge the two methods, keeping the one in the dedicated account_chart_template file,
but improving it with the early check on the company country code.

Fixes #67728

closes odoo/odoo#67882

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-03-15 15:46:27 +00:00
Xavier Morel 4ef97f2125 [FIX] base_automation: mis-ordered computation of stored fields
Client issue: when updating the company of a contact, the Display Name
keeps using the previous company's name, so given Bob in company A, if
Bob is moved to company B the form's title remains "A, Bob" instead of
becoming "B, Bob". More annoying, if Bob is moved back to A the name
becomes "B, Bob".

On res.partner, `display_name` is a stored computed field which
depends on `commercial_company_name` (via `name_get` -> `_get_name` ->
`_get_contact_name`). This is an other stored computed name, which
depends on `commercial_partner_id`, which is yet another stored
computed name, which depends on the `parent_id`.

The dependencies are meh but usually resolve fine, the issue occurs
when a base.automation rule is created with a non-empty
domain (including an empty literal list, which was the case here):
when the first field of the sequence is computed, base.automation's
`_compute_field_value` is called. This calls `_filter_pre`,
which (because `filter_pre_domain` is non-empty) calls `search` on the
model.

This would normally be innocuous as `search` will only flush the
fields used in the search, however for `res.partner` the default
`_order` is... `display_name`. Meaning we flush that computation,
forcing the computation of `commercial_company_name`, but since
`commercial_partner_id` is being computed we reuse its old value (or
something), which is not re-recomputed after the
`commercial_partner_id` computation ends.

So rather than resolve a full search involving an order, filter the
records in-place.

OPW-2427264

closes odoo/odoo#67987

X-original-commit: 221ea6079b2beeb66c4cfa48b237791e1b380c5e
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-03-16 16:55:20 +00:00
qsm-odoo e5a701de42 [FIX] web: properly find the scrolling element of zoomed pages
To find the main element which scrolls in the page, we rely on its
height being as tall as the body one. The code which checks that was
making a comparison between a rounded value and floating value without
care of the rounding errors that might induce, especially on zoomed
pages.

Fixes https://github.com/odoo/odoo/issues/63306

closes odoo/odoo#67986

X-original-commit: 71b6fc7341dfec5e8fc2352c3143b1e324a880f8
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-16 16:54:58 +00:00
Julien Mougenot 9bf7d15da4 [FIX] web: allow filtering with decimals on price filter + unit test
Issue

	- Install "Sales"
	- Switch to "German" language
	- Go to Sales -> Products -> Products
	- Try to filter on "Public Price" is equal to "2,3"

	Not possible to add decimal point at the end (only in middle of number).

Cause

	In case the 'decimal point' in DB params is not a dot '.',
	the filter input will be considered as 'text' instead of
	'number'.

	In case of the 'number' type; HTML do already a pre and post
	processing, including managing decimal point (who, for example,
	is not included in ev.target.value if last char is a '.').
	Unfortunalty, the library is not well working with other
	language and not supported on every browser, therefore,
	must use own logic.

	In case of a 'text' type, the value will be send to 'parseFloat'
	,then `parseNumber` will replace decimal_point by dot (also one the
	issues since needed to display decimal_point according user language),
	and `Number` will remove the decimal_point in case of '123,' -> '123',
	and therefore we will not be able to write decimals ( apart of adding
	the decimal point after writing the whole number...)

Solution

	If user input is well parsed, store parsed value in condition.value and
	set condition.displayedValue to the input value (an so without updating
	input value). Else, replace input value with previous value (who should
	be the condition.DisplayedValue).

opw-2463441

closes odoo/odoo#67978

X-original-commit: e795ce5bff14b6b748c1f4a2651946aafdc299f4
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-03-16 16:02:07 +00:00
Adrien Widart 387e9a402a [FIX] purchase,purchase_product_matrix: ignore date planned
When adding a variant product, if the option "Variant Grid Entry" is
enabled, it will reset the delivery date of each purchase order line.

To reproduce the error:
(Use demo data)
1. In Settings, enable "Variant Grid Entry"
2. Create an RfQ
3. Add the field "Delivery Date" to purchase order line view
4. Add a basic product (e.g. "[FURN_6666] Acoustic Bloc Screens")
    - Keep its delivery date in mind
5. Add a variant product (e.g. "[E-COM12] Conference Chair (CONFIG)")

Error: The delivery date of the first purchase order line has changed
for no reason. Moreover, suppose that in step 4, the user defines a
specific date: the latter will still be changed after the variant
product is added.

When adding a product, the delivery date of the purchase order and its
lines are recomputed. However, an override of `onchange` ensures that
the new delivery date of the lines will be ignored if the `onchange`
concerns the field `order_line`. Here is the problem: when using the
Variant Grid Entry, the `onchange` concerns the field `grid`. As a
result, the new delivery dates are kept. This explains the creation of
`_must_delete_date_planned` in this fix.

However, when returing the result of an `onchange` linked to `grid`, the
result contains the existing lines (on client side) and the new ones
(from the Variant Grid Entry). If the field `date_planned` of the new
lines is deleted, the client will raise an error when it tries to render
these dates (it has no information about their value). Since existing
lines are of the form `(0, <client_id>, <values>)`, this fix only
deletes `date_planned` field for lines with <client_id> defined.

OPW-2454164

closes odoo/odoo#67972

X-original-commit: d2d495bca3e91862470702f1ef07aa27c33d8e2d
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-03-16 15:12:08 +00:00