Currently, when a BOM is archived via the ECO mechanism, its operations are
still selectable via the `copy existing operation` action on the BOM.
In this commit, we have added domain in `copy existing operation` action.
TaskID - 2845022
closesodoo/odoo#95548
X-original-commit: 272cd5358e8b78bc273d4aa72b8c42649f1f5171
Signed-off-by: Tiffany Chang <tic@odoo.com>
PURPOSE
Fix flows involving moving articles (with or without parent) as well as setting
articles as private or archiving articles. Members are not always correctly
synchronized, detached or managed.
SPECIFICATIONS
1/ Fix move to private section
The issue can be reproduced by doing the following:
* Create an article in the workspace section
* Invite an internal user with write access (e.g: "Marc Demo")
* Drag and drop it to the private section
* Stack trace
Two separate issues:
* the _check method in the article model should not be based on a SQL request
* the move to an private section should check member integrity after all members
are updated;
2/ Fix archive mechanism
The issue can be reproduced by doing the following:
* login as "admin"
* Create an article in the workspace section
* Invite an external user on this main article (does not matter, e.g: Azure Interior)
* Create a child article to this article
* On this child article, set Marc Demo as permission "none"
* login as "demo"
* Archive the main article
* login as "admin" again
* The child article should be moved as root
* The child article should have the invited external customer copied onto it
3/ Fix private propagation
The issue can be reproduced by doing the following:
* Create an article in the workspace section
* Create a child article to this article
* Invite any user on this child article (does not matter, e.g: Marc Demo)
* Move the main article to the private section
-> The child article still has its internal permission set to "write"
instead of inheriting from its parent ("No access")
-> The child article should not have "Marc Demo" as member anymore
In addition, the same logic as the archiving on point 2 applies. If you don't
have access to a child article, it should NOT be moved to private (and instead
made root).
4/ Various fixes spotted when working on previous fixes
See commits of this PR for more details about fixes and code improvements.
Task-2859616 (members permissions management)
Task-2901990 (sorting)
closesodoo/odoo#95471
Forward-port-of: odoo/odoo#94836
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
In this commit we add some explicit checks in methods managing members when
they are intended to be used directly. Some internal methods do not check
for ACLs / access, in which case a note is added in docstring to be clear
about it.
Task-2859616
X-original-commit: odoo/odoo@b2b1aeb099
Part-of: odoo/odoo#95471
Surprisingly ``_filter_access_rules_python`` returns a sudo-ed recordset. We
do not want to call super in a write as sudo, even if the recordset has been
filtered based on current user's ACLs.
In this commit we reset the recordset environment to the current user's one.
Task-2859616
X-original-commit: odoo/odoo@a41d4b9ce1
Part-of: odoo/odoo#95471
Co-authored-by: Aurélien Warnon <awa@odoo.com>
Currently, when archiving or moving an article to private, we "detach" children
of that article to which the current user does not have (write) access to.
This essentially means that these unreachable articles are detached from their
parent and set as root articles. See ``_detach_unwritable_descendants' for
more details.
However, during that process, we incorrectly considered only the direct
children of the archived / moved article.
This commit fixes it by taking into account the whole hierarchy that is going
to be modified, as archiving and making private actually propagates to all the
(reachable) article children.
Task-2859616
X-original-commit: odoo/odoo@a31f48dfa4
Part-of: odoo/odoo#95471
This commit fixes the case when we have desynchronized children for which the
current user does not have write access and we move the parent to the private
section (or archive the parent).
In that case, children that are desynchronized should not have the members from
their parents copied onto them when detaching.
See '_detach_unwritable_descendants' and associated tests for more details.
Task-2859616
X-original-commit: odoo/odoo@348740fa9f
Part-of: odoo/odoo#95471
Currently, when moving an article to the private section, its children are
untouched and keep their access rights.
This is incorrect: when making an article private, all (accessible) children
should be made private as well.
See 'knowledge.article#_make_private' for details.
An exception is made for children articles to which the user does not have a
write access to.
Those are handled as the following (same as archiving flow):
- They become independent from the parent
- They are moved as "root articles"
- The potential specific member access from their parent(s) are copied
To avoid loosing access if specific members where configured on the parent(s)
of those articles, since they will no-longer inherit from them.
Tests were added to enforce this behavior.
Task-2859616
X-original-commit: odoo/odoo@82af404c5b
Part-of: odoo/odoo#95471
Currently, when archiving an article, if you don't have write access to some of
the children of the article, we do not archive them and do some extra
post-processing.
Meaning:
- They become independent from the archived parent
- They are moved as "root articles"
- The potential specific member access from their parent(s) are copied
To avoid loosing access if specific members where configured on the parent(s)
of those articles, since they will no-longer inherit from them.
This last part was not working properly and has been fixed.
Existing tests have been adapted to ensure the behavior is kept.
Task-2859616
X-original-commit: odoo/odoo@b35f2ace22
Part-of: odoo/odoo#95471
This commit fixes the check that verifies that the article always has a member
with write access on the article.
Indeed, the current code was using a database request to check for members with
write access in a "api.constrains" check, where the data being updated is not
flushed into database yet.
It now correctly uses fields access directly, as stated by the method docstring.
For convenience, we extracted the "_has_writer_member" method to be re-usable.
An additional test case has been added to enforce the behavior.
Task-2859616
X-original-commit: odoo/odoo@ccdfb791f8
Part-of: odoo/odoo#95471
Purpose of this commit is to have less check on "is writable" constraint from
member model. With a new context key we can now bypass the constraint from
member model when we are sure it is globally verified. As in some cases we
modify members from an article, the constraint will be checked at article
level with all members being updated. In some cases doing specific checks
might lead to issues when the constraint is evaluated in a transient state
e.g. when a member is removed while new write members are not yet added.
Task-2859616
X-original-commit: odoo/odoo@a4aa856902
Part-of: odoo/odoo#95471
Co-authored-by: Aurélien Warnon <awa@odoo.com>
Co-authored-by: Thibault Delavallee <tde@odoo.com>
Reading is_user_favorite requires access on intermediate favorite model. It
is however not accessible to public users. Reading the field therefore raises
an error which is not necessary.
We can simply set the field to False as public users can not set articles as
favorite and skip the whole computation.
Task-2859616
X-original-commit: odoo/odoo@fe854b3636
Part-of: odoo/odoo#95471
Correctly set write access rule to write (and create) instead of being global.
Read rule for internals and portal users is based on has_access field. Also
add some additional details in rules name to make their name explicit and
understand the rule purpose at a glance.
Task-2859616
X-original-commit: odoo/odoo@ba05b7a87c
Part-of: odoo/odoo#95471
Improve performance of search on favorite articles by using _search. This
allows to have less specific queries and use ORM capabilities.
Task-2901990
X-original-commit: odoo/odoo@ed72a92be3
Part-of: odoo/odoo#95471
Co-authored-by: Aurélien Warnon <awa@odoo.com>
Several issues with article model ordering have been found and are fixed
in this commit:
* default order of model as ``favorite_count`` currently ascending while
we actually want most favorite articles to be on top;
* when searching sorted articles per user, we use the sequence on favorite
model. When ordering on this field we therefore have to fetch all favorite
articles and then order them based on user's sequence. Otherwise when
having more favorite articles than asked the user's sequence is not
taken into account;
* specify order in various searches to make it explicit;
Task-2901990
X-original-commit: odoo/odoo@bbabb2fdb6
Part-of: odoo/odoo#95471
Purpose: remove custom data in tests when possible, try to re-use existing
data. Improve default data to cover most use cases without being too much
complex to handle.
Add information to clearly explain hierarchy and better understand tests
impact, in common classes or specific tests generating their own test
structure.
Check tests effectively test what they intend to.
Task-2859616
X-original-commit: odoo/odoo@de92822ac4
Part-of: odoo/odoo#95471
This commit contains some post-merge cleanup in knowledge tests before adding
some new tests
* remove an unused common file, holding unused data;
* some rephrasing and cleanup in comments;
* move fields specific test into an "internal" file that holds tests for
computed fields notably;
Task-2859616
X-original-commit: odoo/odoo@bad3ee069e
Part-of: odoo/odoo#95471
This commit extracts logic necessary to make an article private from move_to
into its own method. This helps understanding what is done and allow to be
called in other flows. Indeed moving under another parent and making private
are actually quite different flows.
This is a preliminary work to introduce the next fixes that will add changes
necessary to correctly handle private articles update.
Task-2859616
X-original-commit: odoo/odoo@6a3f07e384
Part-of: odoo/odoo#95471
This commit extracts the logic in "action_archive" that detaches children
articles to which the current user does not have access to into a separate
method. See 'KnowledgeArticle._detach_unwritable_descendants()' for details.
This is a preliminary work to introduce the next fixes that will apply that
logic when making an article private as well. There should be no functional
change with this commit.
Task-2859616
X-original-commit: odoo/odoo@94ed05d6e8
Part-of: odoo/odoo#95471
We hide all pos-related config options when no pos is selected to
unblock users from saving the general settings.
closesodoo/odoo#95464
Signed-off-by: Masereel Pierre <pim@odoo.com>
This allows to create a repair.order record without
the need to call the onchanges to set the uom and locations
or to set them manually during the `create` call.
For instance, this makes easier to create repair orders
using XMLRPC when you do not use multiple UOMs or multiple locations.
closesodoo/odoo#95321
Signed-off-by: Raphael Collet <rco@odoo.com>
Sometime Paypal took 3 or 4 days for some payment verification due to
weekend. This raises the retry limit days for 4 days instead of 2 to
solve the issue
closesodoo/odoo#95522
X-original-commit: 5aaaaf8f072b3f8ab66a269bb3dba02714b593ad
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
When replacing an image by a pictogram, the classes of the previous
media are copied to the new icon's `<span>`. This potentially includes
the `w-100` class which prevents the alignment from behaving correctly.
This commit removes the `w-100` class if it exists.
Steps to reproduce:
- Drop a "Media List" block
- Replace first image by pictogram.
- Align icon to the right.
=> Icon was displayed aligned to the left.
task-2829971 (was task-2729177)
closesodoo/odoo#95287
X-original-commit: https://github.com/odoo/odoo/commit/8f71a3c55dcaae738fbb673266aa400b4c4a1fa4
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Since [1] when the media dialog was refactored to owl, some of the
classes clean up when switching across media types were lost.
This commit restores the clean up for each media type - as they were
before [1].
Steps to reproduce:
(Just one example - there are many scenarios)
- Drop a "Text - Image" block.
- Apply a rounded circle on the image.
- Replace the image by a video.
=> The rounded circle effect remains but cannot be removed.
[1]: https://github.com/odoo/odoo/commit/7fd0698cf765a79959566b51e33cb76bff83d344
task-2829971
Part-of: odoo/odoo#95287
Each cookie binds to a domain name, multiple cookies can be set for the
same name if they are for different domain name. In this case, two
`session_id` cookies were set: (1) the first set right on the opener at
`opener.cookies[...] = ...`, (2) the second set upon inside of
`http.Request._save_session` because the session was rotated upon login.
The problem is that the former cookie (the one set on the opener, the
one *not* rotated) was used instead of the second cookie (the one
holding the registered user) in the subsequent queries. There is a long
comment explaining the same problem inside of
`odoo.tests.common.HttpCase.authenticate`, we used the same solution as
they did inside of `authenticate`: we diched the previous opener.
closesodoo/odoo#94773
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Due to an oversight, the "Save my payment details" checkbox was shown on
the inline payment form of SEPA Direct Debit acquirers, which should
never happen because the transaction is *always* tokenized with those.
With this commit, the `_is_tokenization_required` method is slightly
refactored to read the provider from the current `payment.acquirer`
record rather than from the kwargs. This conveniently fixes the issue
and prevents it from happening again elsewhere.
closesodoo/odoo#95519
X-original-commit: ebeebd87ed6d687b96dda3006b81356dfa76d0a0
Related: odoo/enterprise#29237
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Steps to follow:
On a runbot,
- Login as Mitchell Admin
- Set the Administration permission of Marc Demo to Access Rights
- Login as Mark Demo
- Go to the Discuss App
- Edit a message from someone else by clicking on the pencil
-> A Traceback occurs
Cause of the issue:
- The pencil button is only displayed for another user if the logged in user
is admin. This is done by checking if the user is superUser or if he
has the group `base.group_erp_manager`
This is the case here
- When editing the message, the `base.group_system` is checked.
In this case, it is not present.
Solution:
Check the `base.group_erp_manager` in both cases
opw-2892740
closesodoo/odoo#95502
X-original-commit: bd8ed439d1d9342b24926eee332e8c26c6f0cd7c
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
Since the new kanban view [1], the kanban card layout of the channels
had a weird alignment of its inner elements.
This is due to the fact that now the "kanban-box" defined in the arch
is wrapped inside the div.o_kanban_card instead of being merged with it.
[1] 3d6c13ff3fclosesodoo/odoo#95493
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
By trying to avoid concurrency issues while assigning the sequence [1],
we are locking too many operations even when not in the process of
assigning a new number.
* when computing `highest_name`, we don't need to lock as this is mostly
an information on the form that can possibly change anyway while the
form view is open (without any lock anymore)
* when computing the accounting date, we don't need to lock, the only
information we want is the format of the sequence (yearly, monthly, no
reset), which is not likely to change on a same journal.
* when changing the `journal_id`, it is only a helper for encoding, if
there is a concurrency error it will be shown during the post anyways.
Also same argument as for `highest_name`
[1] https://github.com/odoo/odoo/commit/ba6ee0b75d66d6f22a592b1b6a7c5158461bec41closesodoo/odoo#95480
X-original-commit: 809557cdd02fe6581ed573b58158a927aabe0694
Related: odoo/enterprise#29212
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
Improve the filters & actions in booths to ease overview and reporting by:
1. adding and renaming some group by filters
2. adding a price column in the list view of booth event
3. adding a graph and a pivot table view (category/price)
Task-2808962
closesodoo/odoo#95441
Related: odoo/upgrade#3660
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
In a grouped kanban view, drag a record to another column can modify the
record validity. In that case, the group changes should not be validated
and the drag and drop canceled.
closesodoo/odoo#95437
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
From July 2022, External Reverse Charge (for Import/Export)
has to be sent through the SdI to the Agenzia delle entrate.
Exports will be 0% VAT
(Reverse charged to the buyer)
Imports will have a -100%/+100% VAT tax
(We are the buyers, and in charge of VAT)
See specification in the Task description.
Task: https://www.odoo.com/web#id=2823646&model=project.task
opw-2823646
closesodoo/odoo#95372
X-original-commit: 2eb8b2f5bcef8ddfbc3ad83219368575174918d0
Related: odoo/enterprise#29138
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
Migrate Bootstrap to version 5.1.3
some highlights of BS5 changes:
- Browser support: Internet Explorer is definitely gone (Goodbye! We won't miss you) ; not a huge change on the backend as we didn't supported it anymore anyway.
- Bootstrap's Javascript components doesn't use jQuery anymore! A compatibility layer is present but with some quirks, so avoid to use it if possible ; less jQuery is less overhead!
- The color contrast system in BS5 relies directly on WCAG 2.0 contrast algorithm (https://www.w3.org/TR/WCAG20-TECHS/G18.html). Some visual elements (like texts/buttons/...) may have a slightly different contrast than before.
- Background color classes ('bg-') only set the background color and don't change the foreground (aka. text) color anymore. We backported the '.text-bg-' from Bootstrap 5.2 to restore the previous behavior ; or use separate background ('.bg-') and foreground ('.text-') depending on your usecase.
- Media Breakpoint's usage has changed
- More and more CSS utility classes are introduced: use them in your templates instead of adding more custom CSS rules.
- Bootstrap still provides a quite powerful grid system, but please use it as intended by the framework (I'm looking at you '.col' without its parent '.row'). Also while keeping the same API, it was internally changed ; the main issue that you can encounter is that columns no longer apply 'position: relative', which could be solved by adding the '.position-relative' class when needed.
- BS5 doesn't allow to use multiple components on the same element (ie. adding a tooltip on a dropdown). It generates this kind of error: "Bootstrap doesn't allow more than one instance per element. Bound instance: bs.tooltip" (cf. https://github.com/twbs/bootstrap/issues/33940#issuecomment-838454777).
- Badge usage has changed a bit: '.badge' still exist but is now extended using utility classes (text and background colors, border-radius for pills) instead of specific '.badge-*' classes.
- '.input-group-{append,prepend}' are gone! You can now just add buttons and '.input-group-text' as direct children of the '.input-group'.
- Popover/alert components' close button use the new class '.btn-close'.
- Dropdown: the '.show' class is not added anymore to the parent group of dropdown ; some CSS selectors may still need some love.
- All data attributes of BS5 are now prefixed by 'bs-' (ie. 'data-toggle' is now 'data-bs-toggle').
Bootstrap documentation
https://getbootstrap.com/docs/5.1/migration
Task ID: 2766483
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
closesodoo/odoo#95450
Related: odoo/design-themes#580
Related: odoo/enterprise#29195
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
> Media query mixins parameters have changed for a more logical approach
> media-breakpoint-down() uses the breakpoint itself instead of the next
> breakpoint (e.g., media-breakpoint-down(lg) instead of
> media-breakpoint-down(md) targets viewports smaller than lg).
> Similarly, the second parameter in media-breakpoint-between() also
> uses the breakpoint itself instead of the next breakpoint (e.g.,
> media-between(sm, lg) instead of media-breakpoint-between(sm, md)
> targets viewports between sm and lg).
https://getbootstrap.com/docs/5.1/migration/#sass
Task ID: 2766483
Part-of: odoo/odoo#95450
This allows media queries in width/height classes.
This behavior was supported in BS4 but has been deleted in BS5.
e.g. w-md-75 (in Leaderboard eLearning)
Task ID: 2766483
Part-of: odoo/odoo#95450
To avoid redundancy and mess rules with rounded classes we simplify
all rules in one location (before was in web and web_enterprise)
Also, we don't set the $rounded variables to 0, so we can use it in
the Bootstrap utilities API. Instead, we have set to 0 the specific
variables.
Task ID: 2766483
Part-of: odoo/odoo#95450
It seems louche to use media-breakpoint-between(lg, xl,
$o-extra-grid-breakpoints) as in $o-extra-grid-breakpoints there is an
XXL value.
In short, in XXL mode the padding fallback to the value outside the
breakpoint (twice smaller).
e.g. result in CSS
```css
.o_form_view .o_form_sheet_bg > .o_form_sheet {
padding-right: 16px;
padding-left: 16px;
}
@media (min-width: 992px) and (max-width: 1533.98px) {
.o_form_view .o_form_sheet_bg > .o_form_sheet {
padding-right: 32px;
}
}
@media (min-width: 992px) and (max-width: 1533.98px) {
.o_form_view .o_form_sheet_bg > .o_form_sheet {
padding-left: 32px;
}
}
```
Part-of: odoo/odoo#95450
Due to the removal of btn-block we need to change the display to grid
> Dropped .btn-block for utilities. Instead of using .btn-block on the
> .btn, wrap your buttons with .d-grid and a .gap-* utility to space
> them as needed
https://getbootstrap.com/docs/5.1/migration/#buttons
Task ID: 2766483
Part-of: odoo/odoo#95450
The conversion of html to inline-styled html compatible with e-mail
clients failed to take into account styles that included `var()` and/or
`calc()`. Those didn't occur with Bootstrap 4 but are very common with
Bootstrap 5.
This allow that conversion by using `getComputedStyle` in those cases.
Task ID: 2766483
Part-of: odoo/odoo#95450
- removes handle for tab as already done in BS5
- remove the `border` image attribute to restore the BS4 behaviour
In the FieldBinaryImage and FieldBinarySignature widget there is the
`border` attribute to force the image to have a border.
But in the actual environment it's useless as Bootstrap 4 remove de
border of all image by default, so the rules is useless.
But in BS5 this rules was removed so in some place some image as the
border set.
In BS4:
```css
img {
border-style: none;
}
```
e.g. where there is the case:
Helpdesk > Reporting > Customer Ratings (Kanban card)
Task ID: 2766483
Part-of: odoo/odoo#95450
- new prefix `bs-` for the root CSS variables
As some website snippet relay on these values we need to restore the old
behaviour by setting this prefix to an empty string.
- restore negative margins disabled in BS5 by default
- restore BS4 behaviour for setting element content
Fix some cases when we want to render more than one node on the root
level.
In BS4 the jQuery was using all node but in the jQuery compatibility
layer in BS5 it takes only the first node if the jQuery Element is used
in the function. This hack try to restore the old behaviour wrapping all
element in a DIV element (to be single root node).
PS: this can break some querySelector and some CSS selector if they are
too fragile.
e.g. of element that break before this hack:
Popover content for PaymentPopOver XML in ShowPaymentLineWidget
- restore old value from BS4 and adapt to new value
$table-cell-padding -> $table-cell-padding-x
$table-cell-padding -> $table-cell-padding-y
$table-cell-padding-sm -> $table-cell-padding-x-sm
$table-cell-padding-sm -> $table-cell-padding-y-sm
- restore BS4 smooth-scroll behaviour
- restore `text-X` from BS4 that use text-emphasis-variant
In BS5, to generate the text utilities `test-X` its use BS5 utilities
(See $utilities SCSS variables). To restore the old behaviour we replace
with the custom `text-emphasis-variant` mixin.
See odoo/odoo@e111cfd35e
- restore border and background of table
In `_reboot.scss`, BS5 add `border-style` to all element of a table.
In some case we customize the table with CSS rules (e.g. `listview`),
these rules set a size of border. The mix of all rules made that the
border of the `td` in `tfoot` are visible and make a black line.
- reset block quote Y margin to 0
BS5 add a spacer and we reset that by puttin margin-y 0
- In BS5, border color is linked to the text color in it. We doesn't
want that and we restore the same behavior as un BS4 by putting
border-color in grey.
- restore HR style like in BS4
Since in BS5, the height matter we remove the padding and added into the
margin.
Also, we restore the color of BS4 for the HR tag
> <hr> elements now use height instead of border to better support the
> size attribute. This also enables use of padding utilities to create
> thicker dividers (e.g., <hr class="py-1">).
https://getbootstrap.com/docs/5.1/migration/#content-reboot-etc
- restore old value for grid gutter to avoid calc error
In BS5 `$grid-gutter-width` is set in rem and in BS4 it was in px.
So SCSS compiler generates error when it tries to calc rem and px.
- restore badge, navbar paddings like in BS4
- restore link decoration in frontend (Portal) whiteout website
Task ID: 2766483
Part-of: odoo/odoo#95450
> Data attributes for all JavaScript plugins are now namespaced to help
> distinguish Bootstrap functionality from third parties and your own code.
> For example, we use data-bs-toggle instead of data-toggle.
https://getbootstrap.com/docs/5.1/migration/#javascript
Task ID: 2766483
Part-of: odoo/odoo#95450
TempusDominus is using sr-only but in Bootstrap 5 it was renamed in
visually-hidden. So we "forward port" it to avoid patching the lib.
Task ID: 2766483
Part-of: odoo/odoo#95450