Before this commit, a test in the "objects" test suite failed because
the 2 dates generated to verify equality could potentially be created
in a different millisecond, which would make the test fail.
A first fix simply assumed that patching the date would suffice, but
this did not solve the issue since the time advances normally even for
patched dates.
This fix ensures that the dates have exactly the same values (and
removes the patch which was not necessary anyway).
Runbot task 25596
closesodoo/odoo#139953
X-original-commit: b02d7fe6c4eaee09066cf58d0e9bad91e3a3234d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
This commit adapts message tests to check pointer style on message author name
and author image.
closesodoo/odoo#139951
X-original-commit: 134b7cc1143faf9275683ae12c2b121ab03aed7e
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this commit, when the command dropdown was open by clicking
on avatar/chat window header name, the clickable area was the same
as the rest of chat window header.
As a result, the dropdown was shown without some UI to help see the
toggler that is responsible from this dropdown.
This commit highlights the toggler of dropdown when it is open, so
that it looks nicer when the dropdown is open as we clearly see the
toggler of this dropdown.
closesodoo/odoo#139920
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
In this commit, we are changing the way prices of the components of a combo
product is calculated. The idea is that a combo product's price should behave
similarly as normal products.
This results to a simpler logic in calculating the prices of the components. In
order to get the fraction that will be used to scale the prices of the component
products, the lst_price of the combo product is divided by the total of the
pos.combo.base_price. This ratio is then multiplied to each pos.combo.base_price
to get the pro-rated unit price of each component. We then proceed to normal
calculation of taxes based on the tax configuration of the selected products.
Furthermore, we are now taking into account the extra prices from the selected
attributes. If the orderline is a component of a combo (menu) product, the extra
prices of the attributes are added on top of the prorated unit price, just like
we do with the `pos.combo.line`'s `combo_price`.
E.g.:
```
product.product.1 -> lst_price = 10
A1 -> price_extra = 5
A3 -> price_extra = 3
pos.order.line.1, product.product.1, attributes=[A1,A3]
-> price_unit = 10 + 5 + 3 = 18
```
One more thing, there is a regression in the combo configurator popup where the
total price of the selection is removed. It should be restored in the future
with calculation that properly follows the description above.
closesodoo/odoo#139915
Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
When changing quantity of a menu order line (from combo product), multiple
(number of components + 1) rpcs are made. It makes sense that when incrementing
a menu order line, the components are also incremented. We, however, make the
rpc whenever one of the line's quantity is incremented. This commit extracts the
incrementer, and we only make the rpc when the incrementer method is done
incrementing all the components.
Part-of: odoo/odoo#139915
`quantity` on sm is depended on `quantity` on sml. When create new
sml, `quantity` of sm will always be 0. To fix it, we use origin sm in
the compute function to get correct value.
closesodoo/odoo#139913
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
When a user browses a website, he can visit two types of pages:
- Static page: the page is a website.page record.
- Dynamic / controller page: the page isn't a website.page (e.g. /shop).
Some options are only available on static pages, like the option to
make the header over the content. Since [this other commit], when a user
change the header template, the editor activate/deactivate an extra
options in addition to the header template change. The problem is that
this extra option may be available only on static pages, and the option
to change the header template is available on all pages.
Before this commit, if the extra option is not available, we stop the
process, the page was not reloaded and the user didn't see the new
header template. Now, we just ignore the extra option without stopping
the process, so the page is reloaded and the user see the new header.
Steps to reproduce the issue fixed by this commit:
- Go to /shop
- Edit
- Change the header template
=> The header template is not changed.
[this other commit]: https://github.com/odoo/odoo/commit/e7dcfc19298948b76caa4c214724c93854cf5f4c
task-3572277
closesodoo/odoo#139896
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
Before this commit, the `recover` parameter is used when parsing the xml
files. The issue with this, is that it will allow and parse broken XML
files, and the error messages in JS will not be related to the issue on
the broken XML.
Now, the parser is stricter, and the broken template will be replaced
with an error template with a compressive error message of the parsing
error.
closesodoo/odoo#139818
Task-id: 3420400
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Since the move_line_nosuggest_ids field has been removed, there's no alternative to show on
the detailed operations of incoming pickings. The only alternative is to show move_line_ids_without_package
at all times.
closesodoo/odoo#139907
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
Before this commit, when a message is a reply to another message,
the whole row of the message reply-to was clickable to highlight the
reply-to message.
This is ok when the click happens on the actual reply-to message
above the message, but when the content of the reply-to message
is short, the click area extends to more than the "clickable" cursor
show, so that click on thread view hightlights the reply-to message
when it shouldn't.
The `cursor-pointer` style was already correctly shown only the the
actual part of the reply-to message. But the `t-on-click` was more
generous and considered the whole row in the thread view.
This commit fixes the issue by matching the `t-on-click` with the
intentional clickable area, matching the `cursor-pointer` that was
correct.
closesodoo/odoo#139906
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this revision, an employee could create a discuss channel
with whatever setup he wants.
Which is fine. The critical part is for an employee to not be able
to join an existing restricted channel.
But creating a channel is not a problem.
However, he would be able to create a channel for which
he doesn't have access, meaning he creates the channel
and then no longer see it, which is not user-friendly.
closesodoo/odoo#139903
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this commit, when a message is of type email, the button to
toggle between adjusted content style with webclient theme and the
original email style was labelled "Show Original Email" and
"Don't show original Email".
This label is confusing, as it gives the impression that this button
opens a new screen or removes a UI element. This button only alters
the visual of the message, that is the style, so the label should
be better worded to tell that.
This commit rename the label to "Show Original/Custom Format", so that
it's clearer what this button actually does.
closesodoo/odoo#139901
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
change the field name 'parent_id' to 'related_id' for the test model, since
'parent_id' is an Odoo reserved field name
add translation test for `mapped` since it uses different code from the normal
read api.
closesodoo/odoo#139819
Signed-off-by: Raphael Collet <rco@odoo.com>
Currently both incoming and outgoing emails are using the same 'email'
message_type. However both flows are not linked in any way.
Purpose of 'message_type' is to distinguish who generated the message.
In this case incoming emails are generated by the mailgateway while outgoing
emails are generated by mailins e.g. using the composer in mailing mode.
We now distinguish outgoing emails from incoming emails by using a specific
type for outgoing emails. Addons are updated accordingly.
Default 'message_type' value when removing sms/snailmail/whatsapp is now
'comment' instead of 'email', as default value of messages should be
comment as discuss is the main source of messages.
Task-3285720
closesodoo/odoo#139814
Related: odoo/enterprise#49597
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit contains the following changes:
- Mobile view for devices with a width under 'SIZE.MD'
- Align mobile view bottom buttons
- Reduce size of category bar when images
closesodoo/odoo#139686
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
tl;dr : it may be smaller in the SCSS file, but definitely not in the
generated CSS file. Do'nt repeat want can be set once.
These changes result in roughly 130KB gain in the backend bundle.
Follow-up of https://github.com/odoo/odoo/pull/138670
task-3546717
closesodoo/odoo#139683
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Co-authored-by: stefanorigano (SRI) <sri@odoo.com>
Main changes:
Consolidate the relation between a sale order line and the repair
order it has created.
Before:
When a product trigger the creation of a repair order from a
sale order line, the 'Repair Request' field of the repair order
is defined by the product name.
After:
When a product trigger the creation of a repair order from a
sale order line, set the product and its quantity on the created
repair order if the product is of type storable or consumable.
Moreover, define the 'Repair Request' field of the repair order
by the description of the sale line rather than by the product
name.
closesodoo/odoo#139177
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Since the redesign of the default theme [1], `website_forum` needed to
be fine-tuned in order to fit with the other website modules.
This commit adapts the sidebar to maintain consistency with the other
website modules.
[1]: https://github.com/odoo/odoo/pull/120302
task-3559011
Part of task-3097005
closesodoo/odoo#139003
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Currently creating a record with 'is_published' being False (aka not published)
crashes when people can't publish. However 'is_published' being False is the
default value, and create should work in both cases.
It now correctly checks that published records could effectively be published.
This allows to remove a small workaround done in eLearning.
See odoo/odoo@4086f344d8 for ref.
Only failing use case would be having
def _default_is_published(self):
return True
def _compute_can_publish(self):
for record in self:
record.can_publish = self.env.user.has_group('something')
But this would not be a really valid use case: not being able to publish
but having default publish to True makes no sense: what matters is publishing
records as it gives more visibility to records, not the flag change itself.
Followup of odoo/odoo#70291
Task-3299702
closesodoo/odoo#137900
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Previously proposed formating was trying to normalize extra in one part
of the path. This means that no extra needed a placeholder.
The implementation was meant to be more generic and extendible since a
part of the logic has to be in website.
A suggestion was made to make it more restricted but explicite by
keeping the url simple in web/controllers/binary.py but adding a
controller in website to add this extra part.
The base extra direction is now in the extension, as the min part.
Initial urls:
/web/assets/{unique}/[{website_id}/][rtl/]{bundle_name}[.min].{extension}
New urls:
/web/assets/[{website_id}]/{unique}/{bundle_name}[.rtl][.min].{extension}
Managed by two routes:
/web/assets/<string:unique>/<string:filename>
/web/assets/<int:website_id>/<string:unique>/<string:filename>
Where filename is in the format {bundle_name}[.rtl][.min].{extension}
Multiple possibilities where proposed
- /web/assets/website/<int:website_id>/<string:unique>/<string:filename>
More explicit but prefixing by /website was considered
- /website/assets/<int:website_id>/<string:unique>/<string:filename>
This one is a litle painfull to match similar attachement, where
website is ignored.
- /website/<int:website_id>/assets/<string:unique>/<string:filename>
Almost accepted but subjective, and anyway two previous solution breaks
the cdn mecanism and would need a migration
- /web/assets/<int:website_id>/<string:unique>/<string:filename>
Almost accepted but subjective, and anyway two previous solution breaks
the cdn mecanism and would need a migration
This last solution was not ideal to match without unique
/web/assets/%/<string:filename> can match both
/web/assets/123456/<string:filename>
and
/web/assets/1/123456/<string:filename>
Anyway, matching without unique shouldn't be supported for al (even if
it is kind of supported with any right now) but it will work by changing
unique wildcard to a more specific one (_ * 7)
closesodoo/odoo#131353
Related: odoo/enterprise#47313
Related: odoo/design-themes#730
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
The generation inside the rendering has some drawbacks:
- `commit_assetsbundle` is needed for reports rendering because the
template rendering may generate some assets that will be accessed by
another transaction before the transaction is committed. But this
solution is not ideal since the transaction is committed in the middle
of the request
- when the first rendered page is a 404, the assets are not committed
and the page is broken.
- when starting, deleting an attachment can create a concurrent update
error and the request is retried. This will occur once per attachment
and for all worker trying to access the same resource. The whole
transaction is rollbacked, even the previously created assets bundle.
- The cold page load is a slower since there is more work to do.
- Implementing a readonly request is difficult because it could be
transformed to read write and re-executed if the assets bundle does not
exist.
Generating assets when needed solves those issues. The concurrency
when deleting an assets could still occur but only once per bundle, and
in a smaller transaction. This could be solved with a lock now that we
have more control on the transaction. The commit_assetsbundle can be
removed and 404 page should have a correct layout. The cold page load
could be a little faster because the assets bundle can be generated in
parallel requests instead of sequentially when rendering the page.
Part-of: odoo/odoo#131353
This is a small improvement to reduce the dependency between attachment
and link generation. This will help to move the generation in the
web assets route in next commit.
Part-of: odoo/odoo#131353
The current solution returns two node, one for the css itself, another
for the script managing the error. This means that we must know if we
have a css error when generating the assets links, when rendering a
t-call-assets.
The proposed solution will solve this issue by managing the error
in the css file itself. A slight change will also save the error in the
attachment instead of choosing the previous one, meaning that the
error will be saved and the bundle won't be recomputed anymore.
This solution also removes the only case when a t-call-assets can return
content instead of a link, this will be cleaned in the next commit.
As a slight change, a warning will alway be displayed on the bottom of
the page, to manage the case where the javascript managing the error is
not in the page.
Part-of: odoo/odoo#131353
The main motivation is to be able to generate assets bundle outside
the t-call-assets call.
The need of an id in the url makes it mandatory to have an attachment
when adding the url in the page. Without this restriction, we can guess
the url without generating the assets.
This can also have other useful side effect:
There are corner case when a worked could have an invalid url in
cache because, if the transaction is rollbacked or if another request
generates the same attachment at the same time. This should be
partially solved by removing the id: The url remains valid even if the
attachment does not exist.
Note that the extra part of the url was made explicit, always there and
taking one / to remove complexity and ambiguity.
Note that an additional query appeared in .test_50_perf_sql_web_assets
because of the search, this but two of them were in _find_record. One of
them was an `exist`, not making much sense since we are not getting the
id from the attachment url anymore but from a search, and the other one
was prefetch of the "public field" since the call to _find_record does
not go in other cases (xmlid, website published, access token, ....). A
attachment of a asset is always public, and this part of the security
was moved to the search domain. The final result is one less query:
- one query to search
- one query to read the fields (_get_stream_from) (the prefetch could
actually be set to avoid prefetching everything)
Part-of: odoo/odoo#131353
If upgrading a database across an addition of a new field to
ir.module.module (which is uncommon but does happen), the field
prefetching would try to load the field before the database schema had
been upgraded, leading to a loading error.
Since we *only* want / need the module's name, we can `search_fetch`
to preload just the field we need, and avoid ancillary
prefetching. It's a bit of an unnecessary optimisation compared to
just turning prefetching off, but it's also simpler (shorter) here
so...
closesodoo/odoo#140010
X-original-commit: c0102ca5dc3507c39f5ae6406fd962419fb09c6e
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
When ReferenceField uses an M2O field. The model is not updated along
with the props when the model field is updated.
Because of this, the onWillUpdateProps hook will keep trying to update
its value. This results in an infinite render loop.
task-3248500
closesodoo/odoo#139954
X-original-commit: f8f6aaa5e32967d6c7cd888fbe574acdc6f79dc6
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Renaud Thiry (reth) <reth@odoo.com>
Since [1], guest is added to the channel immediately instead of
waiting for the guest name to be set. Since the guest is not in
the context when posting je "join" message, the author of the
message is the public user instead of the guest. This results in
an incorrect message ("public user joined the channel") since the
frontend relies on the author to set the name. This commit fixes
the issue by adding the guest to the context.
Steps to reproduce:
- Go to a channel
- Copy the invitation link
- Join the channel with this link
- The message is incorrect
[1]: https://github.com/odoo/odoo/pull/138330closesodoo/odoo#139892
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
Issue:
------
Using the website editor, we can add a content block
to the ribbon (using drag and drop on the product image)
on the shop page of ecommerce.
Solution:
---------
Make the ribbon non-editable so that it will not have the `o_editable`
class added via the `editableElements` function of `WysiwygAdapterComponent`.
opw-3515908
closesodoo/odoo#139993
X-original-commit: 712edead528c6db8b97a8957bcf7bb3c8005d14a
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
When upgrading mail across the addition of the linked record's company
and mail alias, if the `composer.model` is not part of a module that's
already loaded (which is very likely) the compute will blow up when it
tries to look up the model in the env.
Add that check to the condition.
closesodoo/odoo#139845
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
SO/PO accrued entries date should be the last day of the previous month since it necessarily concern
In the test, move the date as a user would input it in a form
closesodoo/odoo#111535
Signed-off-by: Laurent Smet <las@odoo.com>
* clean and improve docstrings in orm
* fix typos found with codespell
* rely on the Environment class docstring instead of doc content (and
therefore move part of the doc inside the class docstring)
closesodoo/odoo#102969
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
For a better handling on onchanges.
By default, `move_type` is readonly and is therefore
not sent to the web client during an onchange.
During onchanges, `new` is used to pass values into records.
The `move_type` of the invoice was passed to that `new`
thanks to an `default_move_type` passed in the window action.
But, if the view was used outside of this action,
without `default_move_type`
the `move_type` wasn't correctly set and the invoice/move
type wasn't correctly passed
closesodoo/odoo#41723
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
* clean and improve docstrings in orm
* fix typos found with codespell
* rely on the Environment class docstring instead of doc content (and
therefore move part of the doc inside the class docstring)
closesodoo/odoo#102969
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Before this commit, the `visitor_leave_session` route was called
when a user logged in: the session of the visitor is outdated and
will never be activated again. This causes an error with portal
users since channel members are not based on the guest but on the
current user when available. This commit fixes the issue by not
calling the route: the session will be garbage collected as all
the others.
Steps to reproduce the issue:
- Go to website livechat (public user)
- Start a chat and send a message
- Log in as portal user
- An error occurs
closesodoo/odoo#139631
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Unwittingly broken by the removal of `__implements__` in
a6d601dc4e, these lints don't run
correctly with the old pylint, allowing new errors to creep in since.
closesodoo/odoo#139605
X-original-commit: 99cec73f585c8759142a707b06934d9c23aa5478
Related: odoo/enterprise#49473
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Since the new RelationalModel (PR 114024), when you click Save and New in X2ManyFieldDialog,
the new record has its sequence correctly incremented by 1 compared with the previous record.
So the patch on X2ManyFieldDialog in im_livechat_chatbot_steps_one2many.js is
no longer necessary. So we're going to remove it.
closesodoo/odoo#139551
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
When the user clicks the checkbox to add a warehouse, the field next
to it is invisible, making it difficult to notice.
This commit highlights the field and adds a placeholder to make it
obvious.
task-3486780
closesodoo/odoo#139528
X-original-commit: a60c94203072fd2343f6ca3a33a2cc1813757bea
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
So that `Message.insert()` in JS becomes trivial, as it doesn't have
to infer the author of message to current user.
closesodoo/odoo#139501
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>