Commit Graph
154285 Commits
Author SHA1 Message Date
Thibault Delavallée 115f5663f1 [PRF] mail, note: improve default activity type computation and remove useless ref
Change some ``ref`` to low level method ``_xmlid_to_res_id``. The latter one
does not call exists, which allows to gain one query that we do not need
here.

Default methods on activity / activity mixin to find the default activity
type (todo, model-based, generic) are cleaned. Notably code was duplicated
between mixin and activity, it now always call the same code.

Remove an unnecessary ref, probably a leftover of new rendering methods on Qweb.

Remove an unnecessary sudo.

Task-2883589 (Activity performance and cleaning)

Part-of: odoo/odoo#93682
2022-08-26 03:42:59 +02:00
Thibault Delavallée 9aa934e683 [PRF] mail: send activity bus notifications in batch
No need to send bus notifications one by one, we may use sendmany. Various
activities crud methods send notifications, better group them when possible.

Task-2883589 (Activity performance and cleaning)

Part-of: odoo/odoo#93682
2022-08-26 03:42:59 +02:00
Thibault Delavallée 0a380fec77 [PRF] mail: create activities in batch in activity mixin
Improve performance by batching activities creation through the mixin. This
helps saving some queries.

Task-2883589 (Activity performance and cleaning)

Part-of: odoo/odoo#93682
2022-08-26 03:42:58 +02:00
Thibault Delavallée 3aa938cc05 [IMP] mail: add helpers to order/group activities
Purpose is to add helpers on activity model, notably to ease batching based
on models. As activities are linked to records using a res_model / res_id
pair most code is not optimized (checking records one by one). Purpose of
this tool is to ease doing computation by batch of models.

Task-2883589 (Activity performance and cleaning)

Part-of: odoo/odoo#93682
2022-08-26 03:42:58 +02:00
Thibault Delavallée 6bea3c7605 [IMP] mail: return generated records in mail composer
We now return generated records when calling ``_action_send_mail`` on mail
composer. This allows to have access to generated emails (in mass mode) or
posted messages (in comment mode). Otherwise we have to access sub-fields
like activity_ids / message_ids, which may be inefficient or generate extra
ACLs checks.

Also replace some |= with += when usage of OrderedSet is not necessary. To
keep ordering, ordered sets are used when doing an or between record sets.
However in some cases we know we are simply adding records not already in
a previous record set, meaning we can just use +.

Task-2883589 (Activity performance and cleaning)

Part-of: odoo/odoo#93682
2022-08-26 03:42:58 +02:00
Thibault Delavallée 3cc931ef58 [IMP] mail: add helper to find customer partner on thread
Purpose is to use it notably in Voip where we link activities / phonecalls
to partners when possible. Future commits will use it more often in thread
methods.

Method to have the primary email is moved with that helper method in a sub
section, in order to have "model" helpers in the same section. Its code is
also simplified and fixed (return missing). Its name is made coherent with
other naming in the file.

Task-2884301 (Voip activity synchronization simplification)

Part-of: odoo/odoo#93682
2022-08-26 03:42:58 +02:00
Alexandre Kühn f5304e4c80 [FIX] im_livechat: remove imperative update of Chatbot/state
Task-2961956

closes odoo/odoo#98817

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-08-26 01:55:39 +02:00
Raphael Collet 07744c64e9 [FIX] core: in ir.model.fields, discard deleted fields from registry
This patch discard the fields to delete from data structures like field
triggers, field inverses, and fields to compute.

This is quite useful when uninstalling modules.  This commit fixes the
uninstallation of modules base_setup, bus, mail, web_tour.

closes odoo/odoo#98668

X-original-commit: 49398a769b2ec4965bf148f10b5e13d0a6c1acff
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-08-25 22:46:04 +02:00
william d92a8b5ffd [IMP] web: continue to edit lists when editable=top
Previous behavior
================

When `editable=bottom`, when we hit tab until the end of the line, the
user starts to create a new record.
But when `editable=top`, when hitting tab multiple until the end of the
line, the user starts to edit the first line that was existing before
instead of creating a new one.

New behavior
============

The behavior is consistent between both cases: the user can always
continue to edit lines one after the other.
The behavior for `editable=bottom` is not changed, but `editable=top`
continues to add lines on top one of each other.

linked to task-2879904

closes odoo/odoo#98603

Signed-off-by: Georis François (fge) <fge@odoo.com>
2022-08-25 22:46:00 +02:00
Xavier BOL (xbo) 8d46e54c96 [IMP] project: externalize getFirstElementForXpath in test utils file
Before this commit, the `getFirstElementForXpath` function is used in
the unit test for the burndown chart. This function is used to select a
HTMLELement with xpath expression and could be used outside the unit
test of the burndown chart.

This commit externalizes this function in a project test utils JS file
to use this function in another unit tests file if needed.

task-2924268

closes odoo/odoo#97574

Related: odoo/enterprise#30173
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-08-25 19:57:32 +02:00
Alexandre de Pape (alpa) 2e4a225fb4 [IMP] websale_stock: back in stock notification
This commit adds a message "Be notified when in stock" on a product when it is out
of stock. When clicking the message, a form appears where the user can enter
his email. If he is a logged user, the email associated to the partner of the
user is pre-filled in the form. Otherwise the user enters his email.

task-id 2806828

closes odoo/odoo#96633

Related: odoo/upgrade#3718
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-08-25 19:57:26 +02:00
Odoo's Mergebot 55ab08904e [MERGE][IMP] mail, rating: delay rating request sending
FUNCTIONAL ISSUE

When they receive a rating request email, customers can click on this email to
pick a satisfaction level. However, this feedback is currently effectively
posted only when customers submit the feedback form.

Many customers do not go that far in the process and just close that form. This
means that while the feedback is caught and stored in DB nothing is posted and
users are not notified of this rating.

PURPOSE

When the customer clicks on an emoji, post a message in the chatter without
launching notifications. After 2 hours notify followers. If before this delay
the customer fills in the form, update the post content (new face, feedback)
and launch notification process with the feedback (inbox, emails, ...).

By default, the user has 2 hours to fill the feedback, after those 2 hours
we notify the message containing only the first rating without feedback.

TECHNICAL

Currently, rating from email (route with token) is the following

  * Customer receives an email;
  * Customer clicks one of the smiley face that redirects to a ``/rate`` route
    with the token and rate value;
  * the linked ``rating.rating`` record is updated and set consumed;
  * Customer may change its face and add a feedback. In that case a message
    is posted with the rating face in it;

Issues raised by this

  * first rating update does not notify anyone, no message is posted;
  * if Customer does not give a feedback, process is stuck at that point;
  * the rating is not really linked to the posted message (see ``message_id``
    field of ``rating`` record);

Fix that issue to have message directly at beginning of the flow and improve
log and notifications. Update ``rating_apply`` to post the message and update
it when feedback is given.

Allow to delay sending of notifications using a ``mail.message.schedule``
queue model that stores when to launch the notification process for a given
message.

See sub commits for more details.

LINKS

Task-2826699 (Mail: use datetime for scheduled_date mail field instead of char)
Task-2207626 (Rating: Log ratings, post feedbacks)

closes odoo/odoo#95623

Related: odoo/enterprise#29268
Related: odoo/upgrade#3669
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-08-25 19:57:18 +02:00
Thibault DelavalléeandAdrien Dieudonné 22c3cc51ed [FIX] rating: fix bootstrap and styling of rating email and pages
Rating page is broken since migration to bootstrap5. This commit fixes various
issues linked to btn-group, display and usage of group checkboxes. Overall
html structure is cleaned and bootstrap 5 rules are applied.

Some small display improvements are also applied to the rating email.

Task-2207626 (Rating: Log ratings, post feedbacks)

Part-of: odoo/odoo#95623
Co-authored-by: Adrien Dieudonné <adr@odoo.com>
2022-08-25 19:57:17 +02:00
std-odooandThibault Delavallée 6ebb72332e [IMP] rating: improve rating notification with delaying until feedback
Purpose
=======

When someone receives an email with a rating request, he can click on a
smiley. But if he does not write a feedback, nobody is notified. This means
some rating as somehow lost and people are not notified of it.

Specifications
==============

Now, when the user clicks on the smiley, a message is posted but notifications
are not yet sent. This uses the new ``mail.message.schedule`` mechanism added
in this PR. It gives the user some time to write their feedback and send it.

If they write and submit a feedback, the notification process is launched.
Emails and inbox notifications are created and sent.

If they don't write a feedback notification process is launch after 2 hours.

Testing
=======

Some cleaning is done in tests, notably to split some fields tests from
performance test. A bit performance test is also split into sub tests in
order to better understand queries.

Task-2207626 (Rating: Log ratings, post feedbacks)

Part-of: odoo/odoo#95623
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2022-08-25 19:57:17 +02:00
Thibault DelavalléeandStéphane Debauche c5afd7c30f [IMP] mail: allow to update scheduled date of notifications when updating content
Purpose of this commit is to allow to update the scheduled date when using
``_message_update_content`` tool method. This allows notably to delay the
sending of notifications in some cases, then send it once all content is
updated according to business requirements.

When giving a scheduled date in kwargs

  * either it is set, and we update message schedulers accordingly;
  * either we force a void value, which means notification should be done
    now and we trigger the schedulers for immediate sending;

Task-2207626 (Rating: Delay rating notification to ease feedback)

Part-of: odoo/odoo#95623
Co-authored-by: Stéphane Debauche <std@odoo.com>
2022-08-25 19:57:17 +02:00
std-odooandThibault Delavallée 9b11a9d82b [IMP] mail: schedule emails and notifications
Purpose
=======

Currently, only email sending can be scheduled with the `scheduled_date` field
defined on on <mail.mail>. It's not possible to delay the sending of
notifications.

We want to be able to delay the sending of the emails, but also the inbox
and bus bus notifications.

Technical
=========

For that purpose, we created a new model which stores the message we need to
notify with the scheduled date. When a scheduled_datetime is given we skip the
notification process. Instead an entry in that new model is created. A cron
regularly polls the scheduled message and launch the notification process on
messages that are ready to be sent.

Task-2207626 (Rating: Delay rating notification to ease feedback)

Part-of: odoo/odoo#95623
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2022-08-25 19:57:16 +02:00
Stéphane Debauche aed52f3e0a [IMP] mail: correctly support scheduled_date from template when sending emails
Purpose of this commit is to correctly generate and support scheduled date
defined on template when using ``send_mail`` tool that send emails directly
from a MailTemplate.

It uses the parsing tool method defined on mail.mail in order to have a
datetime localized in UTC then set timezone agnostic as expected by the
ORM.

Task-2826699 (Mail: use datetime for scheduled_date mail field instead of char)

Part-of: odoo/odoo#95623
2022-08-25 19:57:16 +02:00
std-odooandThibault Delavallée eb75a77646 [REF] mail: update the message content in the mail thread model
Purpose
=======

Move the code which updates the mail message from the message model to mail
thread. Most other thread methods (like `_message_update_content_after_hook`)
are defined at record model level. It makes sense to delegate the update to
documents and not to the message. Message is a low-level technical object
that should not really hold business code.

While modifying this code, an update is done in the update content. We now
also allow to update the body without removing all attachments.

Finally tests are added as this feature was added without really testing
model code.

Task-2207626 (Rating: Delay rating notification to ease feedback)

Part-of: odoo/odoo#95623
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2022-08-25 19:57:16 +02:00
std-odooandThibault Delavallée cd5850d83d [REF] mail: use a datetime instead of a char for the mail scheduled date
Purpose
=======

Historically, we use a char field on the <mail.mail> to match the field type
on the <mail.template>. But even it's useful to have a char field on the mail
template (which can contains QWeb code or Jinja previously to Odoo 15.0) it is
not that useful for the <mail.mail> to keep this char type, because the value
is already rendered. Moreover this forces to have some code convert and store
datetime values using the standard format and in UTC.

We now correctly use a datetime field, as all other fields of that kind in
Odoo.

Task-2826699 (Mail: use datetime for scheduled_date mail field instead of char)
Prepares Task-2207626 (Rating: Delay rating notification to ease feedback)

Part-of: odoo/odoo#95623
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2022-08-25 19:57:15 +02:00
Laurent Smet bedf191134 [IMP] account,l10n_*: Set 100 as default value for factor_percent in tax repartition lines
closes odoo/odoo#94125

Related: odoo/enterprise#28648
Related: odoo/upgrade#3695
Related: odoo/documentation#2557
Signed-off-by: Laurent Smet <las@odoo.com>
2022-08-25 19:56:56 +02:00
oco-odoo b7232b14b7 [IMP] account, l10n_*: Introduce unified reporting engine
This commit adapts account's model to the new report engine introduced for v16, and updates the data files accordingly.

account.report model is now declared in community, together with the other models used by the reporting. This is done so that the tax tags can properly be created by the tax report and used on tax templates. All the actual computation logic stays in enterprise.

See enterprise commit for full details.

Task 2524389

Part-of: odoo/odoo#94125
2022-08-25 19:56:55 +02:00
Pratik Raval bb24757d08 [IMP] crm: detect leads based on similar phone/mobile number
Currently, the 'similar lead detection' mechanism only considers email,
contact name, and partner name while finding duplicate leads in CRM.

After this commit, it will also consider the mobile/phone number for
the same. Note that the mobile numbers and phone numbers both will be
matched with each other while finding duplicate leads.

Task-2817884

closes odoo/odoo#88372

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-08-25 19:56:48 +02:00
MerlinGuillaume 4ffde5b8b9 [FIX] web: use different hotkeys for 'ADD' and 'SAVE' buttons
A modal using the 'ADD' and 'SAVE' buttons will have the same keyboard
shortcut for both of these buttons

Steps to reproduce:
1. Install Inventory
2. Go to Inventory > Operations > Transfers and open a transfer with a
contact and in status 'Ready'
3. Click on 'EDIT' and open the contact in the Delivery Address with the
quick edit button
4. Push on 'Alt' key: the 'ADD' and 'SAVE' buttons use the same shortcut

Solution:
Modify the current hotkey used for button 'SAVE'

opw-2954146

closes odoo/odoo#98884

X-original-commit: 0f8d28269f4900e70d7fefbb359580390656cdf7
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2022-08-25 18:25:22 +02:00
Adrien Dieudonné 137445164b [FIX] website: removes BS5 dropdown from searchbar
This commit partially reverts https://github.com/odoo/odoo/pull/98254/
in which we use the correct toggle attribute.

The problem is that this part is customized and the DOM is not as
expected by Boostrap (BS5 seems more strict than before).

Because of this, we consider that we shouldn't use Bootstrap's dropdowns
(the js part) for this case but we want to keep the same design.
To do so, we simply replace the class name by a custom one to prevent
BS from accessing it and we apply an @extend to keep all the css rules.

Because @extend could be costly in terms of performance, we did some
analysis:
* +3kB for the css frontend assets bundle.
* No significant change for the bundle Generation time:
  [1.66sec - 2.93sec] vs [1.71sec - 3.31sec]
  (quite difficult to analyse due to the number of variation)

Note that we already have this @extend in the backend and we could have added
this in asset common but we didn't as it will soon be deleted from the backend
(we will use our own dropdowns).

Steps to reproduce:

Go to shop page.
Type "desk" in the search input.
The suggestion popup appears.
Click outside the field. (e.g. to the left of it)
Click on the search field.
=> An error popup was displayed.

closes odoo/odoo#98756

Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2022-08-25 17:02:52 +02:00
Florian Charlier b542ceec63 [FIX] website_slides: fix embed-over-nav overlap
The `ratio` class used for embeds creates a static context.
Using `position: relative` for the subsequent element makes sure it doesn't
end up 'under' the embed on large viewports sizes.

For simplicity, we chose to not test for the actual presence of an embed
or window size before applying position-relative on the next div.

Task-2663320
Part of odoo/odoo#79615

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-08-25 14:24:53 +02:00
Florian Charlier db7c9ba7c5 [IMP] tools, website_{*}: increment multiple fields at once
* = blog, forum, slides

For performance reasons, allow to increment multiple fields of the same record
within the same query.

With python tests.

Task-2663320
Part of odoo/odoo#79615
2022-08-25 14:24:53 +02:00
Florian Charlier e3389e392e [IMP] website_slides: Improve frontend UI
The layout of slides needs a little freshening-up.

### Comments and slides

* The ratings are only showed once, and only for "documentation" contents
* Indications of why the user cannot post a comment are added (signing up,
  Karma, commenting not allowed), and the portal template is not called if
  there is no comment and commenting is not allowed (for user or course).
  In addition, the "Comment" tab is never hidden anymore, to not hide
  the available/activate-able features.
* Detailed view statistics are now shown only to selected users.
* Slide public views represent views by the public and all users that
  are not members of the course.
* When channel/slide images are not set or inaccessible, a default image
  is used (instead of plain background or unauthorized requests).
* These images are now editable on frontend.
* The 'Additional Resources' subtitle is hidden from the detailed slide view
  for invite-only courses as nothing else was shown with it.

### Misc.

*  This commit also fixes the "unresponsive" `total_views` count after public
views, by manually incrementing it too. This is required because `public_views`
is directly updated via SQL query and does not trigger model _computes.

* We also adjusted the test in survey that used a public user while in all
cases users must be logged-in (and therefore get portal privileges) before
they can participate.

Task-2663320
Part of odoo/odoo#79615
2022-08-25 14:24:52 +02:00
Bruno Boi ec70294e64 [FIX] web: invalid kanban record quick_create stays open
- Before this commit
Validating an invalid kanban record on quick creation
would leave the quick creation mode.

- After this commit
Validating an invalid kanban record on quick creation
will stay in quick creation mode, indicating which fields are invalid.

closes odoo/odoo#98874

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-25 12:05:47 +02:00
luvi 67b41d47e6 [FIX] im_livechat: add w-auto on layout colors fields
In commit 0194fa8236144596042a20f182ec3f48ea29b998, we fixed
the appearance of the color list in the livechat channel view.
But w-auto classnames were not added to some fields, which let
the positioning issues only partially fixed.

This commit concludes the fixed introduced in #98755.

closes odoo/odoo#98871

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-25 12:05:43 +02:00
luvi c8c34b7e0e [REV] project: revert changes in template
This commit reverts changes that are no longer
necessary since PR #98711 which fixed a lot
of issues regarding styles and alignments.

closes odoo/odoo#98867

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-25 12:05:40 +02:00
FrancoisGe 2e23ac138d [FIX] web: debug menu view metadata
Before this commit, in a legacy view, clicking on debug menu
"View Metadata" causes a crash.

closes odoo/odoo#98866

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-25 12:05:36 +02:00
Guillaume (gdi) 1006cfb47e [FIX] website: prevent to have two modals for Images Wall
Before this commit, when you double-clicked on an image in the Images
Wall block, the modal appeared twice. This commit ensures that for the
block Images Wall, only one modal can be present at a time.

Steps to reproduce the problem:
- Drop the block Images Wall on a page
- Save
- Click twice quickly on the same image

-> Two modals are open (one on top of the other)

task-2937538

closes odoo/odoo#98857

X-original-commit: e21ff31c429a8bc339f527a2e4eacc0f1b2f6d7d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-08-25 12:05:33 +02:00
Benoit Socias 375f4dff1c [FIX] web_editor, *: clean previously shown link in link popover
*: web_tour, test_website

Since [1] when the link popover was introduced, when the URL of a link
was made empty, an validation error appeared by the previously shown URL
did still appear inside the popover.

After this commit the previously shown link is replaced by a message
that indicates that no URL is specified.
The telephone and envelope icons are now also always removed when the
URL is change: they used to be only toggled, which made it possible to
make them appear and disappear by updating an email address or a phone
number.

Steps to reproduce:
- Add an image-text snippet to the page
- Select the image
- Add a link on the image
- Specify URL
- Click on image => link popup shows the entered URL
- Make the URL field empty
- Click on image
=> link popup still showed the previously entered URL

[1]: https://github.com/odoo/odoo/commit/8fcf930a6b6b7ffb0965b0a689c7a3117962ce7e

task-2765857

closes odoo/odoo#98845

X-original-commit: f212c56d73f5dad8eb5850b0b39cc92f55706ee2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2022-08-25 12:05:29 +02:00
Benoit Socias afe148341a [FIX] web_editor, website: not show link tools if link contains a media
Since [1] the link tools got created when the destroyed sub-elements of
the link were clicked on. This causes a problem when the element is a
media because upon destroy the tools reset the link to an incorrect
state.

After this commit the link tools is not touched anymore if the element
that was clicked on is a media.
Also, it reflects the changes done in the popup into the media link
options, and the ones done in the option into the popup.

Steps to reproduce:
- Add an image-text snippet in the page
- Click on the image
- Set up a link
- DO NOT click on the image again
- Click on the left of the image (to click on the snippet itself)
- Click on the image again
=> The image was removed instead and a text link remained

[1]: https://github.com/odoo/odoo/commit/d69d26a2dd8830aca8c5922d3548e5ff59c688fc

task-2765857

X-original-commit: 11ee7d5520c3a14a381b3f5b973114670f1e2edb
Part-of: odoo/odoo#98845
2022-08-25 12:05:29 +02:00
Bruno Boi c343318f93 [FIX] web: keydown traceback on empty m2m_tags(_avatar)_field
- Before this commit
On an empty m2m_tags(_avatar)_field, triggering a keydown event yields to a traceback due to an owl issue.
This will be fixed in owl later.

- After this commit
The 't-on-keydown' attribute on TagsList component has been moved into the tags themselves.

closes odoo/odoo#98840

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-25 12:05:24 +02:00
Bruno Boi d56468eb66 [FIX] web: disable browser autocompletion for AutoComplete component
- Before this commit
The browser autocompletion feature may conflict with
the AutoComplete component. First, the browser could
display its own autocompletion dropdown over our component's.
Secondly, selecting an item in the browser's autocompletion
dropdown simulates a keydown event with an undefined 'key' property,
leading to display traceback when the AutoComplete component
uses the keydown event (i.e. in getActiveHotkey).

- After this commit
The <input/> of our AutoComplete component now has the following attr
`autocomplete="off"`. This disables the browser's autocompletion feature
for this <input/>.

Part-of: odoo/odoo#98840
2022-08-25 12:05:24 +02:00
Demesmaeker 05a4c4ad0e [FIX] sale: ensure pricelist rule available
task-2961855

closes odoo/odoo#98808

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-08-25 12:05:19 +02:00
Julien Mougenot 1ab23b9467 [FIX] web: Prevent drag on kanban record dropdown
Before this commit, clicking on any part of a kanban record would
initiate a drag & drop sequence, this included its dropdown. This caused
2 issues:

- You could start to drag & drop records by dragging their still opened
dropdowns ;

- Said dropdowns would remain open when dragging their parent record.

This commit fixes both of these issues by hiding dropdowns during drag
sequences and preventing drag when clicking inside the dropdowns.

closes odoo/odoo#98791

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-08-25 12:05:15 +02:00
Julien Mougenot cf4a8f198f [IMP] web: Add 'ignore' param to useSortable
This commit adds a new parameter to the 'useSortable' hook that allows
HTML elements to prevent a drag sequence. This 'ignore' param can be a
string or a function returning a string, that will be a selector
targetting the elements that need to prevent drag & drop sequences.

Part-of: odoo/odoo#98791
2022-08-25 12:05:15 +02:00
Nicolas (vin) 3bac0f9d68 [FIX] account: Do not add tax grids for CABA taxes upon reversal
When using CABA and reversing a move, we expect the CABA move to
be the one impacting the tax grids, and not the reversed move.
Thus, we now avoid setting the tax grids for CABA taxes on
move lines created when making a reverse move.

Task id # 2895267

closes odoo/odoo#98789

X-original-commit: 5dd50ac1433be262ddd49d8b165e240afd16e675
Signed-off-by: Laurent Smet <las@odoo.com>
2022-08-25 12:05:10 +02:00
Xavier-Do 5648cc9aa4 [FIX] base, l10n_*: set currency with existing lines
Since #96791 the currency is reset to USD when starting a test to be
less dependant of demo data when starting tests.

Unfortunatelly, some l10n_modules will add account.move.line demo data
leading to an error:

        You cannot change the currency of the company since some journal
        items already exist

An initial solution would be to delete the existing account.move.line

        cls.env['account.move.line'].search([('company_id', '=', company.id)]).unlink()

This is only possible passing some context flags in order to disable some checks

        existing = cls.env['account.move.line'].search([('company_id', '=', company.id)])
        existing = existing.with_context(dynamic_unlink=True, force_delete=True)
        existing.unlink()

Actually, unlinking account.move.line also creates other ones.

        existing = cls.env['account.move.line'].search([('company_id', '=', company.id)])
        existing = existing.with_context(dynamic_unlink=True, force_delete=True)
        existing.unlink()
        existing = cls.env['account.move.line'].search([('company_id', '=', company.id)])
        existing = existing.with_context(dynamic_unlink=True, force_delete=True)
        existing.unlink()

Finally, it looks easier to bypass all business logic leading to the proposed solution.

closes odoo/odoo#98736

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-08-25 12:05:06 +02:00
Julien Mougenot b8d4c41331 [FIX] web: Fix behaviors of ProgressBarField
This commit fixes behavior issues in the progress bar field:

- the progressbar would not write on a field if it was declared as
'readonly' on the server (it sounds counter-intuitive but this widget
was supposed to write on records unless given the 'readonly' flag in the
field options);

- the "isEditable" prop was incorrectly computed, resulting in the field
not being editable in kanban views when it should be;

- when editing a value in the field, the focus should be automatically
given to the first input.

These issues have been fixed in this commit.

closes odoo/odoo#97411

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2022-08-25 12:05:03 +02:00
Julien Mougenot de0d409efc [IMP] web: Add params to useAutofocus
This commit introduces an object parameter to the "useAutofocus" hook,
that has 2 new optional keys:

- "refName": to override the ref "autofocus" (effectively allows to run
the hook multiple times)

- "selectAll": selects the whole value of the input/textarea (instead of
putting the cursor at the end).

Part-of: odoo/odoo#97411
2022-08-25 12:05:02 +02:00
aliya 338a974a2f [IMP] account: import cut-off entries labels
Current cut-off entry labels are always "Adjusting Entry", which is unclear, especially when viewing entries from General Ledger.
Adding the Invoice number and adjusting the % recognized within each entry will make the labels easier to understand.
The percentage will be calculated accordingly, the cut-off percentage for the adjusting entry and (100% - cut-off percentage) for the original entry.
Also, the percentage on labels should be rounded.

task-2897292

closes odoo/odoo#97045

Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2022-08-25 12:04:57 +02:00
Brice bib Bartoletti 25de7d3193 [IMP] account: duplicated_ref_ids for in_document
The aim of this commit is to improve UX by helping the user to find duplicate
bills in a more convenient way.

With this commit, when a user create a bill or credit note on bill that might
be a duplicate, a warning banner is displayed on the Form view of the
account.move.
On this banner there is a button that leads to the list of the duplicate
bill/credit note.

The previous warning message on post is also replaced by a RedirectWarning

Context:
Previously, the warning for duplicated bills was thrown when the bill was
saved. This was changed with https://github.com/odoo/odoo/pull/81748
It made the blocking warning being delayed until the bill is posted.

Previous to this commit:
A duplicate bill can only be detected automatically when posting the bill with
a non convenient blocking warning preventing the user to post his bill(s).

After this commit:
- A warning banner is displayed on the bill form during the bill creation.
- The banner contains a button leading to the list of duplicates.
- The blocking warning is improved by providing redirections to the duplicate
move.

closes odoo/odoo#81765

Community-pr: https://github.com/odoo/odoo/pull/81765
Task: #2612299
Signed-off-by: William André (wan) <wan@odoo.com>
2022-08-25 12:04:51 +02:00
Daniel Blanco 38776b8714 [CLA] update signature Blanco Martin y Asociados
Add Jose Moreno Hanshing

closes odoo/odoo#98856

X-original-commit: 4a0761986b500d21d7757cf7ff2048f861a4cee4
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-08-25 10:32:19 +02:00
Xavier-Do a80af40d2c Cherry pick of b7699100eeb887954c772f97a8e7bdc21b9a7a44 failed
stdout:
On branch saas-15.3-15.0-test-and-profiler-imp-xdo-dOrY-fw
You are currently cherry-picking commit b7699100eeb8.

nothing to commit, working tree clean

stderr:
13:56:13.661715 git.c:344               trace: built-in: git cherry-pick b7699100eeb887954c772f97a8e7bdc21b9a7a44
13:56:17.415610 run-command.c:646       trace: run_command: git commit -n -F .git/MERGE_MSG --cleanup=verbatim
13:56:17.424741 git.c:344               trace: built-in: git commit -n -F .git/MERGE_MSG --cleanup=verbatim
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git reset'
----------
status:

closes odoo/odoo#98829

X-original-commit: a319efa28c596a7b212df39002e6808c34bf9071
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2022-08-25 10:32:15 +02:00
roen-odoo f373482b29 [FIX] account: correctly reconcile refund from PoS
Current behavior:
In the PoS if you use 2 differents payment methods (cash and customer
account), and that the cash amount given by the client require you to
give some money back, the amount due on the customer account would be
incorrect on the invoice.

Steps to reproduce:
- Start a PoS session
- Add the 750$ desk to the order
- Go in the payment screen
- Add customer account with 300$
- Add cash with 460$
- Click on invoice
- The invoice show that the client need to pay 290$ which is not
  correct

Before the fix calling `_prepare_reconciliation_partials()`
with the sorted lines we had 2 credit lines (750€ and 10€)
and 1 debit line (460€).

Debit lines     |   Credit lines
460€            |   750€
                |   10€

The function would reconcile the 2 first lines and stop after that
because the only debit line was fully reconciled

After the fix we have this

Debit lines     |   Credit lines
460€            |   10€
                |   750€

After reconciling the 2 first lines we have this

Debit lines     |   Credit lines
450€            |   750€

And after reconciling the 2 last lines we have the correct amount left
to pay by the customer (300€)

opw-2857064

closes odoo/odoo#98828

X-original-commit: 1201123e272012b7b5ab65eebfd12a911ecc6c1a
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2022-08-25 10:32:12 +02:00
Josse Colpaert 55b5f3d7d9 [FIX] l10n_latam_invoice_document: add document type and number below the journal
The account_move view was changed in master and that way
the document type and number were not visible anymore or in
a weird way.  If we just put it after the journal_div, everything
seems fine.

closes odoo/odoo#98810

Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2022-08-25 10:32:08 +02:00
FrancoisGe c200b0cc8a [FIX] web: many2one close "No records"
Before this commit, when a many2one's input shows the choice
"No records", the dropdown does not close.

Cause:
When blurring, the many2one will select its first item. In our case,
"No records" is not selectable and it will not close the dropdown.

How to reproduce:
- go to a form view with a many2one field
- insert a non-existent value in the many2one ("No records" is displayed)
- leave the many2one input ("blur" event)

Result before:
The dropdown containing "No records" is still open.

Result after:
The dropdown containing "No records" is closed.

closes odoo/odoo#98799

Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2022-08-25 10:32:04 +02:00