Commit Graph
165870 Commits
Author SHA1 Message Date
Jay Savaliya fed6bb12c1 [FIX] mail: email/sms error icon overlap
Before this commit:
-While reading chatter notifications in the chat window, SMS and email icons are
not accessible to click due to action list overlap.
-While reading a reply on any message or attachment in chat widow,
the attachment link is not accessible to click due to action list overlap.

After this commit:
-When SMS and email icons are visible, time and that icon will display to the
following line so user can click on it easily.
-Attachment links will display to the following line of mentioned so user can click
on it easily.

Task-2713371

closes odoo/odoo#137734

X-original-commit: 3ae87df6e39cb8ef279ef62f194edf14858d2edf
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-10-06 09:39:27 +00:00
Loukas Wets (lowe) 6504de0f94 [IMP] point_of_sale,l10n_in_pos: various pos.bill changes
This commit:
- Changes the order of bills and how the values are displayed in the
pos_bill_view.
- Adds a 500 bill for India localisation.
- Changes the tree view of pos bill to be editable and set the bill
to all the pos_configs if no config is linked to the bill.
- To prevent inconsitancy, 'pos_default_bill_ids' field is removed from
the res.config.settings view since if no pos config is linked to the bill, the
bill is accessible to all the pos configs.
- Removes the amount in the open session button in opening cash control popup.

Task-3537655

closes odoo/odoo#137521

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-10-06 09:39:26 +00:00
FrancoisGe c830d9bc9d [FIX] web: Record.update with onChange
The goal of this commit is to resolve:
=====================================
1. When you edit a Char or Boolean field with an onChange that returns
   the value before editing, you must display the value of the onChange.
2. In the model, html fields are always Markup fields. But when we evaluate
   a modifier containing an html field, we use the server value (a string or false).
3. When we edit a field and its onChange returns an server error, we want to
   revert its value to the valuea before edition.

Solution:
=========
1. Always render when applying a change, even if the value does not change,
   because onChange returns the initial value. To do this, we'll apply
   the changes to record.data, then apply the changes from onChange.
   The value will therefore change, which will cause all the components
   observing the value in record.data to render.
2. When we update an html field, its value will always be markup and
   we'll store it as a string in _textValue so that we can evaluate the
   modifiers without the markup. For changes coming from the onChange, we
   will store the value in _textValue and apply markup on it for record.data.
3. When an onChange returns an server error, we will apply the changes and then
   revert them directly. This will have the effect of triggering a rendering
   on all the components observing to the record.data corresponding to
   the changes and so displaying the values before editing.

How to reproduce:
=================
Case 1:
------
- Go to a form view containing a boolean field with an onChange
- Check the boolean field
- The onChange returns with the value false

Before this commit:
    The boolean field is always checked

After this commit:
    The boolean field is no longer checked

Case 2:
------
- Go to a form view containing an html field and an field "x" with
  invisible ="not html_field" and an onChange
- Edit the field "x"
- The onChange returns the value false for "html_field".

Before this commit:
    The field "x" is always displayed

After this commit
    The field "x" is no longer displayed

Case 3:
------
- Go to a form view containing a char field with an onChange
- Edit the field
- onChange returns a server error

Before this commit:
    The field is marked as invalid and contains the value after editing.

After this commit:
    The field contains the pre-edit value

closes odoo/odoo#136924

Related: odoo/enterprise#48515
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-06 09:39:24 +00:00
niyasraphy 3b4e8ea422 [IMP] point_of_sale: copy combo lines on duplicating a combo
before this commit, on duplicating a combo product, the
combo lines are not copied to new records

after this commit, the combo lines will get copied
during the duplicate

closes odoo/odoo#135577

Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
2023-10-06 09:39:22 +00:00
David Monnom (moda) 4ab79fff7a [IMP] point_of_sale,pos_restaurant: primary btn payment, order & review
Previously, the order, review and pay buttons were in btn-primary at the
same time, or not at the right time.

Changes have been made to the current behavior:
- If there is no order line, both buttons are gray
- if something needs to be sent, the Command button takes priority
- if nothing is to be sent, the Payment button takes priority

A fix has also been made to the number of items to be sent to the
kitchen, both for the category list and for the number of products.
The number of products per category was erroneous, so the number of
products has been changed to an absolute value.

closes odoo/odoo#134679

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-10-06 09:39:20 +00:00
shag-odooandVictor Feyens bf95b1f2ad [ADD] sale: new wizard to apply discounts on sale orders
Replace the magic js logic applying the discount of the first line to all
the lines by a dedicated wizard, providing three kind of discounts:

* Discount on each sale order lines
* Discount on the global order amount
* Fixed discount amount

task-3369680

closes odoo/odoo#129087

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Co-authored-by: Victor Feyens <vfe@odoo.com>
2023-10-06 09:39:19 +00:00
Jurgen (jugj) fb320856c0 [IMP] (website_)hr_recruitment : Improve UX
In this PR we'll add the following UX improvements :
- Drop the useless responsible_id field from hr_job
- Include applicant attachments in the meeting when scheduling an interview
- Several tooltip and default value changes
task-3380150

closes odoo/odoo#125932

Related: odoo/upgrade#4808
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-10-06 08:25:19 +00:00
Abderraouf Ghrissi (abgh) 56073896a6 [IMP] project: merge date_deadline and planned_date_end
Before this commit:
- The existing of two dates behaving as and end date for project_task
(date_deadline and planned_date_end) is confusing.

In this commit:
- The main goal is to simplify the interface by having one field/widget
that acts as both the deadline and the end date, instead of having two separate fields.
So we removed planned_date_end (changes can be seen in the enterprise related pr (link at
the end) and changed the date_deadline type from date to datetime in project_task and
report_project_task_user

Related PRs:
Enterprise: odoo/enterprise#40866

task-3084978

closes odoo/odoo#120953

Related: odoo/upgrade#4654
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-06 08:25:14 +00:00
Dossogne Bertrand 8f87e102a9 [IMP] hr_holidays: see future allocations + refactoring
This commit adds the feature to select a date in the future
in order to see future allocations, would it be for accrual plans
granting new allocated days, lost days due to expired allocations
or allocations that are not yet available to the employee.
The date selector only appear when the employee has accrual allocation,
in which case the feature is more relevant.

This feature comes with a major refactoring of hr_holidays
methods to handle some edge cases in the management of leaves.
The refactoring also includes the removal of the 'draft' and 'cancel'
state in allocations.

This commit also removes unused imports and implements some linting fixes.

task-2675380

closes odoo/odoo#108148

Related: odoo/upgrade#4238
Related: odoo/enterprise#35157
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-10-06 08:25:12 +00:00
Julien (jula) 41d135d860 [FIX] web: use correct date in py_date.js
__Current behavior before commit:__
When `context_today()` is in a domain, UTC is used. However this is not
consistent with [the legacy method](https://github.com/odoo/odoo/blob/81183495a07eb5928b29ae56f3f86671234d602c/addons/web/static/src/legacy/js/core/py_utils.js#L232) used before OWL migration.

This has the consequence that filters with this method in their domain
will not behave correctly and use UTC date instead of the actual date
of the user.

__Description of the fix:__
Switch the UTC methods calls to regular ones.

__To reproduce:__
(Reproducible only in Odoo 16, since the old method is still used in 15)
1. Change computer date and timezone so that UTC date is not the same as
your date (e.g. if timezone is CEST, set the hour to 1am)
1. On any record, schedule an activity with the due date to today.
1. In the Activities notifications panel, click on **1 Today**
1. The page display nothing because it will filter by the previous day.

opw-3423316

closes odoo/odoo#137798

X-original-commit: e41dcde8d66c74c8ad114c76ea6ed9c607e04455
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-06 07:12:21 +00:00
Bruno Boi a9a8dd6795 [FIX] web_tour: fix tour tips bad positions
**Before this commit**
1. When passing to the next step the new tour tip target stays
   the same element (could happen in certain conditions through
   owl's dom patching), the tour tip pointer is positionned at the
   [0, 0] bottom-left coordinates instead of near its target.

2. Under certain conditions, when the tour tip pointer's content
   changes, the dimensions of the opened tip is not properly stored
   in the instance of the tour pointer. This lead to a weird looking
   tip when you hover on it, triggering its opening state.

**After this commit**
The above issues are fixed.

closes odoo/odoo#137792

Taskid: 3502704
X-original-commit: f169130a31646dabb201cd4e1e54bbd0754b3fdf
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-10-06 07:12:19 +00:00
Nguyen Hong Quang 495fb457c5 [FIX] website: add missing role in parent elements on submenu
Currently, <ul> and <li> is missing `role` in navbar. This thing can
effect on accessibility point on Lighthouse report.
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role

This PR will fix this problem

closes odoo/odoo#137790

X-original-commit: 21ce76703a9b1496e6824be7aa19946c37cca37c
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-10-06 07:12:16 +00:00
Walid 055b8d2153 [FIX] website_sale_comparison: restore compare button
Exact steps (or video) to reproduce the issue (on runbot):
1. Go to Website > Shop > Open a product with specifications table (Customizable Desk).
2. Open Editor > Set Specification to None > Compare button is removed from Product page

Fix:
display the compare button under add to cart if spec disabled

opw-3329219

closes odoo/odoo#137775

X-original-commit: 95e0be822fab3596b2baa8b19e0a9c1728096047
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
2023-10-06 07:12:14 +00:00
Djamel Touati ad253ef4c2 [FIX] purchase: set the correct price in alternative PO
Steps to reproduce the bug:
- Create a storable product “P1”:
    - Price at “Wood corner”:
        - $5, min qty =1
    - Price at “Open wood:
        - $6, min qty = 1
        - $4, min qty = 10

- Create a purchase order at wood corner:
    - 100 units
> the price is automatically computed at $500

- Go to Alternative tab in the PO:
   - Create a one for “Openwood” and copy lines

Problem:
The price for 100 units is computed as $600 instead of $400.

When we create the alternative purchase order, in the "create" function
of “purchase.order.line,” we receive only the quantity as "qty=100" in
the values. Therefore, the missing fields should be prepared.

https://github.com/odoo/odoo/blob/a9cbd2a2ae2e21f1ba14379aecd908c44497b8ab/addons/purchase/models/purchase.py#L1102

https://github.com/odoo/odoo/blob/a9cbd2a2ae2e21f1ba14379aecd908c44497b8ab/addons/purchase/models/purchase.py#L1102

First, the line is created with the received values (“qty=100”), and
the price_unit is computed correctly as $4.

https://github.com/odoo/odoo/blob/a9cbd2a2ae2e21f1ba14379aecd908c44497b8ab/addons/purchase/models/purchase.py#L1400

So, the price_unit is computed correctly at $4

However, the “onchange_product_id” function is then called, resetting
the price_unit and product_qty to 0.

https://github.com/odoo/odoo/blob/a9cbd2a2ae2e21f1ba14379aecd908c44497b8ab/addons/purchase/models/purchase.py#L1401

https://github.com/odoo/odoo/blob/a9cbd2a2ae2e21f1ba14379aecd908c44497b8ab/addons/purchase/models/purchase.py#L1176

Afterward, the “_suggest_quantity()” function is called

https://github.com/odoo/odoo/blob/a9cbd2a2ae2e21f1ba14379aecd908c44497b8ab/addons/purchase/models/purchase.py#L1180

suggesting a minimal quantity based on the seller (so=1).

https://github.com/odoo/odoo/blob/a9cbd2a2ae2e21f1ba14379aecd908c44497b8ab/addons/purchase/models/purchase.py#L1363

Therefore, the price_unit is computed based on qty=1, resulting in $6.

Finally, the price is returned because it is the only missing field.

opw-3497825

closes odoo/odoo#137774

X-original-commit: 0781198f1b5e5d6a4e2722ea3c663b74fb131bc3
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-10-06 07:12:13 +00:00
Brice bib Bartoletti a5f01f9d7a [IMP] l10n_dk_oioubl: allow import
The aim of this commit is to allow import of OIOUBL einvoice.

Documentation source: https://oioubl.info/classes/en/index.html

The test xml files are those provided in the OIOUBL documentation.
The testing xml files are those provided by the Danish administration
with the documentation.
You can download the documentation here: https://oioubl.info/documents/en/allpdf.zip
The xml are in the folder "Eksempelfiler".

closes odoo/odoo#137758

Task-id: 3420748
X-original-commit: b6a060b60e6755af4e6029eb7b23d417a3c4a774
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-10-06 07:12:12 +00:00
Brice bib Bartoletti b818c83e9c [FIX] l10n_account_edi_ubl_cii_tests: wrong variable name
I introduced a wrong variable name in commit 70f252ed99c6c9596cd909bede8ef21cdd0df718

I believed `get_resource_path` was wrongly named and retrieved a file
but `etree.parse` is actually retrieving the file by itself.

Task-id: 3420748
X-original-commit: 3954a517eab1cef6154414fa40f8c730071b987a
Part-of: odoo/odoo#137758
2023-10-06 07:12:12 +00:00
Brice bib Bartoletti ecaa7833af [FIX] account_edi_ubl_cii: ubl2.0 import tax retrieving
During the work done on OIOUBL einvoice import, we saw that the
`Percent` node is always located below a `TaxCategory` node in UBL 2.0.

Task-id: 3420748
X-original-commit: 71d8bf93be472bdcf232e25e42f818e2df89cf8b
Part-of: odoo/odoo#137758
2023-10-06 07:12:12 +00:00
Walid 5cf635f55f [FIX] mrp: SN sequence
Since commit[1] Serial number sequence rule takes priority over already
existing Serial numbers

Bug:
when disabling default Serial number sequence rule a validation error
is thrown since lot name is now empty

Fix:
fall back on the previous behaviour (get next SerialNumber) if sequence
is not set
(also added a clearer user error if neither is set)
note also updated the .pot file

opw-3514794
[1]:https://github.com/odoo/odoo/pull/134187

closes odoo/odoo#137756

X-original-commit: 68d670a27be7baaaf53b0cf491234f8e0453d7f2
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
2023-10-06 07:12:11 +00:00
Josse Colpaert 93eae53c6f [IMP] l10n_es_edi_sii/tbai: use l10n_es_is_simplified field
instead of just checking the simplified partner

closes odoo/odoo#136164

Related: odoo/upgrade#5191
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-10-06 07:12:08 +00:00
Josse Colpaert 7756811110 [IMP] l10n_es: add simplified checkbox on invoice
In order to allow in the PoS to put a partner, but
still do a simplified invoice, we added this field
l10n_es_is_simplified so you can force a ticket
instead of having to download the invoice.

This could also be used to only do the check for
a NIF when the invoice is not simplified.

Related to task 3413182

Part-of: odoo/odoo#136164
2023-10-06 07:12:08 +00:00
nikj-odoo 093b2f56fb [FIX] web,sale: Add domain & show action helper when there is no data
In this commit, show action helper when we had not data show in graph view.
same as we have in pivot view.

- add domain for cancelled records to not showing in reporting.

task-3500508

closes odoo/odoo#137735

X-original-commit: a50e73a2ae04fac9fcfea77cbab27e0b5de66fcc
Related: odoo/enterprise#48473
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-10-06 06:14:13 +00:00
Antoine Dupuis (andu) dc3a0994b4 [FIX] l10n_br: Make sure credit notes use same sequence as invoices
Bugfix.
Steps to reproduce:
1. Create a fresh DB with the Brazilian localization.
2. Create a new Credit Note (directly from the menu, not from an
   invoice). Confirm.
3. Observe that you get a ValidationError: "Another entry with the same
   name already exists." because the name of the Credit Note is
   NFe 00000001, and an invoice called NFe 00000001 already exists.

Analysis:
The credit note should be called NFe 00000002, because in Brazil the
same sequences should be used both for invoices and for credit notes of
a given document type.
However, because the `refund_sequence` field is set to True on the
'Customer Invoices' journal, the sequence mixin doesn't consider
invoices and credit notes as using the same sequence, and therefore
doesn't consider the existing invoice when finding a new name for the
credit note.

Solution:
Set the field `refund_sequence` to False on the journal created by the
l10n_br template.
We also take the opportunity to move the code that provides a default
name to the demo invoices to a separate file demo/account_demo.py, for
consistency with other localizations.

closes odoo/odoo#137700

Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-10-06 06:14:09 +00:00
Claire Bretton (clbr) 2a4bdce1a7 [FIX] account: wrong date method in account_move_send cron
Switch to a datetime to avoid a wizard that has been created
at 00:00 to be deleted one minute later.

closes odoo/odoo#137697

X-original-commit: 128e3da4807acbc2275c7e4db3833ce062afae24
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
2023-10-06 06:14:07 +00:00
Anita (anko) 50af195669 [FIX] sale: report grouping fix
Group by "Product" was grouping by product
variant instead of product template.
Grouping by "Product Variant" is added.

closes odoo/odoo#137690

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-10-06 06:14:06 +00:00
maad-odoo 0a5e138b32 [FIX] mail: activities creation date according to user timezone
Before this commit:
When any activity was created, the displayed created date was in UTC time
and not adjusted to the user's timezone. The time was not converted
according to the user's timezone.

After this commit:
The activity's created time now displayed is converted from the UTC time
stored during the activity's creation.

task-3483695

closes odoo/odoo#137684

X-original-commit: d016456c72d7927c10120a556adce9e73227523a
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-10-06 06:14:05 +00:00
Didier (did) f1abc4e4f3 [FIX] mail: selfFollower should be included in the followers
Before this PR, the current user was not considered has a follower, regarding
the mention suggestions.
This lead him to be lower than other entries.
This PR fix the issue by adding him back to the follower list.

Task-3531111

closes odoo/odoo#137583

X-original-commit: 50a785fedc5b5c7fd826548e52385bdf458c97a2
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Didier Debondt (did) <did@odoo.com>
2023-10-06 06:14:04 +00:00
Valentin Vallaeys (vava) 8e3ffe7800 [IMP] sales: add discount on SOL in kanban
Before this commit, the discount was not displayed on SOL in mobile
view.

This commit adds the discount when it exists.

task-3111127

closes odoo/odoo#137416

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-10-06 06:14:02 +00:00
hupo-odoo 45b95c12db [IMP] account_report: new option for favorite filters
Adds a new boolean field on accounting report to enable the user to select user-defined filter on accounting reports. If activated, the user can visualize its own favorite filter (defined on journal items list view) on a new option selector on top of accounting reports (see enterprise commit). When selected, the domain of the user-defined filter is added to other selected options' domain.

task-3444246

closes odoo/odoo#134966

Related: odoo/enterprise#47200
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-10-06 06:14:00 +00:00
oco-odoo 791bbfc7c6 [IMP] account: reports: introduce current_groupby field
This field is needed by the enterprise counterpart of this commit. It is used to store custom-defined groupby on the report lines without overriding the standard value that's given in data files.

Task 3413437

closes odoo/odoo#133830

Related: odoo/enterprise#46657
Signed-off-by: John Laterre (jol) <jol@odoo.com>
2023-10-06 06:13:59 +00:00
Odoo's Mergebot ae01d6488d [REF] mail, various: simplify 'mail.tracking.value' model, keep trackings at field removal
PURPOSE

Simplify 'mail.tracking.value' model and code. Remove unnecessary fields and
computation. Make code easier to handle and more batch-enabled. Keep tracking
when removing fields.

SPECIFICATIONS

Remove 'tracking_sequence' on tracking values in DB. Consider insertion order
should be done accordingly and display them based on ID DESC. Sequence is now
used only for order records to insert in DB and can be used to resequence
them using the field description at any time. Feature is still the same (order
based on sequence) but without having to store the sequence itself. It was
never updated anyway.

Remove 'field_desc' and 'field_type' from 'mail.tracking.value' model. Those
can be retrieved when necessary, as it is mainly used for frontend display
in Chatter.

Remove 'old_value_monetary' and 'new_value_monetary' as float value can be
used instead.

Rename 'field' to 'field_id' to better indicate it is a m2o, and not a char
field holding a field name.

When removing fields set the field to False instead. Add a new field to
store fields information allowing to keep name, type and groups information
to allow displaying removed tracking values. Use this field only when a
field is removed to avoid duplicating field information when not necessary
and polluting the table.

Improve support of o2m / m2m tracking.

Cleanup overall tracking code: try to make methods more consistent with I/O,
cleanup formatting methods.

While working on tracking, let us cleanup a bit tests and various code
bits.

Task-3345979 (Mail: Simplify tracking model)

closes odoo/odoo#124182

Related: odoo/upgrade#4747
Related: odoo/enterprise#42131
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-10-06 06:13:55 +00:00
Thibault Delavallée a88381cc12 [IMP] mail: keep tracking when unlinking fields
RATIONALE

Currently when an ir.model.fields is removed all tracking linked to it is
lost. Indeed field is required and has an ondelete cascade attribute set
to it. However we should keep tracking values as those made sense when
used and one could want to have access to this information.

SPECIFICATIONS

When removing fields set the field to False instead. Add a new field to
store fields information allowing to keep name, type and groups information
to allow displaying removed tracking values. Use this field only when a
field is removed to avoid duplicating field information when not necessary
and polluting the table.

Task-3499067 (Mail: keep tracking when unlinking fields)

Part-of: odoo/odoo#124182
2023-10-06 06:13:55 +00:00
Thibault Delavallée e147d35590 [REF] mail: rename 'field' to 'field_id' on tracking value
PURPOSE

Simplify 'mail.tracking.value' model and code. Remove unnecessary fields and
computation. Make code easier to handle and more batch-enabled.

SPECIFICATIONS

Rename 'field' to 'field_id' on tracking model. It better indicates it is a
many2one and not a char field holding a field name for example.

Task-3345979 (Mail: Simplify tracking model)

Part-of: odoo/odoo#124182
2023-10-06 06:13:55 +00:00
Thibault Delavallée b2d7f03398 [REF] mail: remove 'monetary' values from tracking value, use float
PURPOSE

Simplify 'mail.tracking.value' model and code. Remove unnecessary fields and
computation. Make code easier to handle and more batch-enabled.

SPECIFICATIONS

Remove 'old_value_monetary' and 'new_value_monetary' fields on tracking model.
Float fields can be used instead as anyway what is important is the type
of value stored, not their actual purpose.

Task-3345979 (Mail: Simplify tracking model)

Part-of: odoo/odoo#124182
2023-10-06 06:13:55 +00:00
Thibault Delavallée 6aa0a25df7 [REF] mail: remove 'field_{desc/type}' from tracking value
PURPOSE

Simplify 'mail.tracking.value' model and code. Remove unnecessary fields and
computation. Make code easier to handle and more batch-enabled.

SPECIFICATIONS

Remove 'field_desc' and 'field_type' from 'mail.tracking.value' model. Those
can be retrieved when necessary, as it is mainly used for frontend display
in Chatter.

Task-3345979 (Mail: Simplify tracking model)

Part-of: odoo/odoo#124182
2023-10-06 06:13:55 +00:00
Thibault Delavallée b4cb36ed80 [REF] mail: remove 'sequence' on tracking value, use insert order
PURPOSE

Simplify 'mail.tracking.value' model and code. Remove unnecessary fields and
computation. Make code easier to handle and more batch-enabled.

SPECIFICATIONS

Remove 'tracking_sequence' on tracking values in DB. Consider insertion order
should be done accordingly and display them based on ID DESC. Sequence is now
used only for order records to insert in DB. Feature is still the same (order
based on sequence) but without having to store the sequence itself. It was
never updated anyway.

Task-3345979 (Mail: Simplify tracking model)

Part-of: odoo/odoo#124182
2023-10-06 06:13:55 +00:00
Thibault Delavallée eea8e584fc [IMP] mail: raise when tracking an unsupported type / unknown field
Currently tracking an unsupported field type simply skips the field. As code
has been cleaned and natively support 2many fields we consider tracking should
be done only on supported fields. Otherwise people might wonder why tracking
does not work.

We now raise when the type is not supported, which is currently the case for
html fields. As they may contain lot of data it is better to think of a
specific tracking based on history / diff than logging old / new value.

When the field does not exist on model, instead of returning None we now
raise. Indeed return value was not consistent and 'None' is not something
people expect as tracking values. If the field does not exist tracking should
clearly say it, as it indicates a model issue somewhere.

Task-3345979 (Mail: Simplify tracking model)

Part-of: odoo/odoo#124182
2023-10-06 06:13:54 +00:00
Thibault Delavallée 6344fc7d50 [REF] mail, various: fix and test 2many fields tracking
PURPOSE

Simplify 'mail.tracking.value' model and code. Remove unnecessary fields and
computation. Make code easier to handle and more batch-enabled.

SPECIFICATIONS

In old times, 'account' and 'project' supported 2many fields tracking. Then
it was moved directly into 'mail'. Thanks to precommit hooks and complete
record access for relational fields, it is now possible to track 2many
fields.

In this commit we cleanup odoo/odoo@167944cc93 that landed during work on this task and
add some tests to be sure it is effectively covered.

Task-3345979 (Mail: Simplify tracking model)

Part-of: odoo/odoo#124182
2023-10-06 06:13:54 +00:00
Thibault Delavallée 11289fd128 [REF] mail: cleanup 'mail.tracking.value' model code
PURPOSE

Simplify 'mail.tracking.value' model and code. Remove unnecessary fields and
computation. Make code easier to handle and more batch-enabled.

SPECIFICATIONS

SPEC 1: prepare all tracking values at same code place

Delegate all computation of tracking values into the 'create_tracking_values'
method. Curently part of it (currency field) is done in the caller. Better
split code per feature.

Method is also made private, as it is not required to expose it.

SPEC 2: cleanup tracking value formatting methods and calls

Code used to display tracking value can be simplified: remove unnecessary
wrappers, make code easier to read, avoid composition of field name but
use a mapping instead (easier to grep 'old_value_char' when it is effectively
used).

Ensure code always calls '_tracking_value_format' to ease future improvements
and have all formatting code being batch-enabled.

SPEC 3: simplify Chatter formatted value structure

'fieldType' is currently added in old and new values. As it is a field
property it can be moved higher in the formatting result to be included
only once. Also add 'fieldName', the column name, to the formatted results
as it will soon help various tool methods. Moreover it makes sense to have
the source of the tracking as the real column name, in addition to its
string and type.

Task-3345979 (Mail: Simplify tracking model)

Part-of: odoo/odoo#124182
2023-10-06 06:13:54 +00:00
Thibault Delavallée c40053bc28 [IMP] test_mail: cleanup tracking tests
When possible, use '@users' decorator. Rename tests to better match their
main purpose, notably

  * test_mail_track*: mail_track specific (specific fields, display)
  * test_message_track*: overall behavior of 'message_track', notably subtypes,
    template usage, ...

Add some additional tests and improve test coverage, as some field types
were not covered (date, datetime, text notably). Improve currency
check for monetary fields.

Move 'mail.tracking.duration.mixin' tests into the file testing mixins
linked to 'mail.thread', rename the Case class according to current test
guidelines.

Also starting from now, `MailCommon` flushes tracking automatically at
setup time, allowing to remove some custom flush done in tests. That way
tests are less prone to non deterministic errors. This implies some changes
in execution of tests, which means some updated query counters notably.

Task-3345979 (Mail: Simplify tracking model)

Part-of: odoo/odoo#124182
2023-10-06 06:13:54 +00:00
Odoo's Mergebot 00f0e65740 [MERGE][REF] mass_mailing: improve subscription portal
PURPOSE

Overall cleaning of subscription and exclusion management code from portal.
This code comes mainly from v12 and can now benefit from cleaning and update.

Globally improve usability and features given by mailing portal about exclusion
list and opt-out management.

SPECIFICATIONS

Cleanup access control (hash usage, returned / raised errors). Globally check
security and usage of controllers.

Refactor JS to be finally using frontend widgets. Split it into sub-widgets to model
main parts of the unsubscribe portal: feedback sending, email blocklist management
and opt-out from mailing lists.

Improve usability of unsubscribe portal, notably

  * allow to give a feedback when unsubscribing from mailing not related to
    mailing lists. It was previously limited to mailings done on mailing lists.
    Now the feedback is allowed in all cases and posts it on the related
    document;
  * clean display of opt-in and opt-out lists;
  * display all public lists, even if not already join. This allows to opt-in
    to new lists, which was not possible before;
  * switch on a neutral name for non public lists (as they may contain
    marketing hints);
  * give UI feedback to customer when using buttons: add confirmation of
    block list addition / removal, of updated subscriptions, ...
  * globally improve wording;

Add a generic 'my' page for mailing, allowing logged users to control their
blocklist status and mailing lists.

Improve feedback sending. Messages and notes are improved to have a
better wording and links to contextual records when possible (mailing,
mailed records, contacts, ...). Add opt out reasons when updating
subscriptions or block list status. This allows to better report on common
causes.

LINKS

Task-2669037 (Mass Mailing: Refactor js/portal for subscription)
Task-2150462 (Mass Mailing: Improve subscription management)

closes odoo/odoo#86084

Related: odoo/upgrade#3327
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-10-06 06:13:53 +00:00
Thibault Delavallée 42d896f8ef [FIX] mass_mailing: this is not deterministic
Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée 85f76cd077 [IMP] mass_mailing: ease unsubscribe page edition for mailing users
PURPOSE

Globally improve usability and features given by mailing portal about exclusion
list and opt-out management.

SPECIFICATIONS

Ease unsubscribe page preview and edition. 'unsubscribe_from_list' generic
unsubscribe link now redirects to '/mailing/my' page, allowing to see what
an unsubscription page looks like. Empty sections are also added to ease
editor usage.

No real unsubscription preview can be done from 'unsubscribe_from_list' link
displayed in a mailing body as the mailing could not exist when clicking on it.
Moreover it would require custom code to redirect from this generic link to
the real unsubscription page, for few real added value.

Tweak access to allow mailing users to access a mailing given its non-protected
'mailing/<id>/unsubscribe' link. It is not linked to any backend document
(like specific document mailed, ...) but allows to display the page, edit
it, ...

Tweak 'mailing/<id>/view' to allow to generate the non-protected unsubscribe
link. It allows a mailing user to "view" a mailing, then click on "unsubscribe"
and land on the unsubscribe page, without having to deal with document_id
and tokens.

Task-2150462 (Mass Mailing: Improve subscription management)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée c0775de8d0 [IMP] mass_mailing: add unsubscribe headers in mailing emails
PURPOSE

Globally improve usability and features given by mailing portal about exclusion
list and opt-out management.

SPECIFICATIONS

Add unsubscribe headers to email sent by mass mailings. As emails are already
parsed to change the generic 'unsubscribe_from_list' link to an email-specific
link we can add the List-Unsubscribe header at the same time. Add header for
post 'List-Unsubscribe=One-Click' to avoid one-click unsubscribe when readers
crawl email links.

Task-2150462 (Mass Mailing: Improve subscription management)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée b4d7eda6e0 [REF] mass_mailing: improve feedback, add reasons
PURPOSE

Globally improve usability and features given by mailing portal about exclusion
list and opt-out management.

SPECIFICATIONS

Messages and notes are improved to have a better wording and links to contextual
records when possible (mailing, mailed records, contacts, ...).

Add opt out reasons when updating subscriptions or block list status. This
allows to better report on common causes.

For that purpose we introduce a new model allowing to store those reasons.
A boolean flag allow to trigger the usage of the feedback textarea in portal
page.

Task-2150462 (Mass Mailing: Improve subscription management)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée b897571b9f [REF] mass_mailing: rename subscription model
PURPOSE

Overall cleaning of subscription and exclusion management code from portal.
This code comes mainly from v12 and can now benefit from cleaning and update.

SPECIFICATIONS

In this commit we rename ``mailing.contact.subscription`` model into the
shorter ``mailing.subscription``. This is sufficient to explain the model
purpose. As we plan to add an opt-out model this also allows to have sub
models with suffixes without being too long.

We also rename ``subscription_list_ids`` field on contact model to
``subscription_ids`` as this is shorter and clearer.

Finally the ``mailing_contact_list_rel`` table name that comes from old
implementations (simple m2m table) is renamed to ``mailing_subscription``
to match the model name.

Task-2669037 (Mass Mailing: Refactor js/portal for subscription)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée d27797dd9b [REF] mass_mailing: add a 'my' page to handle subscriptions
PURPOSE

Globally improve usability and features given by mailing portal about exclusion
list and opt-out management.

SPECIFICATIONS

Currently mailing portal is usable only through dedicated links added in
mailings. Those use a hash token based on mailing, document_id (if mailing
ran on business documents) and email of the recipient. However this is not
convenient, especially for users that want to update their subscriptions
manually.

Purpose of this commit is to add a generic page in mass mailing allowing
to manage subscriptions to mailing lists as well as blocklist status directly
from portal. That way people don't need to come from a given email mailing
link.

A new page is added. It is located on ``mailing/my`` and has the same
capabilities as the unsubscribe pages, except it works outside of a given
mailing contact. Page (html, js) and behavior are shared among the various
use cases.

This page is available for logged user, both internal and share. Other people
should come through existing unsubscribe links using email, document id and
hash token.

Access control is updated so that it is now possible to use mailing routes
without requiring always email / document_id / hash_token. User can be used
instead.

A tour is added allowing to test this new feature.

Task-2150462 (Mass Mailing: Improve subscription management)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée 8019a605c7 [REF] mass_mailing: update route parameters
PURPOSE

Overall cleaning of subscription and exclusion management code from portal.
This code comes mainly from v12 and can now benefit from cleaning and update.

SPECIFICATIONS

Rename route parameters to be more clear about their usage. Notably res_id
is better labelled document_id, token is a hash_token, ...

Update legacy to still support old routes.

Task-2669037 (Mass Mailing: Refactor js/portal for subscription)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée be3c92d805 [REF] mass_mailing: improve portal subscription management page
PURPOSE

Globally improve usability and features given by mailing portal about exclusion
list and opt-out management.

SPECIFICATIONS

Purpose of this commit is to cleanup and improve the portal subscription page
that allows to manage subscription to mailing lists and blacklist status.

Main features updated or added

  * allow to give a feedback when unsubscribing from mailing not related to
    mailing lists. It was previously limited to mailings done on mailing lists.
    Now the feedback is allowed in all cases and posts it on the related
    document;
  * clean display of opt-in and opt-out lists;
  * display all public lists, even if not already join. This allows to opt-in
    to new lists, which was not possible before;
  * switch on a neutral name for non public lists (as they may contain
    marketing hints);
  * give UI feedback to customer when using buttons: add confirmation of
    block list addition / removal, of updated subscriptions, ...
  * globally improve wording;

Unsubscribe from a document now uses the same layout as unsubscribe from
mailing lists. Indeed the first one blacklists the email while the second
one opt-outs from mailing lists. But overall form is the same and options
are also the same. After all previous cleaning we can now keep a single
page for everything.

Task-2150462 (Mass Mailing: Improve subscription management)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée 11e813d7f3 [REF] mass_mailing: cleanup subscriptions update (optin / optout from lists)
PURPOSE

Overall cleaning of subscription and exclusion management code from portal.
This code comes mainly from v12 and can now benefit from cleaning and update.

SPECIFICATIONS

Purpose of this commit is to cleanup code that manages chosen lists from
portal and updates opt-in and opt-out accordingly.

Code is now located on mailing list model. When opting-it, new subscriptions
have to be created for mailing lists so that email is part of the list. When
opting-out we just have to toggle the opt_out flag on subscription model.

Logged messages are also improved. We log on contact model the updated
mailing lists for opt-in or opt-out.

Task-2669037 (Mass Mailing: Refactor js/portal for subscription)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée 32e3917b35 [REF] mass_mailing: rewrite subscription management JS
PURPOSE

Overall cleaning of subscription and exclusion management code from portal.
This code comes mainly from v12 and can now benefit from cleaning and update.

SPECIFICATIONS

Purpose of this commit is to get rid of old declarative javascript used in
mass mailing. It is still using old fashioned JS, not using widget or any
standard way of doing JS-based behavior in Odoo.

In this commit we introduce a main widget that manages the subscription page.
It has 3 sub widgets to manage parts of its features

  * blocklist management: add or remove current email from exclusion list.
    Adding an email in exclusion list is doable only if activated in settings;
  * feedback: allow user to give their feedback. It currently logs on target
    model, based on a hardcoded search on 'email_normalized' field. This is
    strange as not all models have a normalized email field, but who am I
    to judge anyway ?
  * subscription management: allow to opt-in and opt-out from mailing lists;

This commit mainly keeps the current behavior, just rewrites the JS part.
Some further feature or UI update will move into sub-widgets in subsequent
commits.

Some Markup issues are also fixed in this commit, as code is already updated.

Task-2669037 (Mass Mailing: Refactor js/portal for subscription)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00