Commit Graph
1997 Commits
Author SHA1 Message Date
Pierre Pulinckx (pipu) 504b4a7178 [REF] *:Replace moment usages with luxon
luxon and moment are both used in the solution, but
these two libraries facilitate the manipulation of dates.
It was decided to replace all uses of moment with
luxon so we can then remove moment.js from the
code and lighten the assets.

task-3391739

closes odoo/odoo#127406

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-13 14:47:41 +02:00
Sébastien Theys d289d8a7d0 [FIX] mail: make file upload consistent between guest and portal
opw-3370926

closes odoo/odoo#128290

X-original-commit: 2e5f8a3c9e7cff8c61f66e56da7b0f9a59f9bf2e
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-07-13 08:28:06 +02:00
divy-odoo 809029602e [FIX] web, website, portal: fix the text color contrast over background
1. Introduce primary variable to simplified overridden value of
   `$min-contrast-ratio` and document its need.

2. Reduce `$min-contrast-ratio` to 2.9 to solve the inconsistency with
   the previous version 15.0 of text color over some background color.
   Of course it won't restore everything to the way it was: we still
   want the version 16.0 to be an evolution over version 15.0 using what
   bootstrap recommended to compare contrasts. But as going from 3.0 to
   2.9 should not impact existing websites too much and solve use cases
   we feel need solving, we feel it is an ok change.

3. Restore override of the `color-contrast` method that will now
   handle the transparent colors. Before this commit, a color-contrast
   function was just considering RGB value only, after this commit it
   will consider RGBA value, relying (by default) on the fact the body
   background is the background behind the colors we are comparing.

task-3241031

closes odoo/odoo#126759

X-original-commit: 313220ed4a0ff4ae26eb113a3a88b0dc44b649fe
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Divyesh Vyas (divy) <divy@odoo.com>
2023-06-29 06:48:08 +02:00
momegahed 0785c6982d [FIX] UserError.name still used although it was removed
Bug:
the property name was removed in
https://github.com/odoo/odoo/commit/d200dcfb2c912353d404312b9d9484846868cf96

similar to:

https://github.com/odoo/enterprise/pull/42033
https://github.com/odoo/enterprise/pull/40754

opw-3368194

closes odoo/odoo#126070

X-original-commit: 6e6b067b5109327489dccdcc1f5e5405994f98d0
Related: odoo/enterprise#43002
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Mohamed Megahed Abbas Megahed SALLAM (mome) <mome@odoo.com>
2023-06-22 19:37:10 +02:00
Alexandre Kühn cd803877ce [FIX] portal: no crash on adding file in chatter portal
In follow-up https://github.com/odoo/odoo/pull/120437

PR above replaces `underscore.js` `map` by native `.map()`.
The `map` of `underscore.js` accepts anything, even
mapping on `FileList`. However, native `map` needs to
apply on an array.

This commit fixes the issue by ensuring `.map()` is applied
on an array.

Task-3366632

closes odoo/odoo#124750

X-original-commit: fec9cc476134dcdde007ce6fb0c0bee63e38cca1
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-06-13 10:13:46 +02:00
Kartik Chavda f7037c3515 [IMP] portal,project: reduce the size of the wizard dialog in project
In this commit, in this commit, We have changed the size of wizard
dialog to medium instead of large.

task-3259212

closes odoo/odoo#120211

Related: odoo/enterprise#40577
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-06-06 08:05:50 +02:00
Martin Trigaux 2afdda2576 [I18N] *: export saas-16.3 source terms
closes odoo/odoo#123046

X-original-commit: 137f5ca0cb703ee953cb01db525362f7a778e6bd
Related: odoo/enterprise#41703
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-06-01 11:43:51 +02:00
Antoine (anso) f894094359 [IMP] website_crm_partner_assign, portal: layout improvements
This commit:

- Improves the structure of this module as it was broken and
not appealing:

* Text alignments and font sizes were improved
* Card structure instead of a list
* Filters and search are now grouped on top and take less space in
the page

- Adds a specific mobile view for the filters was implemented offcanvas
as the current mobile filtering was not optimized.

- Adds an option to show/hide address in the resellers/partners list

- Makes the option to show the map visible/not visible depending if the
database contains a google maps API

- Makes this module more consistent with the rest of the front-end
modules.

task-3083706

Part-of: odoo/odoo#109752
2023-05-30 10:31:43 +02:00
Louis Wicket (wil) 04189318cc [I18N] *: update master translations
Currently, only stable releases see their translations updated. This has
resulted in master accumulating outdated stuff for years, which can be
confusing for users testing master on runbot.

This one-shot commit resynchronizes master translations based on the
content from 16.0 and removes empty PO files (i.e. no longer containing
translations).

closes odoo/odoo#121629

Related: odoo/enterprise#41171
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-05-22 17:52:07 +02:00
Martin Trigaux 077bbd0b0b [I18N] *: export master source terms
closes odoo/odoo#121563

Related: odoo/enterprise#41140
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-05-17 10:34:00 +02:00
Thibault Delavallée 23bbd8860b [REF] portal(_rating): make portal message_format standalone
RATIONALE

Purpose of this change to rewrite the formatting done on messages displayed
on simple frontend i.e. portal chatter widget and project chatter.

We stop calling 'message_format' which computes a lot of unnecessary data
and sends too much information to frontend. We choose to instead manually
handcraft the returned data, already tailored for frontend widget.

SPECIFICATIONS

Remove call to '_message_format' in 'portal_message_format'. Instead have
a list of properties (fields or computation based on fields e.g. rating publisher
information) that can be overridden in sub-addons. Use those to generate
the data used by frontend chatter widget.

Remove extra formatting or data computation done in JS files. Do it directly
in 'portal_message_format' in order to have clean information sent.

This change targets mainly portal and portal_rating. Making those modules
Independent from backend message formatting allows to save queries and
also to avoid sending useless information to the frontend.

Task-3322905

Part-of: odoo/odoo#121104
2023-05-16 15:55:17 +02:00
Lucas Lefèvre 96669c74f8 [IMP] spreadsheet: share spreadsheet
This commit allows to share spreadsheets to other users (public, portal or
internal without the required access rights)

See Enterprise commit. This commit prepares the ground to sharing
`documents.document` spreadsheets.
(I expect dashboard spreadsheet sharing in the near future which will
use the same generic code)

The challenges of sharing odoo spreadsheets
-------------------------------------------

Odoo spreadsheets can have any data from the database.
ODOO.PIVOT and ODOO.LIST functions specifically can target *any model*
and *any field*.
The values are dynamically loaded with RPC calls when the
spreadsheet is open. Normal access rights apply to load this kind of
"embeded" data.

A user can open a spreadsheet if he can read the `documents.document` record,
but odoo specific functions might result in errors if the user doesn't have
the access rights on the underlying model.

That's obviously not what we want when sharing a spreadsheet to an external
person. We want this person to see the values and not a spreadsheet full
of errors.

Giving access to external user?
---------------------------------

Users must have a very clear understanding what they are "leaking" when
they share a spreadsheet. Sharing a spreadsheet should not open any door
the user wouldn't think of or wouldn't understand.

The best way is to be very strict with the data we are sharing.
That means: only the specific models, specific fields and specific records
visible in the spreadsheet by the user who is sharing (different users can
see different values for the same spreadsheet, depending on their access rights).

We also want to consider the following scenario:
Alice is a newcomer (with very limited access rights) and she shares a
spreadsheet to a customer. A few years later, she is manager and has a
lot more access rights (groups, ir.rules, etc.).
The forgotten spreadsheet shared years ago should not leak more data because
Alice now has access to all company data.

Specification
=============

With all those challenges in mind, here is a first approach of shared
spreadsheet:

Readonly freezed spreadsheet for external users
-----------------------------------------------

When sharing a spreadsheet, we actually copy and freeze the spreadsheet at that
time. Odoo formulas are replaced with their value. This is the easiest and safest
way to deal with access rights to other models: there's no access to other
models at all ^^
The spreadsheet is displayed in readonly since it would only be editing a copy.
If the external person wants data to be updated, he can ask a new sharing link.

Read/Write for internal users
-----------------------------

The situation for internal users is different. We can rely on their actual access
rights.
When an internal user opens a spreadsheet sharing link, he is redirected to the
regular spreadsheet client action. A token is used to read/write the
`documents.document` record (and other linked models such as `spreadsheet.revision`),
but the data for pivots, lists, etc. is loaded with the user's own access rights.
If the user doesn't have the rights to read a model or field, the function results in
an error and that's the expected behavior.
This sharing strategy is perfectly fine for all spreadsheets that doesn't contain
any odoo data (think of all the Google Sheets we receive internally by email to
register to an event or any other stuff).

Future work
-----------
From a functional point of view, the spec is far from perfect.
Users would probably expect the data to "update" itself (not freezed).
People will want write access for external users as well.
Given the complexity of getting it right (from a tecnical, security and functional POV),
this is left for a later work

closes odoo/odoo#114040

Task: 3045808
Related: odoo/enterprise#37687
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-05-15 13:58:59 +02:00
Pulinckx Pierre (PIPU) f4f0f78318 [REF] *: Replace underscore.js function by native JS
Before this commit : The library underscore.js and
underscore.string.js were used in the ODOO solution.
After this commit : Every usages of a function from
underscore.js lib has been replaced with native javascript.
The goal is to remove all usages of underscore.js and to
not use anymore this library in ODOO.
---
TaskId : 3246238

closes odoo/odoo#120437

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-05-15 09:37:48 +02:00
Brieuc-brd 418413e499 [IMP] web, *: directional icons
This commit adapts the directional icons to improve the usability and
maintain consistency with the ui icons library.

task-2818586

Part-of: odoo/odoo#116641
2023-05-12 22:59:22 +02:00
Pierre-Yves Dufays 3e57dc295c [IMP] mail, portal, website_slides, mass_mailing: unfollow record from email
Allow partner to unfollow a document from a follow up email of that document
through an unsubscribe URL in the email even if not connected.

It works for internal user for follow up on any document and for any partner on
follow up of document tagged as authorizing being unfollowed by any partner (
slide.channel and slide.slide).

Technical note:
The unfollow block is rendered in mail_thread and updated for each recipient in
mail_mail. We don't render it in mail_mail because we don't have the language
of the message at that point.

Depending on the partner and the related document, the unfollow block is:
- either removed if the user cannot unfollow the document (for example if it
doesn't follow it)
- or updated with partner and document information + a security token

Task-3061864

Part-of: odoo/odoo#107978
2023-05-10 13:21:07 +02:00
Renaud Thiry 87b0189ff1 [IMP] mail: remove default logo
Many templates use the company logo that is set by default on
database creation. As that logo is clearly a placeholder and the user
isn't necesserely prompted to update it. It's possible for a user to
inadvertently start sending emails with "your logo" placeholders
plastered all over.

This removes the default logo of the company and removes it from
templates conditionally.

The logo isn't simply replaced with a transparent PNG as the templates
set a fixed height for the logo, which would look weird.

task-3067315

Part-of: odoo/odoo#106307
2023-04-24 10:20:12 +02:00
Pulinckx Pierre (PIPU) 608e90e998 [REF] *: Replace underscore functions by native JS
Replace _.map(), _.flatten(), _.delay(), _.contains(), _.pluck(), _.isUndefined(), _.isEmpty(), _.isString(), _.isEqual(), _.isBoolean(), _.memoize(), _.invoke(), _.bind(), _.escape(), _.debounce(),
_.str.sprintf(), _.str.repeat(), _.str.startswith(), _.str.trim(),
_.str.escapeHTML(), _.str.escapeRegExp(), _.str.startsWith(), _.str.include()

closes odoo/odoo#118012

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-04-20 11:57:29 +02:00
Pulinckx Pierre (PIPU) 800223ae7c [REF] *: Replace underscore _.each() by native JS
Replaced _.each() functions (average 235 occurences)

Description of the refactoring this PR addresses:

Current behavior before PR:

There are underscore.js function enumerated above used in odoo.

Desired behavior after PR is merged:

These functions has been replaced by native javascript
prototypes/methods/functions.

TaskId : 3246238

closes odoo/odoo#118565

Signed-off-by: Georis François (fge) <fge@odoo.com>
2023-04-18 15:38:54 +02:00
Pulinckx Pierre (PIPU) 614de86989 [REF] *: Replace underscore function by native JS
Replace _.isNumber(), _.filter(), _.reject(), _.unique(), _.indexOf(), _.lastIndexOf(), _.findIndex(), _.range()
_.keys(), _.values(), _.str.sprintf() and some _.each()

closes odoo/odoo#118003

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-13 16:40:11 +02:00
Pulinckx Pierre (PIPU) 29d55e4403 [REF] *: Replace underscore functions by native JS
Replace _.last, _find, _.extend, _.some, _.every

Taskid 3246238

closes odoo/odoo#117319

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-04-05 12:50:43 +02:00
Michael (mcm) ff0d6dd580 [REF] *: replace odoo module by native one
This commit converts almost all odoo module by native module.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#117305

Related: odoo/enterprise#39118
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-03 17:07:24 +02:00
qsm-odoo f697decd51 [FIX] portal: use proper muted color for portal chatter published dates
The color that was used for portal chatter published dates was the muted
color that we use at some places in the backend. The portal screens
being frontend screens, it of course did not work with all website color
schemes.

This simply uses the `$text-muted` color to fix the issue. This probably
needs refactoring in master to avoid those extra CSS rules that could
simply be gone with proper bootstrap XML structures.

opw-3146164

closes odoo/odoo#117233

X-original-commit: 29d691327317600ddf2116b7c02709bbeb6cae5b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-03-30 20:03:32 +02:00
Noe Antoine 554b31eec7 [IMP] portal: add fallback contact if salesperson not set.
Before this commit, the "Your contact" details in the portal
layout were not shown if the user_id (salesperson) was not set
on the portal user's partner.

In order for them to have contact info in that case, we now use
as a fallback contact the one responsible of their company, i.e.
the first company in the parent hierarchy (corresponding to the
commercial_partner_id field).

We still do not use the user if it they are a public user.

Task-3213421

closes odoo/odoo#114599

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-03-16 14:12:29 +01:00
Thibault Delavallée c088d5423e [IMP] mail: cleanup _notify_get_recipients code bits
This commit contains mainly code cleaning, docstrings and a small split
for notification tool methods. In this commit we

  * make some notification groups variable explicit;
  * move the filler of groups into its own submethod to ease being called
    from other code (to be used soon);
  * fix some strange overrides or code manipulation;
  * propagate some additional parameters to ease future commits that will
    improve rendering of groups-based notification emails;
  * cleanup, fixup and improve docstrings;

This does not change anything from functional point of view, just preparing
further work.

Task-3046371 (Mail: Better Language Support in Composer)

Part-of: odoo/odoo#106177
2023-03-09 15:54:12 +01:00
Raphael Collet 44d336128d [FIX] mail: overrides of _search()
This is about the overrides of _search() on models mail.activity and
mail.message, which both make extra queries to implement their specific
access rights.  We combine both queries made in _search() to retrieve
accessible records.  This simply uses the API of the Query object to
retrieve the data that is necessary to restrict access to messages.

Move security check outside of _message_format() for performance.  The
call to check_access_rule() inside _message_format() was redundant in
many cases and generated more SQL queries than necessary.

Also for performance, accessing fields from records should not actually
check permission.  That's a bit freaky, but this reproduces the former
behavior of mail.message.

And finally, make method check_access_rule() on mail.message check
ir.rules, in order to make it consistent with method _search().

Part-of: odoo/odoo#112126
2023-03-05 15:12:56 +01:00
Michael (mcm) 9f4622492c [REF] *: register field descriptors instead of components
Before this commit, the field's description was stored on the
component and this component was then registered.

Now, an object describing the field is used on registration the same way
as it is done for views since https://github.com/odoo/odoo/commit/b828cfc72c587d0b73fcc5459695705640437671.
This split the component's description (props, template, ...) of
the field's description (displayName, supportedTypes, ...) and makes
it clearer.

closes odoo/odoo#112498

Task: 3171520
Related: odoo/enterprise#37105
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-16 14:13:32 +01:00
Thibault Delavallée 03aa01aff7 [FIX] portal: fix recipients computation override
Portal defines the 'portal.mixin' that overrides a method from 'mail.thread'.
However no explicit inheritance is given between those two mixin. Some Odoo
models notably inherit from 'portal.mixin' and not from 'mail.thread'. It
makes no sense to override a method the model does not explicitly inherit.

In this commit we move the override on 'mail.thread' by checking the model
also inherits from 'portal.mixin' before doing portal-specific computation.
This fixes tests introduced previously.

Task-3175768 (Mail: check inheritances / overrides)

closes odoo/odoo#112573

Related: odoo/enterprise#37039
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-13 22:46:42 +01:00
Miquel Raïch 317463fb21 [IMP] *: Remove unnecessary view_type
closes odoo/odoo#110817

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-01-30 19:45:59 +01:00
Géry Debongnie b53f78e224 [REF] web_tour,*: use the registry in collecting the tours
This is a step closer to a goal of avoiding dependence on asynchronous
modules. Starting from this commit, new tour definition should be
registered to `registry.category("web_tour.tours")` registry.

So, instead of the following:

```js
import tour from "web_tour.tour";
tour.register(name, options, steps);
```

We now do:

```js
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add(name, optionsWithSteps);
```

Notice the `options` and `steps` params are merged when registering
the tour definition. It should look something like so:

```js
registry.category("web_tour.tours").add("account_tour", {
  test: true,
  steps: [ ... ],
});
```

And if the `TourManager` instance is needed, one can get it from the
registry like so `registry.get("tourManager")`. Note however that
this instance is only available when the `TourManager` has been
instantiated -- so it's not available at top level of the module.

closes odoo/odoo#111103

Related: odoo/enterprise#36335
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-01-27 23:17:35 +01:00
Martin Trigaux 776689b0f4 [I18N] *: export saas-16.1 source terms
closes odoo/odoo#110752

X-original-commit: 56b2b52287a8f2192d80ea417c7efac80a87c0a9
Related: odoo/enterprise#36173
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-01-24 10:20:30 +01:00
Thibault Delavallée 4775bd93a2 [REF] mail: cleanup post with {view, template} wrappers
RATIONALE

Purpose of this commit is to cleanup main post helpers and have a more easy
and understandable way of calling them.

SUMMARY

We now have two main API methods, based on business flow: either posting
on documents, either sending a mass mailing. Indeed those two flows are
different

  * post: create message, then launch notification process by taking into
    account subtype, followers, ...
  * mail: create mails in batch with recipients being based on template or
    given partners. No notifications is involved, only maybe traces if a
    mass mailing is linked

Delegate QWeb rendering to the render mixin (i.e. _render_template_qweb_view)
in order to have a single point to forge evaluation context and re-use
existing rendering code.

SPECIFICATIONS

Main API helpers are now

  * ``message_post_with_source``: (batch) post on records, using an ir.ui.view
    (given a record or its xml id) or a mail.template record (given a record or
    its xml id). When using a template, a composer is called to post on each
    record (as batch post is not yet supported). When using a view, a direct
    call to message_post using the rendered bodies is done, one record at a
    time.
  * ``message_mail_with_source``: send a mass mailing on records, acting like
    invoking the mail composer in mass mode. Same arguments are valid, either
    a reference to a view, either a reference to a mail template.

Other helpers are

  * ``_message_log_with_view``: (batch) log on records, using an ir.ui.view
    to render the body using QWeb (no notification process);
  * ``_message_log(_batch)``: (batch) log on records (no notification process);
  * ``message_notify``: notify partners on records (creating notifications
    specifically for some people while message itself is not displayed in
    chatter);

Code migration

  * ``message_post_with_template`` in "mass mode": use ``message_mail_with_source``
    and set the template record as source;
  * ``message_post_with_template`` in "comment" mode: use ``message_post_with_source``
    and set the template record as source;
  * ``message_post_with_view``: its main usage was to post on a document, in which
    case it generally can be replaced by ``message_mail_with_source`` using
    the view reference as source;

Task-2710804 (Mail: Clean MailThread Posting API)

Part-of: odoo/odoo#99482
2023-01-17 20:58:34 +01:00
Thibault Delavallée 418761e344 [LINT] mail, various: use explicit subtype in message_post_{with_...}
RATIONALE

Purpose of this commit is to be explicit in subtype chosen when invoking the
message composer / calling message_post. As default value may not always be
clear, better be explicit in case the composer default value changes.

SPECIFICATIONS

Add explicit references to subtype when it is not obvious what will be the
final subtype, notably when using helpers (post_with_view or template which
uses the composer that is not crystal clear in its subtype management).

In this commit we also add support of XMLID-based subtype when invoking the
composer. A ``default_subtype_xmlid`` context key is transformed into a
``default_subtype_id``, to be used notably in JS where we cannot easily
use a ``ref``-like statement. Post API now also supports 'subytpe_xmlid'
argument allowing to give the xml id and ease calling the methods.

Use ``_xmlid_to_res_id`` to get directly the ID of subtypes in order to
avoid useless queries from ``ref`` that does an exists.

Also remove useless values given to post API, notably author_id that is by
default the current users' partner.

Task-2710804 (Mail: Clean MailThread Posting API)

Part-of: odoo/odoo#99482
2023-01-17 20:58:33 +01:00
Guillaume (gdi) 2efece9884 [FIX] portal: fix portal title for the salesperson data
Before this commit, if the helpdesk module was installed, the title of
the salesperson data was changed from "Your contact" to "Salesperson"
for portal users. This did not add any value and the title of the tab
also became "Salesperson" which we do not want. This commit allows to
keep the title "Your contact" above the salesperson information and to
not change the tab title.

Steps to reproduce the problem fixed by this commit:
- Run Odoo enterprise with helpdesk and sales installed.
- As the admin, create a helpdesk ticket with Joel Willis (portal user)
as the customer and save.
- Click on Joel Willis, select the "Sales & Purchases" tab and set a
salesperson.

=> Log in as Joel Willis and on /my, you will have "Salesperson" as the
title of the tab. This bad behavior is due to [this commit] that added a
title above the salesperson information. But with this change the title
of the tab was also impacted. Then [this other commit] added a default
title above the salesperson information. We can be satisfied with this
default title which does not alter the title of the tab.

[this commit]: https://github.com/odoo/enterprise/commit/700e9dec4a5c9fca354e063d6a85b0514832c84c
[this other commit]: https://github.com/odoo/odoo/commit/d5c66ca1fa5d0f364241636bd502342c1d4ee9ac

opw-3103718

closes odoo/odoo#109138

X-original-commit: 1ebeec9dc2ea9c4a2051b06118f47a440dd5e470
Related: odoo/enterprise#35444
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-01-05 16:52:04 +01:00
Victor Feyens 13ccd9cee4 [IMP] test_lint: detect useless manifest content
Keep the manifests as light as possible, to easily see custom behavior/content.
Complete the work of previous commits cleaning the manifests content:

* 42bad1a6d2
* ef7005f524

and make sure this kind of cleanup commit is not necessary in the future
because it is now automatically verified by a dedicated test.

closes odoo/odoo#107735

Related: odoo/enterprise#34903
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-12-16 16:17:41 +01:00
Benjamin Vray 648def9058 [FIX] portal: fix user dropdown in boxed header template
Since this commit [1], the "avatar" image of the logged user is no
longer displayed on the "boxed" header template.

This is due to the "t-nocache" attribute which was forgotten for the
"_avatar" parameter in the "user_dropdown" template.

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

task-3063878

closes odoo/odoo#107861

X-original-commit: 484f0acade527e38e9569fc066b4647a8d70e397
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
2022-12-16 10:28:39 +01:00
Jorge Pinna PuissantandMichael Mattiello (mcm) c7c2959449 [IMP] web, *: simplification and standardization of the settings arch
The aim of this commit is to simplify and standardize the settings archs.

To do this, a small DSL exclusively for the settings was created. This
new DSL introduces 3 tags: `app`, `block` and `setting`.

The `app` tag is used to declare the application on the settings view.
It creates an entry with its logo on the sidebar of the view. It also
acts as delimiter when searching.

```xml
    <app string="CRM" name="crm">
    ...
    </app>
```

- `string` : The "display" name of the application.
- `name` : The technical name of the application (the name of the module).
- `logo` *optional* : The relative path to the logo. If not set, the
        logo is created using the `name` parameter :
        `/{name}/static/description/icon.png`.

The `block` tag is used to declare a group of settings. This group can
have a title and a description/help.

```xml
    <block title="Title of group Bar">
    ...
    </block>
```

- `title` *optional* : The title of the block of settings (the old h2),
        you can perform research on its text.
- `help` *optional* : The description/help of the block of settings
        (the old h3), you can perform research on its text.

The `setting` tag is used to declare the setting itself. The first field
in the setting is used as the main field (optional). This field is
placed on the left panel (if it's a boolean field) or on the top of the
right panel (otherwise). The field is also used to create the setting
label if a `string` is not defined. The `setting` tag can also contain
more elements (e.g. html), all of these elements are rendered in the
right panel.

```xml
    <setting string="this is bar">
        <field name="bar"/>
        ...More elements
    </setting>
```

- `type` *optional* : By default, a setting is visually separated on two
        panels (left and right), and is used to edit a given field. By
        defining `type='header'`, a special kind of setting is rendered
        instead. This setting is used to modify the scope of the other
        settings. For example, on the website application, this setting
        is used to indicate to which website the other settings apply.
        The header setting is visually represented as a yellow banner on
        the top of the screen.
- `string` *optional* : The text used as label of the setting. If it's
        not defined, the first field is used as label.
- `title` *optional* : The text used as tooltip.
- `help` *optional* : The help/description of the setting. This text is
        displayed just below the setting label (with classname
        `text-muted`).
- `company_dependent` *optional* : If this attribute is set to "1" an
        icon is displayed next to the setting label to explicit that
        this setting is company-specific.
- `documentation` *optional* :  If this attribute is set, an icon is
        added next to the setting label, this icon is a link to the
        documentation. Note that you can use relative or absolute path.
        The relative path is relative to
        `https://www.odoo.com/documentation/server_version`, so it's not
        necessary to hard-code the server version on the arch anymore.

closes odoo/odoo#106425

Task-id: 3081367
Related: odoo/enterprise#34337
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: "Michael Mattiello (mcm)" <mcm@odoo.com>
2022-12-02 14:40:25 +01:00
Thibault Delavallée 1c240f11df [IMP] mail: cleanup code bits in attachments processing
Purpose of this commit is to try to make code a bit easier to follow using
dicts, sets and tuples, as well as updating some variable names.

Also rename the method to be clearer. Tools methods may omit the namespacing
to avoid too much confusion in naming.

Task-2710804 (Mail: Clean MailThread API)

Part-of: odoo/odoo#106658
2022-11-28 15:52:59 +01:00
Thibault Delavallée 0ea4c3110a [MOV] account, mail: properly locate attachments management on model
PURPOSE

Purpose of this task is to cleanup attachment management done in generic mail
models overrides and move it in account as model overrides.

SPECIFICATIONS

Accounting holds code to handle attachments linked to their custom composer
(``account.invoice.send``) that uses through inheritance the mail composer
(``mail.compose.message``) that has a specific processing of attachments
to link pending composer attachments to the right records.

Indeed attachments linked to the composer are pending attachments, and are
linked to the record when posting the message. This allows to know which
attachments have been added by the user, have specific rules for access
rights, ...

However this code has been wrongly added directly at mixing level at
odoo/odoo@bdcc012004. Instead ``_message_post_process_attachments`` method
should always be called based on a record, allowing to locate the override
at model level.

Task-2792146 (Mail: Move model-dependent code from composer / template)
Task-2710804 (Mail: Clean MailThread API)

Part-of: odoo/odoo#106658
2022-11-28 15:52:58 +01:00
qsm-odoo d49200feca [REF] website, *: remove (deprecated) $target uses in public widgets
*: auth_totp_portal, mail_group, portal, survey, web, website_event,
   website_event_track, website_mail, website_mail_group,
   website_mass_mailing, website_payment, website_sale

Although this is deprecated since 5 years with [1], new occurrences of
`this.$target` in widgets kept being introduced. `this.$el` can be used
just like in any other widget, or even better: `this.el` to not rely on
jQuery.

For now, this still keeps the definition. This just removes the bad uses
to prevent more copy/paste... let's delay the decision to remove the
definition entirely to another day.

[1]: https://github.com/odoo/odoo/commit/2972976962617d4b8a0113bae58c640ab41cdff8

closes odoo/odoo#106437

Related: odoo/design-themes#618
Related: odoo/enterprise#34343
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-11-24 19:25:14 +01:00
Thibault DelavalléeandKrzysztof Magusiak <kmagusiak> 28ed4eddea [FIX] portal: check model is valid when entering mail redirect controller
When mail_action_view() calls this function, the model may not be a valid
one or even be missing. So we check if the model exists before checking its
type.

We also correctly add kwargs parameters propagation.

Add tests.

Task-3025143

X-original-commit: b5d9f42ddc2dfde21714544add72023004069815
Part-of: odoo/odoo#103378
Co-authored-by: Krzysztof Magusiak <kmagusiak>
2022-10-18 13:17:31 +02:00
Damien Bouvy e647a2de09 [IMP] *: adapt to grid form views
The recent switch from tables to css grids for form views `group` nodes
has introduced several inconsistencies/issues with several views accross
modules - these will not be the last fixes.

closes odoo/odoo#102174

X-original-commit: 836568dfd59886a6d52f15e0e2109709903b6803
Related: odoo/enterprise#32295
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2022-10-11 13:15:12 +02:00
Martin Trigaux fde3f4d4b9 [I18N] *: export 16.0 source terms
closes odoo/odoo#102163

X-original-commit: 011d7aac5aacedb3ab373f247471ba69d67f50f3
Related: odoo/enterprise#32288
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-10-06 14:56:52 +02:00
Dossogne Bertrand 7c4da16b59 [IMP] mail, various: improve mail template usability
Allow our users to modify mail template more easily

- make the list accessible from the settings
- give them a link to update relevant views to update header/footer
- make the list and form of templates more readable
- add a description on templates, allowing to describe their usage

In order to better filter templates, a new category field is added that
is computed based on active flag, description being set and the template
having an xml ID. Master templates are active, with a description and an
xml ID.

Update master data to add description on some templates.

task-2944770

closes odoo/odoo#101730

X-original-commit: dfa867343ee8842f3f127ac62584fd471b41dde1
Related: odoo/enterprise#32079
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-10-04 09:55:46 +02:00
Younn Olivier fa4cc2f969 [FIX] web, portal: re-introduce w-0 and h-0 utility classes
When updating bootstrap to bootstrap 5 with [1], the h-0 and w-0
extended utility classes were lost.

This commit adds them back, using the Utility API of Bootstrap described
here [2], and the $utilities-sizes from [3]. Therefore, the code
introduced in [4] is not needed anymore (those classes are now available
in all Odoo instead of just the frontend).

This commit fixes the footer "scroll to top" option of the website
builder.

[1]: https://github.com/odoo/odoo/commit/971e5a91aab9
[2]: https://getbootstrap.com/docs/5.0/utilities/api/
[3]: https://github.com/odoo/odoo/commit/e377a084174d
[4]: https://github.com/odoo/odoo/commit/da55072a6935

closes odoo/odoo#101691

X-original-commit: 3a2ad02962fdea254ca46af1f7728b537a6af9cd
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-30 15:33:00 +02:00
William Braeckman 6a0efdb7c4 [IMP] web: expose before and after execute action on controllers
Make it possible to override both before and after execute actions on
all view controllers using `useViewButtons`.
This avoids having to change a value in the env to override the function
being called when clicking on a button.

closes odoo/odoo#101310

X-original-commit: 9f6c2b8e969635f35786d58ee89ca767ff57144d
Related: odoo/enterprise#31860
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-09-27 18:14:49 +02:00
Martin Trigaux 1a8772769e [I18N] *: export 16.0 source terms
closes odoo/odoo#100573

Related: odoo/enterprise#31507
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-09-20 13:48:49 +02:00
Romain Estievenart 98a97d0fea [IMP] *: removes .form-group
this commit removes the usage of .form-group class which is deprecated
since BS5.

Here is the css rules that was used:

a) https://github.com/twbs/bootstrap/blob/8fa0d3010112dca5dd6dd501173415856001ba8b/dist/css/bootstrap.css#L1997
As we can see, it simply adds a `margin-bottom` of `1rem` which
corresponds to the `.mb-3` BS class.

b) https://github.com/twbs/bootstrap/blob/8fa0d3010112dca5dd6dd501173415856001ba8b/dist/css/bootstrap.css#L2326
As we already checked all `form-inline` in [1] and [2], we don't have to
do anything about these rules.

'''Breaking change: Dropped form-specific layout classes for our grid
system.
Use our grid and utilities instead of .form-group, .form-row, or
.form-inline.'''

https://getbootstrap.com/docs/5.0/migration/#forms

Notes:
- `position: relative` is already on `#new-password-group`.
- `.field-db`, `#editor-media-image`, `.unsplash_img_container` and
`#url-form-group` seems unused.
- Sometimes margins are unnecessary because of blocks overlapping.
  (e.g. `margin-bottom` is not needed if margin-top is set on the
  following node)
- CSS rules applied on `.s_website_form_rows > .form-group` are now in
the XML by adding `mb-0 py-2` BS classes.

Follow-up of:
[1] https://github.com/odoo/odoo/pull/97967
[2] https://github.com/odoo/enterprise/pull/30343

closes odoo/odoo#100052

Related: odoo/enterprise#31261
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-09-16 20:51:56 +02:00
Gorash 39ea7a1fab [IMP] web/all: XML templates are now declared into the python manifest.
Adapt all manifest, split some XML file and update JavaScript files.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00
Thibault Delavallée 17bf3d9134 [FIX] portal, account: explicitly check access on record for chatter_post
Currently using the ``chatter_post`` route to post a message implicitly checks
for access rights on related record. It is done manually in ``message_post``
that is called by the route. It is done because record name is accessed as
sudo and an explicit access has been added because of fear of information
leak.

However this is a bit out of scope for ``message_post`` to perform that check
at that point. As the underlying record is accessed numerous times, adding
an explicit check just adds queries.

In portal, users may have a token and/or a hash and a partner_id, in which
case they enter sudo mode if valid, and an error is raised otherwise. However
when not using a token and/or a hash and a PID access check is now done
directly in the controller helper. Moreover this allows to have the access
error directly instead of being possibly hidden by another error, which was
the case before this fix (was actually raising about missing email_from).

In this commit we add an explicit check on record access before entering
the post computation. That way access errors are directly raised.

A fix in accounting is necessary to ensure the right error is raised. Indeed
otherwise it currently raises due to non existing email_from, and should
raise due to ACL instead. Tests are now more inlined with classic flows.

Task-2710804 (Mail: Clean MailThread API)

Part-of: odoo/odoo#99654
2022-09-09 11:12:29 +02:00
Jérémy Hennecart (jeh) fac9302974 [IMP] portal: remove 0 lines display
We now display only the lines that have documents linked to them.
In case, we want to display a line even if there are no doc, we
can do so by updating the list of counter to keep with
"getCountersToKeep()".

In case, there are no lines, we display a small message.
For now we always display the quotations, sale orders and invoices.

task-2947778

closes odoo/odoo#99373

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-09 11:12:12 +02:00