Commit Graph
166903 Commits
Author SHA1 Message Date
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
Arnold Moyaux 28d238b578 [IMP] stock: product label layout base on move
Since we use it now on batch and operation rename the selection field

task-3201527

Sub-task: 10
Part-of: odoo/odoo#127409
2023-10-26 13:41:01 +00:00
Martin Maes 86ec5b68c9 [IMP] mrp: add print label button
task-3201527

Sub-task: 10
Part-of: odoo/odoo#127409
2023-10-26 13:41:01 +00:00
Martin Maes d811e1af5b [IMP] mrp: manufacturing order tree view availability check
task-3201527

Sub-task: 4
Part-of: odoo/odoo#127409
2023-10-26 13:41:01 +00:00
Martin Maes 9d62430c89 [FIX] mrp: show workorder by date
In the overview of mrp, workorders were sorted by creation date,
not by planned date

task-3201527

Sub-task: 7
Part-of: odoo/odoo#127409
2023-10-26 13:41:01 +00:00
Martin Maes 7e4dba6ec6 [FIX] sale: Use of the Tab key
In the quotation, using the tab key when the qty at date widget
is invisible was not working as the tabindex was invisible as well.

task-3201527

Sub-task: 8
Part-of: odoo/odoo#127409
2023-10-26 13:41:01 +00:00
Martin Maes a934cc4376 [FIX] mrp: add breadcrumbs on the subcontracting portal
task-3201527

Sub-task: 3
Part-of: odoo/odoo#127409
2023-10-26 13:41:01 +00:00
Martin Maes a250b8e058 [FIX] mrp: remove production capacity from view
Removal of the production capacity from split window.

task-3201527

Sub-task: 11
Part-of: odoo/odoo#127409
2023-10-26 13:41:01 +00:00
MélanieandXavier Bol 4959d47b70 [IMP] * : redesign employee kanban card (master version)
* = hr, hr_holidays, hr_homeworking

Changes the hover on plane icon for leave. In public employee the hover is : "on leave" and in private employee the hover is the name of type's leave

task : 3527398

closes odoo/odoo#137741

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Co-authored-by: Xavier Bol <xbo@odoo.com>
2023-10-26 12:10:14 +00:00
Sven Fuehr 6e230629c0 [FIX] l10n_at: translate accounts, tax report to English
Currently the accounts and tax report are still defined directly in German.
This commit translates them to English and uses the appropriate
translation mechanism for the translation into German.

task-3354661

closes odoo/odoo#135485

Related: odoo/enterprise#47405
Related: odoo/documentation#5859
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-10-26 12:10:11 +00:00
Sven Fuehr d19600b7d0 [IMP] l10n_at: add external / SAF-T tags to accounts
The Austrian SAF-T specification defines a chart of accounts (CoA).
All accounts that are "exported" in the SAF-T document have to be
annotated with their corresponding account in the SAF-T CoA.

This commit introduces tags to associate individual accounts with a code that
should be used for external reports.
For now they will be used to map the company's CoA to the SAF-T CoA.

task-3354661

Part-of: odoo/odoo#135485
2023-10-26 12:10:11 +00:00
Sven Fuehr 715d1eb1a1 [IMP] l10n_at: update CoA; i.e. prepare for SAF-T export
This commit adapts the default chart of accounts to be compatible with
the SAF-T chart of accounts.

In other commits new tags will be added to each account that map our
CoA into the SAF-T CoA (and the account names will be translated).
To make it easier to review the CoA changes the changes are kept separate in this commit.

The account "2600 eigene Anteile" was moved and made into an equity
account since as of today they are part of the equity section of the balance
sheet (by law).

task-3354661

Part-of: odoo/odoo#135485
2023-10-26 12:10:11 +00:00
Sven Fuehr 10b7ffeaf2 [IMP] l10n_at: add country to tags
Previously the tags had no country information.
This commit adds it; they all belong to Austria.

Part-of: odoo/odoo#135485
2023-10-26 12:10:11 +00:00
Damien Bouvy 6bab7a6ae5 [IMP] base: reflect html sanitization attributes
Up until this commit, HTML fields created from the UI or via data
modules or via Studio where alway sanitized, without any possibility of
control by the developper or db admin.

This commit makes it possible to override these attributes for
data-defined fields (python-defined fields cannot be overriden).

This makes it possible to create fields that can e.g. be used as 'block
targets' in the website editor for data modules.

closes odoo/odoo#130544

Related: odoo/enterprise#47116
Related: odoo/upgrade#5290
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-10-26 12:10:08 +00:00
198e226f5b [IMP] website: Expose models on the website
This commit implements a way to expose any model publicly on the website. Both manual and
existing models can create such pages called 'Model Pages'.
A manual model is a model that has been created by the user at runtime, via the technical menu,
via studio, or with an xml declaration.

The main interface to easily create such page is in Studio, in the tab Website Integration. But a
partner or developer could easily import those without studio installed. That's the reason most of
the code to handle the display of such pages is present in the website module directly.

The listing can handle two display modes (Grid or List). Once the user changes the display mode,
the latest value is set in the session to be remembered for the next visit of the page.
A default_layout can be set and is customizable in the website editor or from the backend of Website.
This value is linked to the page to display, so each listing page can use a different layout by default.

The route on which the models are exposed is:
"/model/<string:page_name_slugified>",

With the derived routes:
"/model/<string:page_name_slugified>/page/<int:page_number>",
"/model/<string:page_name_slugified>/<string:record_slug>"

task-id-3231144

Part-of: odoo/odoo#130544
Co-authored-by: Florent Dardenne (dafl) <dafl@odoo.com>
Co-authored-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-10-26 12:10:08 +00:00
flvr-odoo 8d18978b05 [FIX] website: quick fix for install without demo data
Fix crash at install without demo data

closes odoo/odoo#139817

Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
2023-10-26 08:46:01 +00:00
Adrien Dieudonné e6c747b43b [REF] *: keyboard: replace deprecated charCode, keyCode and which properties
These properties are deprecated.

We should consider to use `KeyboardEvent.key` or `KeyboardEvent.code` for new code.
Note that we prefer to use the `key` property as multiple physical keys
can send the same value (e.g. Enter can also be sent by the numeric pad).
We should only use `code` when we explicitly want to target a single physical
key on the keyboard.

By doing this, we can now remove the dependency of `jQuery.ui.keyCode`
that was used as mapping of key code descriptions to their numeric values.

References:
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/charCode (deprecated)
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode (deprecated)
https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/which (deprecated)

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key

https://api.jqueryui.com/1.12/jQuery.ui.keyCode/

Some links that helps:
https://w3c.github.io/uievents/tools/key-event-viewer.html
https://www.toptal.com/developers/keycode/table

closes odoo/odoo#139809

Related: odoo/enterprise#49591
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-10-26 08:46:00 +00:00
Nicolas Viseur (vin) 5dc625fada [IMP] l10n_au: Remittance Advice
In AU, it is customary to name proof of payments document
with different headers if the partner is a customer or a
supplier.

If the partner is a customer, the current "Payment Receipt"
is expected.
If the partner is a supplier, "Remittance Advice" is expected.

This change will bring this to the payment receipt report
if:
- the australian localisation is installed
- either the company or the partner are from Australia

Task id # 3465257

closes odoo/odoo#139543

Signed-off-by: Laurent Smet (las) <las@odoo.com>
2023-10-26 08:45:57 +00:00
anhe-odoo 33e00d1c13 [IMP] spreadsheet: allow to download a shared dashboard
Task Description

The aim of this PR is to be able to download a shared dashboard.
This is done by adding a "Download" button on the shared dashboard
(next to the frozen date), which allow to export the dashboard as
an .xlsx file.

Related Task

closes odoo/odoo#139426

Task: 3512907
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-26 08:45:56 +00:00
svs-odoo 28a9fba05f [IMP] product,purchase: compute price with discount
Add two computed fields, `price_discounted` on `product.supplierinfo`
and `price_unit_discounted` on `purchase.order.line`, to get more
precise price.
For the vendor pricelist, it's useful to get the actual lower price (a
vendor price can be lower than another one but the result can be
different if the discount is take in account).
For the purchase order line, it's useful to get the right price in the
products catalog.

task-3373589

closes odoo/odoo#135502

Related: odoo/upgrade#5223
Related: odoo/enterprise#48375
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-10-26 07:22:56 +00:00
svs-odoo bc01c7bcec [IMP] product,purchase,sale,*: product catalog
This commit makes two major things:

1. Move the product catalog from `sale` to `product`.
It moves the product catalog's code from `sale` to `product` module in
order to be able to use it in other modules.
A mixin, `product.catalog.mixin`, was created for to make other models
catalog compatible.

2. It enables the product's catalog in `purchase`.
In `purchase`, the catalog differs a little bit from `sale`:
- If Unit of Measure is enable, the UoM for each product will appear in
  the catalog;
- If the product purchase's UoM or the purchase order line's UoM is
  different than the default product's UoM, the former one will be
  displayed (in bold so the user can know it's the UoM to refer);
- When opening the product's catalog from a purchase order, the products
  will be filtered by the PO's vendor;
- Some data from the vendor list will be used if appliant: the minimum
  quantity and the price;
- If there is at least one product's packaging, a button will be
  displayed to increase the qty by the packaging's one. If a packaging
  is set on the purchase order line, this one will be used.

task-3373589

Part-of: odoo/odoo#135502
2023-10-26 07:22:56 +00:00
svs-odoo 0a80dbd643 [FIX] purchase(_stock): check style corrections
Part-of: odoo/odoo#135502
2023-10-26 07:22:56 +00:00
svs-odoo aabcdd2bc6 [MOV] purchase(_stock): separate PO & PO line
Separates the file `model/purchase.py` into two files:
- `model/purchase_order.py`
- `model/purchase_order_line.py`

Since every model should have their own file, `purchase.order` and
`purchase.order.line` have it now.

Part-of: odoo/odoo#135502
2023-10-26 07:22:56 +00:00