Commit Graph
166955 Commits
Author SHA1 Message Date
Julien Mougenot 43640ceb1c [FIX] web: use same date in object test
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

closes odoo/odoo#139953

X-original-commit: b02d7fe6c4eaee09066cf58d0e9bad91e3a3234d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-10-27 13:02:22 +00:00
Rahul Prajapati 3b1d10f0f1 [FIX] mail: message author name and image pointer style tests
This commit adapts message tests to check pointer style on message author name
and author image.

closes odoo/odoo#139951

X-original-commit: 134b7cc1143faf9275683ae12c2b121ab03aed7e
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-27 13:02:22 +00:00
Alexandre Kühn af3d6bf4a6 [IMP] mail: chat window dropdown show active background
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.

closes odoo/odoo#139920

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-27 13:02:18 +00:00
Joseph Caburnay 8bbe9c8be3 [FIX] point_of_sale,pos_self_order: correct component prices
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.

closes odoo/odoo#139915

Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
2023-10-27 13:02:17 +00:00
Joseph Caburnay 7510441cc3 [FIX] pos_self_order: avoid unnecessary rpc when changing quantity
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
2023-10-27 13:02:17 +00:00
Joseph Caburnay 29757d1079 [FIX] pos_self_order: product price when fiscal mapping involves tax incl
This commit introduces a new method in product.product model that can be used to
compute the correct product's unit price when fiscal mapping with price-included
taxes are involved. It is patterned after `computePriceAfterFp`[^1] from the
pos_store.js.

In this commit, the method is used to correctly show the products' prices when
making a self order.

[^1]: https://github.com/odoo/odoo/blob/b726842e472b5ad773f42a19db7b1bd8a9506786/addons/point_of_sale/static/src/app/store/pos_store.js#L978

Part-of: odoo/odoo#139915
2023-10-27 13:02:17 +00:00
yhu-odoo dbfbc3a185 [FIX] stock: use quantity from new move_id
`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.

closes odoo/odoo#139913

Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2023-10-27 13:02:15 +00:00
Zelong Lin 45ac37425b [FIX] mail: broken AutoresizeInput style
hovering and focusing style is lost.

closes odoo/odoo#139911

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-27 13:02:14 +00:00
Guillaume-gdi 895414bf67 [FIX] web_editor: reload iframe when header change on controller pages
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

closes odoo/odoo#139896

Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
2023-10-27 13:02:13 +00:00
Jorge Pinna Puissant 49548e9a8c [IMP] base, test_assetsbundle: avoid parsing broken XML
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.

closes odoo/odoo#139818

Task-id: 3420400
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-10-27 13:02:12 +00:00
Maryam Kia 9c8d39d1a8 [IMP] account, helpdesk,...: same title for all portal chatters
By this commit, all portal chatters have a same title as `Communication history`

closes odoo/odoo#139735

Related: odoo/enterprise#49566
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-27 13:02:10 +00:00
snd 3554a5c826 [FIX] stock: correctly show detailed operations on incoming pickings
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.

closes odoo/odoo#139907

Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2023-10-27 11:35:09 +00:00
Alexandre Kühn 47be118fb1 [FIX] mail: message reply-to click area should match cursor feedback
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.

closes odoo/odoo#139906

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-27 11:35:08 +00:00
Denis Ledoux c75147bb1e [IMP] mail: restrict create for internal same as write & read
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.

closes odoo/odoo#139903

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-27 11:35:07 +00:00
Alexandre Kühn b88ecba36f [IMP] mail: improve label of button to toggle style of email message
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.

closes odoo/odoo#139901

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-27 11:35:06 +00:00
Chong Wang (cwg) f75fc543bd [IMP] base: add translation test for mapped
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.

closes odoo/odoo#139819

Signed-off-by: Raphael Collet <rco@odoo.com>
2023-10-27 11:35:03 +00:00
Chong Wang (cwg) 2d08f97c07 [IMP] core: support delay translation
Jsonb data structure of model_terms translated fields' columns
'{
	"en_US": "<div>Apple</div>"
	"fr_FR": "<div>Pomme</div><div>Banane</div>"
	"_fr_FR": "<div>Pomme</div>"
}'::jsonb

"column" IS NULL OR "column"->>'en_US' IS NOT NULL

"column"->>'lang'
1. stores last confirmed value
2. logically fallbacks to
    COALESCE(
        "column"->>'lang',
        "column"->>'en_US'
    )

"column"->>'_lang'
1. stores translations and the last written html/xml structure
2. shares the same html/xml structure with other "column"->>'_lang'
3. logically fallbacks to
    COALESCE(
        "column"->>'_lang',
        "column"->>'lang',
        "column"->>'_en_US',
        "column"->>'en_US'
    )

Context:
1. `delay_translations`(new) only write values to _langs while keeping
translations for langs when the written value has at least one translatable term
2. `check_translations`(new) read _langs values to create translation mapping
for the translation dialog
3. `edit_translations` read values whose translatable terms are wrapped by
`<span></span>` with term information for the TRANSLATE mode of website

Potential issue
since the record value of a model terms translated field is logical content
dependent (check_translations, edit_translations), all computed field computed
from any model terms translated field should also be marked.
@api.depends_context('lang', 'edit_translations', 'check_translations')

Data flow for column value, cache value and record value
(make sure the window is wide enough to see the graph)

                             +- - - - - - - - - - - - - - - - - - - - - - - - - - - -+
                             ' Record(str):                                          '
                             '                                                       '
                             ' +---------------------------------------------------+ '               +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
                             ' | "<div><span data-oe-model='model'                 | '               {            read fr_FR             {
                             ' | data-oe-id='id' ...>French</span></div>"          | ' <------------ } context.get('edit_translations')  } <+
                             ' +---------------------------------------------------+ '               +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+  |
                             ' +---------------------------------------------------+ '               +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+  |
                             ' | "<div>French</div>"                               | '               {            read fr_FR             {  |
                             ' |                                                   | ' <------------ } context.get('check_translations') } <+
                             ' +---------------------------------------------------+ '               +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+  |
+~~~~~~~~~~~~+               ' +---------------------------------------------------+ '                                                      |
{ read fr_FR { ------------> ' | "<a>French</a>"                                   | '                                                      |
+~~~~~~~~~~~~+               ' +---------------------------------------------------+ '                                                      |
  ^                          '                                                       '                                                      |
  |                          +- - - - - - - - - - - - - - - - - - - - - - - - - - - -+                                                      |
  |                                                                                                                                         |
  |                                                                                                                                         |
  |                                                                                                                                         |
  |                          +- - - - - - - - - - - - - - - - - - - - - - - - - - - -+                                                      |
  |                          ' Cache(dict):                                          '                                                      |
  |                          '                                                       '                                                      |
  |                          ' +---------------------------------------------------+ '                                                      |
  |                          ' |                                                   | ' -----------------------------------------------------+
  |                          ' | "_fr_FR": "<div>French</div>"                     | '
  |                          ' |                                                   | ' <----------------------------------------------------+
  |                          ' +---------------------------------------------------+ '                                                      |
  |                          ' +---------------------------------------------------+ '               +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
  +------------------------- ' |                                                   | '               {              fetch fr_FR               {
                             ' | "fr_FR": "<a>French</a>"                          | '               }    context.get('edit_translations')    }
  +------------------------> ' |                                                   | '               {  or context.get('check_translations')  {
  |                          ' +---------------------------------------------------+ '               +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
+~~~~~~~~~~~~~~~~~+          '                                                       '                                                      ^
{   fetch fr_FR   {          +- - - - - - - - - - - - - - - - - - - - - - - - - - - -+                              COALESCE(               |
+~~~~~~~~~~~~~~~~~+                                                                                                     "c"->>'_fr_FR',     |
  ^                                                                                                                     "c"->>'fr_FR',      |
  | COALESCE(                                                                                                           "c"->>'_en_US',     |
  |     "c"->>'fr_FR',       +- - - - - - - - - - - - - - - - - - - - - - - - - - - -+                                  "c"->>'en_US'       |
  |     "c"->>'en_US'        ' Database(jsonb):                                      '                              )                       |
  | )                        '                                                       '                                                      |
  |                          ' +---------------------------------------------------+ '                                                      |
  |                          ' | "_fr_FR": "<div>French</div>"                     | ' -----------------------------------------------------+
  |                          ' +---------------------------------------------------+ '                                                      |
  |                          ' +---------------------------------------------------+ '                                                      |
  +------------------------- ' | "fr_FR": "<a>French</a>"                          | ' -----------------------------------------------------+
  |                          ' +---------------------------------------------------+ '                                                      |
  |                          ' +---------------------------------------------------+ '                                                      |
  |                          ' | "_en_US": "<div>English</div>"                    | ' -----------------------------------------------------+
  |                          ' +---------------------------------------------------+ '                                                      |
  |                          ' +---------------------------------------------------+ '                                                      |
  +------------------------- ' | "en_US": "<div>English1</div><div>English2</div>" | ' -----------------------------------------------------+
                             ' +---------------------------------------------------+ '
                             '                                                       '
                             +- - - - - - - - - - - - - - - - - - - - - - - - - - - -+

Task: 3043340
Part-of: odoo/odoo#139819
2023-10-27 11:35:03 +00:00
Thibault Delavallée 43c6b5e7a8 [IMP] mail: add message_type for outgoing emails
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

closes odoo/odoo#139814

Related: odoo/enterprise#49597
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-10-27 11:35:01 +00:00
Loukas Wets (lowe) 3c632bbac3 [IMP] point_of_sale: misc ui changes product_screen
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

closes odoo/odoo#139686

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-10-27 11:35:00 +00:00
Pierre Paridansandstefanorigano 75b3282246 [FIX] web,calendar: don't set static CSS properties in loop
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

closes odoo/odoo#139683

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Co-authored-by: stefanorigano (SRI) <sri@odoo.com>
2023-10-27 11:35:00 +00:00
Demesmaeker 304aea6efd [CLN] payment_adyen: nitpickings line length
Cleanup of commit d65e03a867d0adb3bc23f9503191cc13bf992e4a

closes odoo/odoo#139618

X-original-commit: 4eee2d4aa8adfeb81ce668c196b6fc7efc25bf01
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-10-27 11:34:59 +00:00
Mathias Mathy (MAMA) 41c09796cd [IMP] repair: consolidate creation from sale order
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.

closes odoo/odoo#139177

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-10-27 11:34:58 +00:00
Brieuc-brd 9701d15596 [IMP] website_forum: enhance layout consistency
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

closes odoo/odoo#139003

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-10-27 11:34:56 +00:00
Thibault Delavallée c19eba99d7 [FIX] website(_slides): correctly check can_publish status at create
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

closes odoo/odoo#137900

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-10-27 11:34:55 +00:00
Xavier-Do bf3b6b0b8b [IMP] base, web, *: change url formating
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)

closes odoo/odoo#131353

Related: odoo/enterprise#47313
Related: odoo/design-themes#730
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-10-27 11:34:52 +00:00
Xavier-Do 94a47f25ce [IMP] web, website: add validation for /web/assets
Increase the validation of assets url especially when parsing extra to
avoid aving to much possible url for the same asset.

Part-of: odoo/odoo#131353
2023-10-27 11:34:52 +00:00
Xavier-Do 64bbef5bc1 [IMP] base, web: generate assets outside rendering
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
2023-10-27 11:34:52 +00:00
Xavier-Do 000842bd3d [REF] base: refactor link generations
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
2023-10-27 11:34:52 +00:00
Xavier-Do a919476e62 [FIX] base, web: cleanup following previous commit
Removes the support for an asset bundle node returning content instead
of an url, this was only usefull for css error.

Part-of: odoo/odoo#131353
2023-10-27 11:34:52 +00:00
Xavier-Do 5e920db3ee [IMP] base: improve css compilation error reporting
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
2023-10-27 11:34:52 +00:00
Xavier-Do b0a4451c19 [IMP] assetsbundle: cleanup api and dead code
Extrac a method to generate the "language extra part", redundant in
this file.

Also removes some dead code about html_url

Part-of: odoo/odoo#131353
2023-10-27 11:34:52 +00:00
Xavier-Do d988030134 [REF] base: don't add id to assets bundle url
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
2023-10-27 11:34:52 +00:00
Xavier Morel 781dcdf396 [IMP] core: remove prefetch on Module during loading
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...

closes odoo/odoo#140010

X-original-commit: c0102ca5dc3507c39f5ae6406fd962419fb09c6e
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-10-27 08:36:17 +00:00
Louis (wil) 3f6f949fa5 [I18N] export sources
closes odoo/odoo#140002

Related: odoo/enterprise#49687
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-10-27 08:36:16 +00:00
Renaud Thiry 044cd8af7b [FIX] web: update reference resModel with props
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

closes odoo/odoo#139954

X-original-commit: f8f6aaa5e32967d6c7cd888fbe574acdc6f79dc6
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Renaud Thiry (reth) <reth@odoo.com>
2023-10-27 07:14:45 +00:00
tsm-odoo 7940703757 [FIX] mail: fix guest joined the channel message
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/138330

closes odoo/odoo#139892

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-10-27 07:14:44 +00:00
Thomas Lefebvre (thle) ccf743154d [FIX] website_sale: avoid adding block in a ribbon
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

closes odoo/odoo#139993

X-original-commit: 712edead528c6db8b97a8957bcf7bb3c8005d14a
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
2023-10-27 05:11:48 +00:00
Xavier Morel cb7837470d [FIX] mail: upgrade of existing composers
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.

closes odoo/odoo#139845

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-10-26 21:08:19 +00:00
Christophe Monniez dd05f0af20 [REL] 17.0 2023-10-26 19:39:28 +00:00
jbw-odoo 61d7706d83 [IMP] account: accrual date fix
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

closes odoo/odoo#111535

Signed-off-by: Laurent Smet <las@odoo.com>
2023-10-04 08:39:08 +00:00
Victor Feyens 7a02a6a81e [IMP] core: docstring improvements
* 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)

closes odoo/odoo#102969

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-08-07 09:36:23 +00:00
Xavier BOL (xbo) 6bf135df6a [IMP] project: factorize writable context keys for create and write
closes #7334

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-09-15 13:27:48 +00:00
oco-odoo 721e440d61 [IMP] account: add force_save="1" to move_type
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

closes odoo/odoo#41723

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2023-10-03 18:37:50 +00:00
Victor Feyens 8ce3291eaf [IMP] core: docstring improvements
* 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)

closes odoo/odoo#102969

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-08-09 17:56:35 +00:00
Christophe Simonis ba22091750 [FIX] website: consider modules to upgrade as being installed
Without that, upgrading all modules will delete the snippets.

closes odoo/odoo#139924

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2023-10-26 15:25:50 +00:00
tsm-odoo 233fa50c3b [FIX] im_livechat: fix visitor leave session on log in
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

closes odoo/odoo#139631

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-26 13:41:21 +00:00
Xavier Morel 04f75728fd [FIX] *: restore gettext and unlink lints
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.

closes odoo/odoo#139605

X-original-commit: 99cec73f585c8759142a707b06934d9c23aa5478
Related: odoo/enterprise#49473
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-10-26 13:41:19 +00:00
FrancoisGe 2ae0f239b5 [REM] im_livechat: remove obsolete patch on X2ManyFieldDialog
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.

closes odoo/odoo#139551

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-26 13:41:18 +00:00
mano-odoo 9c877da258 [FIX] stock: invisible field for warehouse in route
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

closes odoo/odoo#139528

X-original-commit: a60c94203072fd2343f6ca3a33a2cc1813757bea
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2023-10-26 13:41:17 +00:00
Alexandre Kühn 38d35c1ac6 [REF] mail: have author in notification formatter
So that `Message.insert()` in JS becomes trivial, as it doesn't have
to infer the author of message to current user.

closes odoo/odoo#139501

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-10-26 13:41:16 +00:00