Commit Graph
166925 Commits
Author SHA1 Message Date
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
Alexandre Kühn eae6943021 [IMP] mail: RecordList auto-call unimplemented array method
This allows to support many unimplemented array methods, such
as `Array.prototype.findLast()`.

Part-of: odoo/odoo#139501
2023-10-26 13:41:16 +00:00
Alexandre Kühn c9a3b335d8 [REF] mail: remove mail/utils/arrays
This utils file was added because removing item in JS based on
item content sucks, so some higher-order functions were introduced
to ease it slightly.

As many of its uses has been replaced with `RecordList.delete()`
where data is uniquely linked to a model, in the end the functions
were only used once. These functions have been moved to the only file
that still use them, so that we don't encourage using them.

Part-of: odoo/odoo#139501
2023-10-26 13:41:16 +00:00
Alexandre Kühn f97012e0ed [REF] mail: support multi-data insertion in discuss model
Before this commit, when having an array of data to insert
in a model, we had to iterate and insert data item on by one:
```js
messageDataList.forEach(data => this.store.Message.insert(data));
```

With this commit, we can simply insert the array of data to
insert:
```js
this.store.Message.insert(messageDataList);
```

This helps simplifying the business code further, less LOCs is
usually better!

Part-of: odoo/odoo#139501
2023-10-26 13:41:16 +00:00
Alexandre Kühn c0da919697 [REF] mail: discuss model html field and trusted insert
This commit allows to define html fields in discuss models,
so that when insert is trusted they are automatically markup.

By default, all model insert are untrusted. To make a trusted
insertion, we should pass 2nd parameter `{ html: true }` to
an `insert()` method. The param is intentionally named `html`
instead of `trusted`, so that it triggers ci/security for
reviewers awareness.

It's still possible to immediately assign a markup on the html
fields, like before.

This changes simplifies the code, so that we don't have to dissect
model data everytime and make sure all bits are properly markup.
The dissect operation added many LOCs and we frequently missed to
markup the data in some flows. Being able to flag html fields at
model definition and flagging an insert safe keeps the security
concern while helping properly markup-ing all the data.

Part-of: odoo/odoo#139501
2023-10-26 13:41:16 +00:00
Alexandre Kühn 46e3594118 [REF] mail: introduce Record.attr() on discuss JS models
In preparation to simplify mail.record/insert processing
(Message.body markup)

Part-of: odoo/odoo#139501
2023-10-26 13:41:15 +00:00
Rémy Voet (ryv)andPolymorphe57 e6f501bea5 [FIX] web: fix domain_selector to handle false as display_name
Since https://github.com/odoo/odoo/pull/137098, `display_name`
can be false (from the default behavior in BaseModel). It isn't
handle correctly in domain_selector Component, which trigger a
traceback trying to `split` false.

closes odoo/odoo#139450

X-original-commit: 06f3cbb95b2e4cfb271039a19660991c743c2ba8
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Co-authored-by: Polymorphe57 <dam@odoo.com>
2023-10-26 13:41:14 +00:00
Nshimiyimana Séna e53081fadb [FIX] l10n_br, base_vat: move Brazilian vat check to base_vat
Summary
-------
Currently, adding a CPF tax ID on a Brazilian contact always fails.

Steps to reproduce
------------------
* install `contacts` and `base_vat`
* create a new contact with country Brazil
* enter a valid CPF (ex: 11144477735)

You should be met with an error

Cause
-----
The CPF check is only implemented in `l10n_br`. Without this module, the
default vat check is applied, but it fails for CPF numbers.

Fix
---
Move the CPF/CNPJ check from `l10n_br` to `base_vat`

opw-3421476

closes odoo/odoo#139222

X-original-commit: 5dc5832f438006a9a4b9abeb1f093d7ed520c771
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: Séna Serge Nshimiyimana (sesn) <sesn@odoo.com>
2023-10-26 13:41:12 +00:00
Arthur Detroux (ard) 32b538de50 [FIX] website: fix traceback on theme menu after adding a Google font
Since [1], `qweb.render` was replaced in all Odoo by `renderToElement`
and `renderToFragment`. However, in the case of the template
`website.delete_google_font_btn`, if the font is served from Google, the
template contains multiple root elements, which means it should be
rendered by `renderToFragment`. This commit fixes that.

Steps to reproduce:
- Install Website.
- Go to website and start edit mode.
- Go to theme menu and open the "Font Family" menu.
- Click on Add custom font.
- Add a Google font (e.g. https://fonts.google.com/specimen/Tilt+Neon).
- Make sure serve from Google is selected.
- Try to open the theme menu again.
=> Traceback

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

task-3557794

closes odoo/odoo#138927

Signed-off-by: Colin Louis (loco) <loco@odoo.com>
2023-10-26 13:41:10 +00:00
Damien Bouvy b020a0276c [IMP] base_automation: add dependency on sms
Since server actions names are computed automatically when (and only
when) they are linked to an automation, not having a dependency at all
between `sms` and `base_automation` meant that we would have either needed
a link module or an ugly `_fields` introspection to correctly name server
actions that send SMSes created through automation rules.

Since `sms` is a rather basic module which has very little impact on the
UI and no impact on pricing, it makes sense to add it to the list of
dependencies of base_automation instead, similarly to `mail`.

Task-3450200

closes odoo/odoo#138804

Related: odoo/enterprise#48987
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2023-10-26 13:41:07 +00:00
Damien Bouvy b4c63eb0ab [IMP] base_automation: adapt views to boolean update
Changes to the UX of boolean field updates via server actions
required some adaptations of the views of base_automation.

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy f11d98ce7d [IMP] base_automation: default record_getter matches default webhook payload
The goal of this commit is to make it simpler for users to match an
incoming Odoo webhook automation rules with an outgoing webhook action
from another Odoo by having a default record_getter that uses the same
syntax as the default payload of a webhook action.

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 82b00574f6 [IMP] base_automation: allow users to keep notes about their automations
Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 28260dc234 [FIX] base_automation: prevent crash in m2o_ref because of unset model
Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 05e5b48971 [IMP] base: improve UX for server actions that update a boolean field
Before this commit, updating a boolean field through a server action was
possible but unintuitive: if you wanted to set the field to `False`, you
had to leave the value empty - worse, writing down `False` would be
considered truth-y since it was evaluated as a string!

This commit introduces a simpler UX for these cases, where the user can
select Yes/No in a selection field if the field they're trying to update
is a boolean field.

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy f1eee6c5fc [FIX] web: correctly space x2many kanban create buttons
Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy a4b25aba17 [IMP] base,sms,mail: server actions UX
- add some placeholders to guide users
- slight rework of code actions (use notebooks again)

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 37976ec5e1 [IMP] base,mail,sms,base_automation: auto-naming of server actions
Commit b05e7e4da0 rightfully removed the _compute_name dependency on
context keys (a bad idea for stored computed fields), but this change
could lead to UX frustrations (Server Action names getting reset all the
time despite what the user may have used as a name before) and UX issues
(e.g. triggering a recompute by accident at module removal that could
reset all 'code' action names to 'Execute Code').

This commit simply removes the automated naming feature from the base
module and moves the logic to the base_automation module - and only
computes automated names based on the link with an automation rule or
not (so 'standalone' server actions need a name given by the user at all
times).

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 3871ae2c6c [IMP] base_automation,base: support m2m operations in server actions
Before this commit, server actions of the 'Update Record' type could
only write on m2m fields entirely - meaning that there was no support
for commands like adding or removing records from the set without
writing it completely.

This commit introduces this possibility, along with some UI changes to
come from it regarding the display of such actions in automation rules.

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 72317d3017 [FIX] base: proper capitilization in selection label
Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy b3efb92f6b [IMP] base: add 'webhook'-type server actions
Webhook server actions allow users to send a POST request to an external
system, e.g. Slack, Github or even another Odoo instance.

This is a rather simple setup, as this feature does not include frequent
features of typical webhooks, such as the possibility to use headers for
authentication, or a retry-policy with exponential decay and all the
bells and whistles of that style.

However, this can be useful for simple actions and automations.

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 1a8e2c567c [IMP] base_automation: embedded kanban layout
Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 253c214b5b [IMP] base: allow server actions to update records across relations
Up until now, the 'Update record' server actions could only update the
record on which the action was triggered.

This is a rather serious limitations, especially in modules that
leverage server actions, like base automation - indeed, if you want a
server action run on e.g. Leads that will write changes on the leads'
customer, you *had* to use Python code.

This commit makes it possible to traverse relations when selecting the
field to update, and indeed to write across relations.

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 8bdac7e26c [IMP] base_automation: view simplification and UX improvements
- reorganise fields to be 'inline' for date triggers
- reword some triggers
- always show trigger fields when 'on save' trigger is selected (not
  just in debug)
- show filter domain when selecting date-based triggers, as you usually
  want other conditions to be fulfilled (e.g. 2 weeks after my ticket
  has been in the 'at risk' stage, 2 days after my SO is 'confirmed',
  etc.)

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 7be6d6e321 [IMP] base: rework the ir.actions.server views
- inline configuration/display for 'update record' action type
- don't use notebook when there's a single page that gets displayed
- remove default field when updating a record

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy e17f06baea [IMP] web: new size option for badge_selection field
When you have more 3-4 options, it quickly takes a *lot* of space.

This commit allows you to set the size to 'sm' (if you have many
options) or 'lg' (if you want super extra big buttons).

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 203af43784 [IMP] base,base_automation,mail,sms: server action UX
- Slight reword of the 'type/state' field labels for server actions
- Re-ordering of 'type/state' values
- Form view changes
- Allow hiding model in display_name of ir.model.fields base on context
  key (avoid technical details when they are not needed)

Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Damien Bouvy 278dece52f [IMP] base_automation: use animation as no-content helper
Task-3450200

Part-of: odoo/odoo#138804
2023-10-26 13:41:07 +00:00
Bastien Fafchamps (bafa) 37ab6ff1b5 [IMP] web: Company service refactor and improved ease of understanding
This commit improves the company service to be more readable. Variables
have been renamed to better indicate what they represent. Jsdoc has
also been added to further improve the ease of understanding of the service.

The following have been renamed:

- `allowedCompanies` -> `activeCompanies`
- `nextCompanies` -> `selectedCompanies`
- `logNextCompanies` -> `applySelectedCompanies`

The SwitchMenu & SwitchMenuItem components have also been simplified by
making use of useState on the company service itself.

Indent has aslo been added to SwitchMenuItem on mobile to display the
hierachy of companies.

closes odoo/odoo#138521

Related: odoo/enterprise#48862
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-26 13:41:05 +00:00
vifo adaf5b2873 [IMP] iot: Enable multiple printing per report via WebSocket
-Implemented a WebSocket service to facilitate communication with the IoT box. This enables printing reports on a network different from the browser. Before it was a long polling connection
-Implemented the ability to link multiple printers to a single report. Before it was possible to link only one printer er report
-When multiple printers are linked, a pop-up will prompt the user to select the preferred printers.
-The user's printer selection will be stored in the browser's local storage.
-Additionally, a reset button has been added to clear the printer selection.

task-3193258

closes odoo/odoo#129164

Related: odoo/enterprise#44398
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2023-10-26 13:41:03 +00:00
Martin Maes eb213f91bf [FIX] mrp: remove set quantities & validate
In the subcontracting portal,
set quantities & validate button has to be removed -> invisible.

task-3201527

closes odoo/odoo#127409

Sub-task: none
Related: odoo/upgrade#5201
Related: odoo/enterprise#43685
Signed-off-by: Steve Van Essche <svs@odoo.com>
2023-10-26 13:41:01 +00:00