Commit Graph
142747 Commits
Author SHA1 Message Date
Ivan Yelizariev 00a8f2457f [FIX] core: fix formatting issues for --test-tags docs
`./odoo-bin -h` prints unnecessary spaces between sentences.

---

task-2431630
Finetuning of #71130

closes odoo/odoo#71364

X-original-commit: fcc60e219fd024394f8642509a20755f964546b6
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-05-27 17:30:36 +00:00
Jacky (trj) b98e946aea [FIX] point_of_sale: added copy=False in uuid of pos_config
uuid should be unique even after copying

closes odoo/odoo#71247

X-original-commit: 5ea1d31df9041ca7b25fbea6178e798e62bebca0
Related: odoo/enterprise#18520
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-05-26 09:07:17 +00:00
Jacky (trj) e921a2f2ce [REF] point_of_sale + pos_restaurant: adjusted code for German POS localization
These changes have been made to be able to add some behaviors in some specific points of the flow when overridden.

X-original-commit: 455f49fe74611849ee1ff6addc875352d1b6c386
2021-05-26 09:07:17 +00:00
Alvaro FuentesandChristophe Simonis 0a96e7b90c [FIX] core: correct imports from odoo.addons.base.maintenance.migrations
This legacy package was supposed to be an alias to `odoo.upgrade`.
However, depending on how your import its sub-packages (and in which
order), we were ending with the module being loaded multiple times,
breaking the expectation of a singleton.

```python
In [1]: from odoo.addons.base.maintenance.migrations import util as m1

In [2]: import odoo.addons.base.maintenance.migrations.util as m2

In [3]: m1
Out[3]: <module 'odoo.upgrade.util' from '/Users/chs/devel/odoo/odoo/stable/odoo/addons/base/maintenance/migrations/util.py'>

In [4]: m2
Out[4]: <module 'odoo.addons.base.maintenance.migrations.util' from '/Users/chs/devel/odoo/odoo/stable/odoo/addons/base/maintenance/migrations/util.py'>

In [5]: from odoo.addons.base.maintenance.migrations import util as m3

In [6]: m3
Out[6]: <module 'odoo.addons.base.maintenance.migrations.util' from '/Users/chs/devel/odoo/odoo/stable/odoo/addons/base/maintenance/migrations/util.py'>

In [7]: m2 == m3
Out[7]: True

In [8]: m1 == m3
Out[8]: False

In [9]:
```

Now, with this import hook, we ensure that the modules imported from
`odoo.addons.base.maintenance.migrations` are aliases to ones imported
from `odoo.upgrade`.

```python
In [1]: import odoo.addons.base.maintenance.migrations.util as m2

In [2]: m2.__name__
Out[2]: 'odoo.upgrade.util'
```

closes odoo/odoo#71351

X-original-commit: 0d0458a0f370f872caacac26361f2c4730c2cbba
Signed-off-by: Christophe Simonis <chs@odoo.com>
Co-authored-by: Christophe Simonis <chs@odoo.com>
2021-05-27 15:41:24 +00:00
Sébastien Theys c6716847aa [IMP] web, *: clean up notification API
task-2476867

closes odoo/odoo#67009

Related: odoo/enterprise#16760
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-05-27 13:47:23 +00:00
nie 3b5bef08ad [FIX] website: remove non-fictional number from templates
Steps:
- Go to Website
- Click "Go to Website"

Bug:
The default phone number on the website is not fictional and may cause
unwanted spam.

Explanation:
In North America, only 555-0100 through 555-0199 are specifically
reserved for fictional use.
> The industry also reserved a block of 100 numbers as fictitious,
> non-working numbers (555-0100 through 0199) for use by the
> entertainment and advertising industries.

Source: https://www.nationalnanpa.com/pdf/NRUF/ATIS-0300115.pdf

opw:2530388

closes odoo/odoo#71341

X-original-commit: 37be09d7d73bd4942396f06f5b5cfa22cca78f56
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-05-27 13:25:20 +00:00
Adrien Widart 493fc880d1 [FIX] mrp: use work center's TZ to plan operations
When planning a Manufacturing Order, if an operation takes place in work
center with a different time zone, the computed date may be incorrect
(the start date may be outside the working hours)

To reproduce the error:
(Use demo data. Current timezone: Europe/Brussels)
1. In Settings, enable "Work Orders"
2. Open an existing Work Center
3. Click on "Standard 40 hours/week"
4. Set Timezone to "Asia/Bangkok"
    - Note that all slots are between 8:00-12:00 and 13:00-17:00
5. Create two storable products P_compo and P_finished
6. Create a Bill of Materials BM:
    - Product: P_finished
    - BoM Type: Manufacture this product
    - Components: 1 x P_compo
    - Operations: 3 x Operation with existing work centers
7. Create a Manufacturing Order:
    - Bill of Material: BM
    - Quantity: 100
8. Save, Confirm, Plan

Error: (it depends on the time the test is done) The 'Scheduled Start
Date' of the second operation is incorrect. Adding the time zone
difference gives a time that is outside the work center's timetable
(i.e., outside 8:00-12:00 and 13:00-17:00).

The computations do not consider the time zone of the work center.

OPW-2393330

closes odoo/odoo#71332

X-original-commit: dab24e497f095d0c7857f07d037e9cb16749e2ea
Related: odoo/enterprise#18572
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-05-27 12:23:37 +00:00
Sébastien Geelen (sge) eb1fa6d2a9 [FIX] web_editor : remove duplicate focus() declaration
closes odoo/odoo#71319

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-05-27 09:17:36 +00:00
Mohammed Shekha dff8d83027 [IMP] web: tabbing out of an empty m2o should not set a value
Before this commit, when the use focused a many2one field and then
pressed tab, the first item of the autocomplete dropdown was selected.

This is not what we want if the user didn't write anything in the input,
and if he didn't use the up/down keys to highlight a specific item of
the dropdown.

This commit ensures that we only select the highlighted item when the
user presses tab if he previously wrote something in the input (which
hasn't been emptied meanwhile) or if he used the up/down keys to select
a specific item.

task-2455781

closes odoo/odoo#66443

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-05-27 07:01:25 +00:00
Ivan Yelizariev 691fa54cc8 [IMP] core: clarify docs about config --test-tags
Technical name is not added to test_tags since https://github.com/odoo/odoo/commit/95b4f2ab4b5698ab3a28c9c35ac8da6fb6def983

at_install tag is added by default since introducing @tagged decorator: https://github.com/odoo/odoo/commit/b356b190338e3ee032b9e3a7f670f76468965006

Clarify how special tags at_install/post_install work.

Also, add dots for @tagged doc, because otherwise we have a mess in sphinx docs.

---

task-2431630

closes odoo/odoo#71329

X-original-commit: e4bf1e7dca2a9ef6dabf3f201d086ae77ff993d9
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-05-27 11:32:05 +00:00
Yannick Tivisse 7880185883 [FIX] l10n_be_hr_payroll: Lower SQL requests on payslip computation
closes odoo/odoo#71151

Related: odoo/enterprise#18431
Related: odoo/upgrade#2471
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-05-26 11:34:36 +00:00
std-odoo 1b8c4d98d3 [REV] mail: fix a traceback when sending a message in a "email channel"
Bug
===
Since 4da64b3f3c , if multiple users of
different companies are in the same channel, and if the type of the
channel is "email", a traceback is raised when sending a message.

Technical
=========
"with_user" drop the SU flag and is not enough to bypass the multi
company ACLs. Moreover, we do not want to send a "channel_seen" bus
notifications and we can mark the message as seen on the JS side
directly.

Changes
=======
So now, the traceback is not raised anymore in that case, and the
message is marked as seen if the receiver has the web client open.

But, if the receiver has not the web client open, when he will login,
the message will not be marked as seen. This can be improved but at the
moment we just want to revert the fix that cause the traceback and fix
the issue in most cases.

Task 2427790

closes odoo/odoo#71320

X-original-commit: 8b5de95bea0087c48d17f40847750eb31fe97caf
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-27 09:26:10 +00:00
jbw edd058c195 [FIX] account: set default_partner_id to bank_partner_id for partner_bank_id
Change “default_partner_id” from “commercial_partner_id” to “bank_partner_id”
for “partner_bank_id” field in from view. If not, on an invoice, a newly created
partner bank (via “Recipient Bank” field) would be created for the partner
instead of the current company.

closes odoo/odoo#71312

Task: 2524441
X-original-commit: e18e256137e4593aee0cb6f1d0fcc4168dff79c1
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: jbw-odoo <jbw-odoo@users.noreply.github.com>
2021-05-27 08:37:52 +00:00
Robin Heinz 340cbe3cde [FIX] point_of_sale: Fix down/up rounding
While using the cash rounding, there were issues when rounding up and down.
The pre filled amount was correct but the rest of the transaction was wrong. (Wrong due, wrong change,...)
This commit re calculate the rounding applied when using up or down payment.

closes odoo/odoo#71298

X-original-commit: bfccdf07adba35a5838a35a7bba98a1d71c67d2f
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-05-26 17:52:30 +00:00
Robin Heinz 0042439be9 [FIX] point_of_sale: Load all existing Payment Method but displayed linked ones
Before, when using the manage order, if a payment method was used and then removed from the pos.config,
we couldn't load the old order anymore because of unknow reference.
To fix this, we load all methods at the opening of the pos but when we display the payment methods we only show those in the pos.config.

closes odoo/odoo#71292

Task-id: 2541708
X-original-commit: e44219b1cdb80d37b557ff74767f5f3e5aca5072
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-05-26 17:11:13 +00:00
Jigar Vaghela 83222bee07 [FIX] l10n_in: decrease a value of B2CS and HSN in case of refund
Before this commit:

  B2CS is not decreased in case of refund but it's shown in CDNUR but CDNUR has a condition that only shows a refund of B2CL.
  HSN value is not decreased in case of refund

After this commit:

  Refund is decreased from B2CS and not show that in CDNUR
  HSN value is decreased in case of refund

B2CS = Business to Consumers Small
B2CL = Business to Consumers Large (invoice value is more than Rs.2.5 lakhs)
CDNUR = Credit/Debit Notes for Unregistered
HSN = Harmonized System of Nomenclature(hsn code per product)

closes odoo/odoo#71225

Opw: 2446769
X-original-commit: 9f6b5b889b9402a391a1215c44ce2c5501e1b5de
Related: odoo/enterprise#18497
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: Jigar Vaghela <jva-odoo@users.noreply.github.com>
2021-05-27 06:52:51 +00:00
Julien CHEVREAU (JCU) acb8bcdf3d [FIX] account: Batch Payment available to Invoicing App
Beforehand, when installing the SEPA DD module, the Accounting App
was also installed, because of a dependency between the batch payment
feature and the account_accountant module.

Now, a bridge module breaks this dependency, and SEPA DD can be used with
the Invoicing App. This means that Batch Payment, being a dependency of
SEPA DD, is available to the Invoicing App.

task-2375697

closes odoo/odoo#65634

Related: odoo/enterprise#16161
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-05-14 12:15:52 +00:00
Younn Olivier 8be18ae0a0 [FIX] website: override footer company name in a separate template
The footer company name override from the website is done in a separate
template from website.layout in order to avoid duplicating it when
edited.

Related to https://github.com/odoo/odoo/pull/69943
task-2468472

closes odoo/odoo#71307

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-05-27 06:39:09 +00:00
nie 395ee66ab8 [FIX] base: remove non-fictional number from demo data
Steps:
- Install Website
- Go to Website
- Click "Go to Website"

Bug:
The default phone number on the website is not fictional and may cause
unwanted spam.

Explanation:
In North America, only 555-0100 through 555-0199 are specifically
reserved for fictional use.
> The industry also reserved a block of 100 numbers as fictitious,
> non-working numbers (555-0100 through 0199) for use by the
> entertainment and advertising industries.

Source: https://www.nationalnanpa.com/pdf/NRUF/ATIS-0300115.pdf

opw:2530388

closes odoo/odoo#71303

X-original-commit: 5a047574dde6b207697244c866749d3cd439922c
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-05-26 18:48:39 +00:00
Fabien Meghazi 24b8a6178d [FIX] server: prevent inotify watches leak
Before this commit the PyInotify filesystem watcher used by the code
autoreload feature (`--dev=reload`) would not get a chance to free
it's inotify watches before the reexec, hence at each reexec triggered
by a code reload the inotify watches where accumulated until potentially
reaching the kernel limit `fs.inotify.max_user_watches`.

This patch ensures that inotify properly closes it's file descriptor
before we reexec:
https://github.com/dsoprea/PyInotify/blob/f77596a/inotify/adapters.py#L79

closes odoo/odoo#71302

X-original-commit: 8703ff1e3d9be6f2f5fce2e8c4e62589b05133fb
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-05-26 18:30:16 +00:00
Younn Olivier c72bc01b36 [FIX] portal: fix copyright color on the portal
Before this commit, for default colors, the text-muted class color was
set as !important from the portal and could not be overriden by the
website, leading to inconsistent display between the website and the
portal for the copyright.

As a fix for stable, we do not change the text-muted color from the
portal when using default colors.

task-2468472

closes odoo/odoo#71300

X-original-commit: d2e934631d4de02a7933434a1252dab994fed4b7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-05-26 17:54:55 +00:00
Sébastien Mottet (oms) b8e336aaae [IMP] website, *: change configurator palette selection
*: web

This commit brings some functionnal changes to the palette selection
screen:

- The list of suggested palettes does not depend on the uploaded logo
anymore. It is now a fixed list of 20 palettes manually chosen among the
existing ones.

- The recommended palette is not chosen among the existing palettes
based on the logo's extracted colors anymore. The recommended palette is
now a fully custom palette generated based on the two main colors
extracted from the logo.

- The selected palette has a border to indicate it is the currently
selected palette.

task-2518565

closes odoo/odoo#71268

X-original-commit: 23dee47ed51d0dfa54f68ef4b328aba957589bb9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-05-26 15:14:43 +00:00
Adrien Widart afda66598c [FIX] mrp: use correct UoM for each component in MO
In a Manufacturing Order, the components' quantities are rounded using
the rounding precision of the produced product's UoM. This leads to
incorrect values.

To reproduce the error:
1. In Settings, enable "Units of Measure"
2. In UoM, edit Units:
    - Rounding Precision: 1
3. Create two products P_finished and P_compo
    - P_compo's Product Type: Consumable
    - P_compo's UoM: L
    - P_finished's UoM: Units
4. Create a Bill of Materials
    - Product: P_finished
    - 1 Component:
        - Product: P_compo
        - Quantity: 0.2
        - UoM: L
5. Create a Manufacturing Order:
    - Product: P_finished
6. Confirm, Mark as Done

Error: Qty to consumes became 0 and consumed qty is 0. Both values
should be 0.2L, but they have been rounded using the rounding precision
of Units

OPW-2529462

closes odoo/odoo#71293

X-original-commit: aff3a2e06801dfb7a58df5180fb4ab5487b27f02
Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-05-26 17:12:08 +00:00
Nicolas Lempereur 55f6d29a3d [FIX] mail,test_mass_mailing: unblacklist with mass mailing
The optimization 2ccf0bd0dc does not take into account that to
"unblacklist" a user, you have the archive the mail.blacklist record so
only mail.blacklist active records need to be taken into account.

Added test without the fix fails with:

    AssertionError: False is not true : MailTrace: email
    test.record.02@test.example.com (recipient res.partner(), state:
    sent, record: mailing.test.blacklist(166,)): found 0 records (1 expected)

opw-2536304

closes odoo/odoo#71277

X-original-commit: 965c67cb16d2a4ac10d35a01da3af311867a47e6
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-05-26 15:35:26 +00:00
Nasreddin (bon) d8244c64d9 [FIX] survey: display right date format in datepicker
Issue

	- Install 'Survey' & 'website' module
	- Enable "es_VE" language and activate on main website
	- Go to Website Homepage
	- Switch to "Spanish (VE)" language (footer)
	- Go to "Survey" module
	- Create a survey:
	- Add a question of type 'Date' then save
	- Click on "TEST" button
	- Start survey and add a date with the datepicker
	- Submit survey

	Error message : 'This is not a date'

Cause

	When submit survey, not using the database date format.

Solution

	When validating form (on submit), check if date is formated
	with database format and (not the moment locale since user can
	alter date and datetime format).

opw-2452237

closes odoo/odoo#71228

X-original-commit: f3c5dd794e4de71187fd7532c39595b2297eb93d
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-05-25 14:39:39 +00:00
Younn Olivier 507408e8e1 [FIX] web, website: display default company name on frontend layout
Before, the "Company name" placeholder was hardcoded in the frontend
layout template, and the user had to change it with his company name
from the website view, which was not user-friendly if the website module
was not installed.

Now, by default, the frontend layout template displays the user's
company name. If the website module is installed, it is editable.

task-2468472

closes odoo/odoo#71176

X-original-commit: 059804be90021559debee6f930462594a3ca8a97
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-05-21 16:56:11 +00:00
Habib (ayh) 6454de7af4 [IMP] account: improve display name of cancelled journal entries
The display name of cancelled entries is "/"
This provides no information to the user - especially when the duplication message is logged.

This aims to improve the display_name of account.move so draft and cancelled entries display the id as a reference

closes odoo/odoo#70764

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-05-17 13:14:16 +00:00
Habib (ayh) 4f437d119e [IMP] account: usability of journal form view
navigation from a journal to its entries improved by adding a smart button
part of task 2478537
2021-05-17 13:14:16 +00:00
Habib (ayh) a684c3e89c [IMP] account: usability and traceability of journal entries
- improve traceability of duplicated journal entries by logging a message in the chatter to trace back to its origin

was task 2478537
2021-05-17 13:14:16 +00:00
nounoubensebia 24d5c789f1 [IMP] mail_plugin, crm_mail_plugin: add translation support for email plugins
In mail_plugin module, add a method which returns translatable modules,
this method will be overridden in the other modules to add their module names.

Translations are prepared via the _prepare_translations method which uses
the get_translations_for_webclient method, this way we can easily fetch
translations without having to write python code.

We also add xml files in "static/", these files contain terms to be translated,
for each plugin we create a separate xml file so that we can easily update each
plugin separately.

This implementation will allow having translations handled by Odoo, which has
several advantages:
- existing system, nothing to develop
- it will use transifex and the terms will be translated by the community
- forces that mail_client implementations to have the same logic (consistency)
- compared to other solutions which rely on python code to return translations,
  this solution is more robust as it avoids having to type the string to
  translate twice

Task-2480075

closes odoo/odoo#69118

Ent-pr: https://github.com/odoo/enterprise/pull/17626
Plugin-pr: https://github.com/odoo/mail-client-extensions/pull/6
Related: odoo/enterprise#17626
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-26 12:51:57 +00:00
Mohammed Shekha ffe768f28e [IMP] hr: support many2many_avatar_employee widget
closes odoo/odoo#67515

Related: odoo/enterprise#17081
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-05-26 14:04:15 +00:00
Mohammed Shekha 8962edf492 [FIX] web: do not show cursor pointer on m2m badge without color
before this commit: when many2mnay_tags widget does not have color_field in
options still hovering over many2many_tags badge shows cursor pointer, while
it should display default cursor and if there is color field given in options
then cursor should be pointer.

after this commit: cursor pointer will be displayed only when color field is
given in options else shod cursor default.

task-2451204
2021-05-26 14:04:15 +00:00
Mohammed Shekha d25459e6cb [IMP] mail,web: add many2many_avatar_user widget to open chat
with this commit, we adds many2many_avatar_user widget to have same behaviour
as many2one_avatar_user where clicking on avatar image opens chat box, so to
have same feature on many2many_tags which is related to res.users we adds
many2many_avatar_user widget.

task-2451204
2021-05-26 14:04:15 +00:00
Tiffany Chang (tic) f46392707d [FIX] stock: fix multi-step immediate transfer receipts
Steps to reproduce:
1. activate routes setting + multi-step incoming shipments (2 or 3,
   doesn't matter)
2. create an immediate transfer receipt
3. add a done quantity (optional: validate)
4. open corresponding 2nd step internal transfer

Expected result:
- amount done in immediate transfer receipt will be demand of internal
  transfer

Actual result:
- demand (and all other values) will be 0

closes odoo/odoo#68885

Task: 2492994
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-05-26 11:51:47 +00:00
Tiffany Chang (tic) e8881ca029 [FIX] stock: don't show "Set Quantities" button when immediate transfer
"Set Quantities" button does not make sense to show for immediate
transfers since there are no quantities to reserve, therefore we hide
it.

Task: 2492994
2021-05-25 15:22:25 +00:00
wan b063473363 [FIX] l10n_cl: module category
Localization modules need to be `Accounting/Localizations/Account Charts`
Because this will install `l10n_generic_coa` otherwise
https://github.com/odoo/odoo/blob/36a9e761c8d6c1c6e9611cc410ecca82ff2b1659/addons/account/__init__.py#L28

closes odoo/odoo#71261

X-original-commit: 2efe50bafbb79a9fc6b53c06c456313fa9b3b5bc
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-05-26 11:43:39 +00:00
Dhruv Patel 885a642a9b [FIX] mail: chat window should remain folded on new message
If the chat window was initially folded and when a new message is received
the chat window automatically unfolds. it is annoying having a window that
pops up each time a new message is coming while having folded it once.
So, It should remain folded when a new message is received if the chat
window is already folded.

Task : 2522141

closes odoo/odoo#71258

X-original-commit: 6e84914a3691735e9c97084cc8d55788babd2ad9
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-05-26 10:56:13 +00:00
newtratip 519535febf [IMP] purchase_requisition: Add archived in purchase agreement types
closes odoo/odoo#71254

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-05-26 09:57:28 +00:00
sofiagvaladze 95daf9d28c [IMP] hr: Create activity a month before Work Permit Expiration Date
Add boolean field to upload work permit

Task - 2442648

closes odoo/odoo#65899

Related: odoo/upgrade#2173
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-05-24 21:40:32 +00:00
Thibault Delavallée 500b845b8a [IMP] mass_mailing_{event/event_track/sale}: add default mailing domains
When performing an email or SMS mailing on functional models a default domain
is a good start to avoid sending notifications to dead records, aka

  * canceled registrations;
  * canceled tracks;
  * canceled sale orders;

Task ID-2431217
COM PR odoo#67322
ENT PR odoo/enterprise#16876
UPG PR odoo/upgrade#2236

closes odoo/odoo#67322

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-26 07:57:47 +00:00
Thibault Delavallée ed508ee1bd [REF] mass_mailing: move mailing capability on model
PURPOSE

Remove hardcoded list of models on which mailing is possible. Indeed it is
not modular and not really smart with enterprise code not being reachable
in community.

SPECIFICATIONS

Replace hardcoded list of models on which mailing (both mail or sms) is
possible by a computed searchable field on ``ir.model`` based on a class
attribute.

It allows to cleanly define models having mass mailing capabilities and add
this attribute in bridge modules (when existing) or directly on base model
definition to avoid bridge modules.

In this commit we introduce a basic ``_mailing_enabled`` class attribute
activating mailing on model.

Mailing models may also have a ``_mailing_get_default_domain`` method allowing
to define a custom default domain when sending a marketing mailing on records
on this class.

Mailing models can now define a ``_mailing_get_opt_out_list(_sms)`` method
allowing to define custom behavior to fetch opt-outed records. Instead of
defining a model-based behavior on Mailing itself, it now calls the model
defined one. We still have two methods, one for mailing and one for SMS
opt out computation as it relies on different underlying models and fields.

LINKS

Task ID-2431217
COM PR odoo/odoo#67322
ENT PR odoo/enterprise#16876
UPG PR odoo/upgrade#2236
2021-05-26 07:57:47 +00:00
Thibault Delavallée 3ffd6acc02 [IMP] mail: concatenate all Base class code in a single override
Merge two overrides of Base into the same file. Just moving code to clean
module, nothing changes functionally or technically.

LINKS

Task ID-2431217
COM PR odoo/odoo#67322
ENT PR odoo/enterprise#16876
UPG PR odoo/upgrade#2236
2021-05-26 07:43:50 +00:00
Alvaro Fuentes 14036869c7 [FIX] core: fix filtered_domain for hierarchical terms
The method filtered_domain() is broken for domains with hierarchical
terms ('child_of'/'parent_of').

To see *one* of the ways the implementation is broken, let `A` be a
model with `parent_id` pointing to `A`, and `a1` a record of model `A`
without parent (`a1.parent_id` is `False`), then this fails:

    assert a1 in a1.filtered_domain([("parent_id", "child_of", a1.id)])

The reason it fails is that on
https://github.com/odoo/odoo/blob/f5519586d214a9b34ad24683a7f97c47802a3bad/odoo/models.py#L5377-L5380
`data` is empty since `a1` has no parent, thus
https://github.com/odoo/odoo/blob/f5519586d214a9b34ad24683a7f97c47802a3bad/odoo/models.py#L5403-L5404
fails, therefore the result of `filtered_domain` is empty.

Note: the implementation of the hierarchical operators is full of quirks
that are hard to emulate otherwise than by reusing the original code.
As a consequence, the current implementation may be broken in more than
one way.

Let's see another way the implementation is broken: let `B` be a model
without a `parent_id` field and with a `friend_id` field pointing
to `B`, and let `b1` be a record of model `B`.  Then

    b1.filtered_domain([("friend_id", "child_of", b1.id)])

throws an exception of the form shown below:

    ValueError: Invalid field 'parent_id' in leaf "<osv.ExtendedLeaf: ('parent_id', 'child_of', 1) ...

Meanwhile the following code is still valid and returs b1:

    B.search([("friend_id", "child_of", b1.id)])

closes odoo/odoo#71237

X-original-commit: e7a5ba95d8b7df5bbf545ef8afe0a1f5d0f70272
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-05-25 18:08:42 +00:00
Thibault Delavallée b1c90b96e1 [FW][FIX] sale, mass_mailing_sms, test_mail_full: correctly support partner-only records
When performing an sms marketing on a model having only a ``partner_id``
field available (aka no ``phone`` or ``mobile``) it crashes due to seen
list computation (aka already contacted recipients). This is due to an SQL
query not taking into account those models as it works only for those with
a phone field.

We fix it as done in ``mass_mailìng`` app, aka fetching information on the
related partner if available.

Some tests for models using a 2many relationships towards recipients are
added. Note that this kind of model does not really support complete SMS
notification, as only the first found partner is notified. Mass SMS on this
kind of model is currently not possible as seen list is not supported. There
is no standard use case of this in Odoo codebase.

Correctly support sms marketing on sale model by defining the necessary
methods. As sale order has only a partner_id field available we have to
correctly override phone related methods for SMS.

LINKS

Task ID-2431217
COM PR odoo/odoo#71140

X-Original-Commit odoo/odoo@987d974ccb

closes odoo/odoo#71178

closes odoo/odoo#71205

X-original-commit: 642816d0a819bf74927ed5aa11b6843cbb97d4df
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-25 14:20:08 +00:00
Thibault Delavallée a274f4a443 [FW][IMP] test_mail_full: add test for SMS mailing default domain and optout
Purpose is to test specific behavior of opt-out for SMS marketing. This is
currently not tested and working a bit strangely, as they are flagged as
blacklist. This will soon be updated in another task but at least current
behavior is logged somewhere.

We also update some test models in order to reflect potential strange and
non-default behavior, notably partner_id field used as contact field. It
will be used soon when cleaning some opt-out behavior.

Tests are added to check phone sanitized is correctly taken into account
in default domains when inheriting from the phone blacklist mixin.

Some counters notes are also updated next to some last updates.

Task ID-2431217
COM PR odoo/odoo#71140

X-Original-Commit odoo/odoo@3ba3054f0a

X-original-commit: a9ac2582eb508daa21fd0d3a5a551261ecc18f8b
2021-05-25 14:20:08 +00:00
Thibault Delavallée dce3fa2fec [FW][FIX] mass_mailing: correctly update list subscriptions when updating contacts
There is a missing depends on subscription_ids fields, meaning it is not
correctly refreshed when contacts are updated. When dealing with m2m using
the o2m model as relational table, depends have to be specified on field
itself to allow recomputing the fields.

Task ID-2431217
COM PR odoo/odoo#71140

X-Original-Commit odoo/odoo@11ffeddf23

X-original-commit: 37bad522bcaf9a6db2f676286fb9ceb1a188dcab
2021-05-25 14:20:08 +00:00
Florent de Labarre ee2ee1ee6d [FIX] l10n_fr_pos_cert: hash doesn't appear in ticket during reprint
- Create a pos order, pay and valide
- Close Pos
- reopen pos
- search this order
- click print ticket

--> Issue the hash doesn't appear on the ticket

closes odoo/odoo#71217

X-original-commit: 40adcce221ab882d034b2f4ed2987a234ba434f5
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-05-25 12:14:53 +00:00
Florent de Labarre 72a929d30b [FIX] mail: prevent useless write
In database with frontend and live chat there are lot of bad query error.
bad query: UPDATE "mail_channel_partner" SET "write_uid"=5,"write_date"=(now() at time zone 'UTC') WHERE id IN (328111)

closes odoo/odoo#71207

Error: Could not serialize access due to concurrent update
X-original-commit: 36a9e761c8d6c1c6e9611cc410ecca82ff2b1659
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-25 09:23:10 +00:00
newtratip a0529acd08 [CLA] newtratip signs Odoo's CLA
closes odoo/odoo#71200

X-original-commit: c49bcce249b9ffcbc98dded17b6dbe71a1c22552
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-05-25 08:21:06 +00:00
Pierre Masereel 935d96b9d2 [FIX] point_of_sale: rounding issue with cash rounding
The method that computs what is due and the change of an order is based
on the selected payment line which is wrong, because if you add and
remove a payment line, none will be seleced, that lead to issue in this
case because a change is computed, and it won't match the invoices
because an amount_return is sent to server.

To reproduce you can follow this simply procedure:
    - set rounding half-up to 0.05
    - create a product at 0.98
    - open POS and create an order with the product
    - go to payment screen
    - add cash payment (1€ auto filled)
    - add bank payment (It'll autofill -0.02 not really a problem)
    - remove the bank payment => It'll show 0.02 due (it is caused because of no payment method is selected)
    - Set a customer and check the invoice => unbalanced (0.02 probably because it is set in amount_return of the request)

closes odoo/odoo#71195

X-original-commit: af5a88e84fb1c05c4be38930373165f28a06f4f0
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-05-25 07:42:31 +00:00