Commit Graph
145982 Commits
Author SHA1 Message Date
ijas ahammed 308ebb2a2c [IMP] website_crm_partner_assign: show assigned partner on opportunity kanban
This commit display the assigned parter on kanban view of opportunities next
to the partner (if assigned parter is set). For example, if the customer name
is 'Main Contact' and assigned partner's name is 'Assigned Contact', it will
appear in following format:

Main Contact → Assigned Contact

If there is no customer and only assignd parner, it will look like

→ Assigned Contact

Note that if there is only customer, or no assigned partner and no customer,
nothing changes in the view.

taskID-2443894
closes https://github.com/odoo/odoo/pull/67524

Part-of: odoo/odoo#67524
2021-10-19 15:58:48 +00:00
ijas ahammed 433bc7474e [IMP] website_crm_partner_assign: improve 'Partner Assignment' and creation
- This commit removes `selection` widget given on 'Partner Level'
  and 'Activation' fields on contact form view to allow users to
  create records for them on the fly (with 'no_open' option).

- This commit moves geo-location related fields below the parter assignment
  related fields in the 'Partner Assignment' page of contact form view.

- This commit adds default lowest 'Partner Level' and 'Activation' (based on
  sequence) while creating assigned partner on the fly from opportunity form
  view. The purpose is to allow user to select the created partner again in
  'Assigned Partner' m2o, which displays only partners having 'Partner Level'
  (grade_id) set.

TaskID-2443894
closes https://github.com/odoo/odoo/pull/67524

Part-of: odoo/odoo#67524
2021-10-19 15:58:48 +00:00
ijas ahammed b28aae2a71 [IMP] website_crm_partner_assign: add data, action helper and rename menu
- For sake of having basic config for 'Partner Level' and 'Activation'
  in contact form view (until user discovers the dedicated menus under
  CRM > Configuration > Resellers) in blank db, this commit moves the
  demo data related to 'Partner Level' to data, and adds new data for
  'Activation', in following sequence:

  - Fully-Operation
  - Ramp-up
  - First Contact

  Also, higher ranks for partner level and activation are considered
  better, and so the tree views for them now display the records in
  the order of their rank (highest on top).

  Note that with this commit, we remove 'Platinum' partner level and
  it's references that were available in demo data.

- Apart from that in this commit we have also done these changes,
  - Renames the menu 'Partner Level' to 'Partner Levels' and adds
    action helper for the same.
  - Adds action helper for the 'Partner Activations' menu.

TaskID-2443894
closes https://github.com/odoo/odoo/pull/67524

Part-of: odoo/odoo#67524
2021-10-19 15:58:48 +00:00
Hubert Van de Walle (huvw) 7e7c16534b [FIX] repair: Respect account.group_show_line_subtotals_tax_included
Steps to follow

- Enable group_show_line_subtotals_tax_included
- Create a repair order and add a tax to a line
-> The subtotal doesn't contain the tax amount

opw-2513287

closes odoo/odoo#78631

X-original-commit: 133888a1859d81a252177b58b046b54d22ba5ca8
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: Hubert Van De Walle <hubvd@users.noreply.github.com>
2021-10-19 14:43:54 +00:00
Achraf (abz) f04ce9a516 [FIX] web: don't prevent DropdownItem click event if no href
Before this commit
Each click event triggered inside a DropdownItem is default prevented

After this commit
Those click events will be default prevented only when the DropdownItem receives a props.href, which will turn it into an <a href/> element.
This corresponds to the initial intention: prevent the default click behavior of an <a href/> element and only keep the DropdownItem click behavior.

opw-2665795

closes odoo/odoo#78628

X-original-commit: 11760db91fc56fb8b998d77661f8d4d7842f3eb8
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2021-10-19 14:43:50 +00:00
Barad Mahendra 281b65a943 [FIX] web,*_*: fix the html content in notification
Currently markup-ification of the legacy notifications system
display the html content in notification layout for some of the
notification of document and planning from commit: https://github.com/odoo/enterprise/commit/ba44461fea337ed2e5adbdfa1e8eede00b036def

So here in this commit, we make the method `makeLegacyNotificationService`
always `_.escape(message)` and pass `messageIsHtml: true` to the owl
notifications system so notification with html content will be displayed
properly.

Task-2657391

closes odoo/odoo#78627

X-original-commit: 7ce6d8d70be79c9c626865598b898dce9a18b045
Related: odoo/enterprise#21782
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-19 14:43:42 +00:00
std-odoo 5e7297a01a [FIX] link_tracker: add a system parameter to disabled the tracking
Bug
===
If you send a URL (which will be transformed into a link tracker) to
an external website (e.g. in mass mailing, social, ...), the UTM values
will be added in the GET parameters of the URL.

The external website might crash if those parameters are not supported
by it.

We want to add a system parameter `link_tracker.no_external_tracking`
to be able to not add those UTM values in the redirected URL.

This is done only for external website, because it will never be an
issue if the URL redirect to Odoo.

Task-2657413

closes odoo/odoo#78616

X-original-commit: c8363b7bb74ace4e77b593efc3a9104143240141
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2021-10-19 13:17:39 +00:00
Philippe Wauthy bc1abc5582 [FIX] hr_holidays: delete holidays in correct states
On the month, week or day time off calendar views, the delete button appears when the time off is in approved or refused state and does not when the time off is in other states.
The behavior should be the opposite.

https://www.awesomescreenshot.com/video/5681852?key=2b2136139c3fadd1006b98c0f4be920c

task-2671598

closes odoo/odoo#78614

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-10-19 13:17:31 +00:00
Kevin Baptiste d52eebd6ca [IMP] hr_holidays: clean leave responsibles on user creation
New users automatically received the Leave Responsible role even though
they were not managing any employees.

closes odoo/odoo#78436

Taskid: 2635715
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-10-19 13:17:27 +00:00
Alvaro Fuentes ad9c67a1e2 [FIX] purchase: fix MemoryError when there are lots of line_ids
It seems that this long dereference causes a MemoryError for accounts
with many associated line_ids
```
select count(*) from account_analytic_account a join account_analytic_line l on l.account_id = a.id join account_move_line ml on ml.id = l.move_id where a.id=7
+---------+
| count   |
|---------|
| 131672  |
+---------+
```
The solution we propose is to use search_read inverting the order of
dereferences.

Shortened Traceback:
```
 Traceback (most recent call last):
 ...
   File "/home/odoo/src/odoo/15.0/addons/mail/models/mail_thread.py", line 410, in _compute_field_value
    return super()._compute_field_value(field)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4249, in _compute_field_value
    getattr(self, field.compute)()
   File "/home/odoo/src/odoo/15.0/addons/purchase/models/analytic_account.py", line 15, in _compute_purchase_order_count
    account.purchase_order_count = len(account.line_ids.move_id.purchase_order_id)
...
   File "/home/odoo/src/odoo/15.0/odoo/api.py", line 893, in update
    field_cache.update(zip(records._ids, values))
 MemoryError
```

Observed during the upgrade of 41031

We can reproduce this pref issue locally.
On the menu Accounting > Configuration > Analytic Accounting > Analytic Accounts, with 1 million account moves
```
test_15.0=> select account_id,count(*) from account_analytic_line group by account_id
+--------------+---------+
| account_id   | count   |
|--------------+---------|
| 1            | 1000002 |
+--------------+---------+
```
We get (shortened):
```
2021-10-19 07:39:33,807 53565 INFO test_15.0 werkzeug: 127.0.0.1 - - [19/Oct/2021 07:39:33] "POST /longpolling/poll HTTP/1.1" 200 - 9 0.077 50.063
2021-10-19 07:39:33,888 53565 INFO test_15.0 werkzeug: 127.0.0.1 - - [19/Oct/2021 07:39:33] "POST /longpolling/im_status HTTP/1.1" 200 - 4 0.038 0.044
2021-10-19 07:40:05,916 53565 WARNING test_15.0 odoo.service.server: Thread <Thread(odoo.service.http.request.140269940897536, started 140269940897536)> virtual real time limit (178/120s) reached.
2021-10-19 07:40:05,921 53565 INFO test_15.0 odoo.service.server: Dumping stacktrace of limit exceeding threads before reloading
2021-10-19 07:40:06,296 53565 INFO test_15.0 odoo.tools.misc:
File: "/usr/lib/python3.8/threading.py", line 890, in _bootstrap
...
File: "/home/odoo/src/odoo/15.0/addons/mail/models/mail_thread.py", line 410, in _compute_field_value
  return super()._compute_field_value(field)
File: "/home/odoo/src/odoo/15.0/odoo/models.py", line 4249, in _compute_field_value
  getattr(self, field.compute)()
File: "/home/odoo/src/odoo/15.0/addons/purchase/models/analytic_account.py", line 15, in _compute_purchase_order_count
  account.purchase_order_count = len(account.line_ids.move_id.purchase_order_id)
File: "/home/odoo/src/odoo/15.0/odoo/fields.py", line 2605, in __get__
  return self.mapped(records)
File: "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1176, in mapped
  self.__get__(first(remaining), type(remaining))
File: "/home/odoo/src/odoo/15.0/odoo/fields.py", line 2603, in __get__
  return super().__get__(records, owner)
File: "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1081, in __get__
  recs = record._in_cache_without(self)
File: "/home/odoo/src/odoo/15.0/odoo/models.py", line 5901, in _in_cache_without
  return self.browse(ids)
File: "/home/odoo/src/odoo/15.0/odoo/models.py", line 5149, in browse
  ids = tuple(ids)
File: "/home/odoo/src/odoo/15.0/odoo/api.py", line 952, in get_missing_ids
  if record_id not in field_cache:
```

closes odoo/odoo#78615

X-original-commit: 6077c9358fe650bcdc23e8d6a9432f639fca1b40
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-10-19 12:02:25 +00:00
Nicolas Lempereur ca3267baef [FIX] web: translate apply/cancel daterange widget
There was a missing translation for apply/cancel button in
daterangepicker widget. With this change, we provide the odoo
translation to the library when initializing the picker.

opw-2628117

closes odoo/odoo#78588

X-original-commit: 40f128baba53ce29c2d03b7370e54b5010edb9ef
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-10-19 10:51:10 +00:00
roen-odoo c12d61df0c [FIX] sales : Avoid warehouse changing on confirmed SO
Warehouse should not be modified when the salesperson is modified
on a confirmed SO

opw-2614063

closes odoo/odoo#78506

X-original-commit: 4b36dc25929b8aeac03b3a93c043b23b89141d94
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Jacana <robinengels@users.noreply.github.com>
2021-10-19 10:51:03 +00:00
Kevin Baptiste a3a42f335c [IMP] hr_contract: restrict HR Responsible to contract's company
HR Responsible should be limited to the employee's of the contract's
company.

closes odoo/odoo#78320

Taskid: 2668125
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-10-19 10:50:58 +00:00
Martin Trigaux 66c1fbd7e1 [FIX] point_of_sale: allow invoicing user to access PoS invoice
If a user has access to account.move but not pos.order, it was not
possible to open the invoice or the report

closes odoo/odoo#78579

X-original-commit: 7c84886ebe2fd1aafa5743c7d61bbf0062aa55e1
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-10-19 09:35:45 +00:00
Mitul Shah 39209eecb2 [IMP] website_crm_iap_reveal: add 'website_crm' as dependency
While installing 'website_crm_iap_reveal' module, 'website_crm' module is
auto-installed, and it introduces m2m field 'lead_ids' on visitors. This
field is used within 'website_crm_iap_reveal'.

So, when 'website_crm' is uninstalled, trying to access the field 'lead_ids'
gives a traceback.

This commit fixes this issue by adding 'website_crm' module as a dependency
to 'website_crm_iap_reveal' so that the state remains consistent.

Task-2655439

closes odoo/odoo#78354

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-19 08:22:49 +00:00
Mohammed Shekha 6087787cd3 [IMP] web: add percentage information in pie tooltip
With this commit, we add percentage information in pie chart tooltip,
A pie chart is meant to illustrate numerical proportions.
In Odoo, when hovering a piece of a pie chart, the tooltip is currently not
displayed the proportion/percentage of the piece in the pie. The purpose of
this commit is to provide the user with the percentages of data distribution by
adding them in the tooltip.
In the tooltip displayed when hovering a piece of the pie chart, add the
percentage between brackets.

task-2608695

closes odoo/odoo#78343

X-original-commit: f73bd6dad71045d9f0a012259f148f0c768b964b
Signed-off-by: FrancoisGe <fge@odoo.com>
2021-10-19 08:22:44 +00:00
Kevin Baptiste c715ecb38b [IMP] fleet: add Write Off Date on vehicle
Add the Write Off Date on vehicle.

closes odoo/odoo#77464

Related: odoo/enterprise#21299
Related: odoo/upgrade#2878
Taskid: 2657561
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-10-19 07:12:04 +00:00
tranngocson1996 087bbf826f [FIX] l10n_vn: Change xml ID to avoid confusion
XML-ID 'chart8111' was set for account 811, which didn't really make
sense. Changed to 'chart811'
Also adapted the translation files accordingly

closes odoo/odoo#78584

X-original-commit: cbf0045f63b4e0e1b4560a7cc8ff4a2a8a6faf86
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-10-18 19:03:42 +00:00
Yannick Tivisse adf45e252a [FIX] hr_work_entry: Search on name and code for work entry types
closes odoo/odoo#78566

X-original-commit: 1a9ddbcface176912fb0dd3b0b237c982aa6568c
Related: odoo/enterprise#21761
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-10-18 16:26:44 +00:00
oco-odoo 7f73791820 [FIX] l10n_sa: install taxes and fiscal positions properly on demo company
When installing the module, the current company didn't receive taxes and fiscal positions, even though the accounts were properly created.

closes odoo/odoo#78568

X-original-commit: 5880192411cb96cd2a14291814bd9991a8761fdd
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-10-18 15:13:08 +00:00
anhe-odoo 532fd04718 [FIX] mail: chatter in chat window should log notes
Expected Behaviour

When a user reply to a mention (on an invoice, a client profile, ...) in a log_note, and this user answers directly in the chatbox, the answer should be considered as an internal discussion, and so be posted as a log_note.

Observed behaviour

Since V12, when a user reply in the chatbox, the reply is automatically set as a "send-message" reply, which is a issue as the user sends an email to all followers of the discussion while he probably thinks his answer will be visible only by the internal users.

Reproducibility

This bug can be reproduced following these steps:
1. Declare at least 2 users (A and B) and make sure user A handles notifications in Odoo
2. Log as user B, go anywhere in Odoo as user B and mention the user A in a log_note
3. Log as user A, open the mention notification and reply in the chatbox
4. The answer will be noted as a send-message answer, sending then e-mails to all followers ...

Problem Root Cause

As long as the V12 isn't supported anymore, we didn't investigate this version. In V13, the issue comes from the fact the chatbox didn't use the same composer class as the discussion module, and then it's not possible to send a log note from the chatbox. In V14, as the discussion module has been totally refactored, the "error" comes from the arbitrary choice to set "false" as the default value of "isLog" on a general message, which implies that the answer from the chatbox is considered as a "send-message" and not as a "log-note".

Related tickets

opw-2602712
opw-2659484

closes odoo/odoo#78565

X-original-commit: 9e62872561f9914beac8f58f5c3ebed83cd9defc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-10-18 15:13:03 +00:00
Adrien Widart 60e7803f3f [FIX] stock: define the order of products allocation
The allocation order is not based on the pickings order

To reproduce the issue:
(Need sale_management,mrp)
1. Create a storable product P
2. Create a BoM for another product dummy_P and add 1xP as component
3. Create and confirm a SO with 1x product P
4. Create and confirm a MO for 1x dummy_P
5. Process a receipt transfer with one P

Error: On the SO, the reserved quantity is still 0. The product has been
reserved for the MO, even if the picking of the SO has been created
first

The default order of several SM is based on the sequence and the
identifier:
https://github.com/odoo/odoo/blob/abc9fdaae2927214d98082f391a1dc0fc75e4c77/addons/stock/models/stock_move.py#L26

The default value of the field `sequence` is 10:
https://github.com/odoo/odoo/blob/abc9fdaae2927214d98082f391a1dc0fc75e4c77/addons/stock/models/stock_move.py#L26

When creating a SO, the field isn't defined so its default value is used
(10). However, when creating the MO, the field is defined thanks to the
sequence of the related BOM line:
https://github.com/odoo/odoo/blob/864d90a064f093bd6ba24d8464ee491a443a320e/addons/mrp/models/mrp_production.py#L940
Which, in our case, is equal to 1

As a result, when allocating the quantities in `_action_assign`, the
recordset will contain first the SM of the MO and then the SM of the SO.

This commit ensures the order will be based on the priority, the date
and the identifier (the latter allows the search result to be
deterministic)

Side note: this commit also adds the identifier to the search in
`_run_scheduler_tasks` to keep consistency between the different
flows

OPW-2524205

closes odoo/odoo#78497

X-original-commit: da2b336d467d95cda8ed21707535fb7119f5d777
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-10-18 15:12:55 +00:00
Julien Van Roy 2234f26a28 [IMP] account: replace tooltips for the 3 accounts in Tax Group
For clarity purpose, tooltips for the 3 accounts in Tax Group (Configuration > Tax Group) are added.

task-2602730

closes odoo/odoo#78453

Related: odoo/enterprise#21725
Signed-off-by: William André (wan) <wan@odoo.com>
2021-10-18 15:12:50 +00:00
Andrea Grazioso (agr-odoo) d60063e159 [FIX] account: use refund repartition line when needed when applying a reconciliation model with a tax from a button
The fix made in https://github.com/odoo/odoo/pull/74427 was mistakenly not forward-ported. We reintroduce it here together with the fix that was made for it by https://github.com/odoo/odoo/pull/77589 .

Before this fix, the wrong repartition was used, and the tax_tag_invert computed for the move lines in this case was inconsistent, leading to wrong reporting.

closes odoo/odoo#78546

X-original-commit: 663bc7c0a0c0d7d16cd754bba5cea34bdb6315bf
Related: odoo/enterprise#21756
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-10-18 14:01:49 +00:00
5652e7ee91 [FIX] project: Fix user_ids access issues on project sharing
Both developments 6c4910a and 7563b44 have been introduced nearly
at the same time in the saas-14.5 version, but the later one is
introducing a side effect that breaks the project sharing feature.

Indeed, before there was one assignee per task (user_id), and now
we can assign several collaborators (user_ids).

As the read on a M2O is just calling the name_get method, it wasn't
an issue.

Now, as it implies to read the res.users (and the res.partner) model,
the assigned users were filtered according to a specific ir.rule
for the portal users:

    <record id="res_partner_rule" model="ir.rule">
        <field name="name">openerp.portal.res.partner</field>
        <field name="model_id" ref="base.model_res_partner"/>
        <field name="groups" eval="[(6,0,[ref('group_openerp_portal')])]"/>
        <field name="domain_force">[('id','child_of',user.commercial_partner_id.id)]</field>
    </record>

This commit creates a new compute non-stored field called
`portal_user_names` to display the name of all assignees in each task in
the project sharing feature. Thus, the portal user can see all assignees
via this char field. The `user_ids` field is removed in the views of
project sharing since the portal cannot see all assignees with this
field.
By doing this, a collaborator cannot edit the field to assign or unassign
himself to a task. To keep this behaviour, two buttons are added in the
form view of task. One called 'Assign To Me', the current collaborator
will be able to assign himself to the task when he will click on this
button. The other button called 'Unassign Me' is to allow the
collaborator to unassign himself to the task.

part of task-2633229

closes odoo/odoo#78538

X-original-commit: 3b5a657df086b54def0bc0bdae89c19c89cb39f5
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
Co-authored-by: Xavier BOL (xbo) <xbo@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
2021-10-18 14:01:36 +00:00
Kishan Gajjar b2f170156a [FIX] website: restore icons for 'Big Icons Subtitles' snippet
closes #78507

closes odoo/odoo#78548

X-original-commit: 593efcf99a6aa2b18364786a807d9ec9b3c7e72f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-18 12:46:02 +00:00
William Henrotin 2c37be22b8 [FIX] stock: speed up lot creation
Creating lots of production lot can take a huge amount of time if the
mail message follower is added on each chatter.

This commit removes this functionality to speed up the creation as
there is no real need to have the lot creator as follower of it.

closes odoo/odoo#78547

X-original-commit: 9b0e669216948da2710e2e16007f03e47fb7e704
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-10-18 12:45:58 +00:00
William Henrotin 13010c5d3d [IMP] stock: break the stock move line search
Searching the stock move line candidate to update at reservation can be
shorten by breaking the loop once one is found

X-original-commit: 93df2568914bee307209e1e739912976c23e1f1d
Part-of: odoo/odoo#78547
2021-10-18 12:45:57 +00:00
William Henrotin 5330dca7be [IMP] stock: create stock move lines in batch
X-original-commit: 8220234642c7c5fada4a882ba67cdb2ca5e7aaf2
Part-of: odoo/odoo#78547
2021-10-18 12:45:57 +00:00
William HenrotinandRemy Voet 30d8c17ffd [IMP] stock: recompute state speedup
The recomputation of stock move state is often done with already
the correct state (for instance in the case of move line deletion only
one of the deletion will change the state).

This commit check the move state before changing it only when it's
necessary.

Task: 2507143
X-original-commit: 80033446a091ff3ba98c58ba44ad665bfba30c98
Part-of: odoo/odoo#78547
Co-authored-by: Remy Voet <ryv@odoo.com>
2021-10-18 12:45:56 +00:00
Florian Damhaut 425ff940da [FIX] mrp : Remove operations from production template when the module is disabled
Current Behaviour :
1. Enable Work Orders
2. Add an operation to a BOM
3. Disable Work Orders
4. Create a manufacturing order for this product and finish the manufacturing.
5. Print the production order

What is the current behavior that you observe?
The production order has the operations in it even though the work order option has been disabled. This is because disabling the work order option just hides the operations and does not remove it from the BOM.

What would be your expected behavior in this case?
The printed production should not show the operation.

opw-2660545

closes odoo/odoo#78544

X-original-commit: d73752c5fe983ce6a9147721e732396394a77cc4
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-10-18 12:45:47 +00:00
Nathan Marotte (nama) 04bb7005b7 [FIX] mrp : replacing tracked part in repair fails uniqueness
Issue: When replacing a tracked part while doing a repair, we
are changing the tracking number, but when checking for uniqueness,
we don't take that change into consideration

Steps to reproduce :
 1) Manufacture product A with SN "A1" out of product B with SN "B2"
 2) Make Repair Order for "A1" to replace "B2" with Product B (SN "B1").
 3) Create Manufacturing Order product A (A2), select product B with SN
  "B2" as one of the components.
 4) Mark as done
 -> Bug : "The serial number <B2> used for component <B> has already
 been consumed".

Why is that a bug:
 When checking for uniqueness we should take into consideration the
 parts being replaced

opw-2625687

closes odoo/odoo#78407

X-original-commit: 79c673f9d15185be540dd535d7ebe10c8f138bf1
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-10-18 11:36:58 +00:00
Alvaro Fuentes 433f0c15bf [FIX] sale_timesheet_margin: fix division by zero
If the denomirator is zero, we set the computed value to zero.

closes odoo/odoo#78522

X-original-commit: 2b0a5ce53aa55da056d6acd6461a56aea75611ce
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-18 10:22:02 +00:00
Benjamin Vray 34c401caf8 [FIX] website: fix save animated snippet
Before this commit, when dropping custom snippet (or saved snippet)
containing an animation in the page, the animated element of the
snippet remained hidden.

task-2664876

closes odoo/odoo#78493

X-original-commit: 61d7744ca988641bd4d8a4006350ec197eece25a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-18 10:21:58 +00:00
xlu-odoo 6dd4ddab2b [FIX] web_editor: fixing border-radius on dropdown menu entries
Prior to this commit, every dropdown menu entries in the web editor
had a border-radius on them. It didn't look consistent and clean.

This commit fixes those menu entries by either removing or applying a
correct border-radius.

closes odoo/odoo#78492

X-original-commit: 0239ab7efcaf3895ffb14a56a0686cf5a80bb529
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-18 10:21:53 +00:00
Benjamin Vray 2e57d784d3 [FIX] website, web_editor: fix overlay options of the timeline snippet
Before this commit, the CSS of the overlay option buttons of the
timeline snippet was broken.

task-2648348

closes odoo/odoo#78491

X-original-commit: 13770d650def3107378fe4010aac48dc85a5256a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-18 10:21:49 +00:00
Benjamin Vray 5201f0fa0b [FIX] web_editor: prevent inline snippet drop in non-inline area
Before this commit, it was possible to drop an inline snippet (e.g.
badge, cards, etc.) next to a section when this section was a snippet
which can be dropped as main snippets or as inline snippets (e.g.
countdown, embed code, etc.).

task-2648348

closes odoo/odoo#78483

X-original-commit: e2f218fbb3d9bab9dba380582aa93e80fa9becc1
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-18 10:21:44 +00:00
Guillaume (guva) a14874d623 [FIX] mrp: Delivered quantity with kit
Steps to reproduce:

- Set the Decimal Accuracy at 5 digits for Product UoM
- Create a product X
- Create a kit BOM for X with a component Y, and qty 0.08600
- Create a Sale Order for 10 product X, confirm and deliver all

Issue

- On the SO, quantity delevered is 9.00000 instead of 10.00000, same
  issue occur with the same flow with a Purchase Order.

Cause

As the quantity per kit was rounded when calling _compute_qty,
the calcul of quantity ratio was not well computed.

Solution

Avoid rounding the quantity per kit, as the quantity ratio is rounded
a few steps after.

opw-2590126

closes odoo/odoo#78516

X-original-commit: 2a2b198ea6ce1d0553c606404e6db1117dc1c4a2
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: guva-odoo <guva-odoo@users.noreply.github.com>
2021-10-18 09:08:49 +00:00
Thibault Libioulle bf6b2ae590 [FIX] project,hr_timesheet: fix hr timesheet graph extension
This commit fixes the broken inheritence between project and
hr_timesheet modules regarding the GraphView.

Hr Timesheet module extends GraphView rather than ProjectGraphView which
makes the view unaware it should use the ProjectControlPanel.

This commit adds project tour steps to ensure every view contains the
project update breadcrumb.

task-2642872

closes odoo/odoo#78503

X-original-commit: aa59771d3a4ffd2f7372c58bf56ca8dcc1183d2e
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
Signed-off-by: Thibault Libioulle (tle) <tlibioulle@users.noreply.github.com>
2021-10-18 07:56:34 +00:00
Adrien Widart 67e19a5dc7 [FIX] mrp_subcontracting: validate a partial picking
When validating a receipt, if the product is subcontracted and if the
picking is not fully done, it will be impossible to create a backorder

To reproduce the issue:
1. Create two products P_compo, P_finished
    - Both storable
    - Both tracked by lot
    - P_compo must have the route "Resupply Subcontractor on Order"
2. Update P_compo's quantity: 4
3. Create a BoM:
    - Product: P_finished
    - BoM type: Subcontracting
    - Subcontractors: a partner P
    - Components: 1 x P_compo
4. In Inventory, create a planned transfer T:
    - Operation Type: Receipt
    - Receive From: P
    - Operations: 4 x P_finished
5. Mark as Todo
6. Inventory > Delivery Orders, find the delivery of P_compo for P and
process it
7. Back to T, Record Components:
    - Quantity: 3/4
    - Set a Lot for P_finished
8. Validate T, Create Backorder

Error: a User Error is raised "You need to supply a Lot/Serial Number
for product: - P_finished"

Since P_finished is subcontracted, a related MO has been generated. On
step 7, when recording the used components, since all P_finished have
not been produced, a second MO is created for the last P_finished.
However, when validating T, both MOs are selected and validated. This is
an error since the user has not yet recorded the used components for the
last MO. The latter should not be validated.

OPW-2582538

closes odoo/odoo#78496

X-original-commit: 21068076b4a6b134f5f07c4c03de7c4eb37b4688
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-10-18 07:56:30 +00:00
std-odoo bac2a86ce2 [FIX] mail_plugin: update the documentation URL
Purpose
=======
Add the new URL to the documentation for the v15.

Task-2647169

closes odoo/odoo#78410

X-original-commit: 899911539635417076fd7e88c8d772c6fcb344b0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-18 07:56:26 +00:00
Olivier Dony 63367b2519 [FIX] mail.thread: fix performance of has_message
The `distinct` keyword in query
```SELECT distinct res_id FROM mail_message WHERE model=%s```
is not strictly necessary for the correctness of the result, as
it will be inserted inside a sub-query that will be able to use
the main (model, res_id) index of mail_message.

For example, when the `has_message` field is used in a domain
by the website_livechat module[1], the complete query looks
like this:
```
SELECT "mail_channel".id FROM "mail_channel"
WHERE  ("mail_channel"."active" = true) AND
       ("mail_channel"."livechat_visitor_id" = 112678387) AND
       ("mail_channel"."livechat_channel_id" = 1) AND
       ("mail_channel"."livechat_active" = true) AND
       ("mail_channel"."id" in (
           SELECT distinct res_id FROM mail_message WHERE model='mail.channel'))
ORDER BY "mail_channel"."create_date" DESC LIMIT 1;
```
In this query, it's obvious that the `distinct` makes zero difference in
the results.

However, the presence of the DISTINCT keyword means that PostgreSQL will
factor the cost of applying that UNIQUE sort in the query planning, and
use MERGE JOIN strategy to avoid sorting multiple times (ok, it could
perhaps guess that distinct is useless here, but we asked for it.)

For a database with millions of mail messages, there can easily be
millions of hits for the generic "all res_ids for model" query, so
the cost of that part will be quite high.

The plan will then look like this (notice the "Unique" step and the cost,
730ms for the index scan + 200ms for the sort):
<details>
  <summary>The query plan when `distinct` is used</summary>
```
                         QUERY PLAN
------------------------------------------------------------------------------
 Limit  (cost=151528.28..151528.29 rows=1 width=12) (actual time=1021.237..1021.239 rows=1 loops=1)
   Output: mail_channel.id, mail_channel.create_date
   Buffers: shared hit=767230
   ->  Sort  (cost=151528.28..151528.29 rows=1 width=12) (actual time=998.799..998.801 rows=1 loops=1)
         Output: mail_channel.id, mail_channel.create_date
         Sort Key: mail_channel.create_date DESC
         Sort Method: quicksort  Memory: 25kB
         Buffers: shared hit=767230
         ->  Merge Join  (cost=3.01..151528.27 rows=1 width=12) (actual time=998.786..998.790 rows=1 loops=1)
               Output: mail_channel.id, mail_channel.create_date
               Inner Unique: true
               Merge Cond: (mail_channel.id = mail_message.res_id)
               Buffers: shared hit=767230
               ->  Sort  (cost=2.44..2.45 rows=1 width=12) (actual time=0.043..0.045 rows=1 loops=1)
                     Output: mail_channel.id, mail_channel.create_date
                     Sort Key: mail_channel.id
                     Sort Method: quicksort  Memory: 25kB
                     Buffers: shared hit=5
                     ->  Index Scan using mail_channel_livechat_visitor_id_livechat_channel_id_idx on public.mail_channel  (cost=0.41..2.43 rows=1 width=12) (actual time=0.035..0.039 rows=1 loops=1)
                           Output: mail_channel.id, mail_channel.create_date
                           Index Cond: ((mail_channel.livechat_visitor_id = 112678387) AND (mail_channel.livechat_channel_id = 1))
                           Filter: mail_channel.active
                           Buffers: shared hit=5
               ->  Unique  (cost=0.57..143838.35 rows=614997 width=4) (actual time=0.033..993.210 rows=97187 loops=1)
                     Output: mail_message.res_id
                     Buffers: shared hit=767225
                     ->  Index Only Scan using mail_message_model_res_id_idx on public.mail_message  (cost=0.57..129884.36 rows=5581595 width=4) (actual time=0.032..730.233 rows=5586467 loops=1)
                           Output: mail_message.res_id
                           Index Cond: (mail_message.model = 'mail.channel'::text)
                           Heap Fetches: 17
                           Buffers: shared hit=767225
 Planning Time: 0.471 ms
 Execution Time: 1025.410 ms
(37 rows)
```
</details>

Now, if we remove the superfluous `distinct` clause, for the same
database, data volume, and result, the plan looks like this:
<details>
  <summary>The query plan when `distinct` is not used</summary>
```
                          QUERY PLAN
-------------------------------------------------------------------------------------
 Limit  (cost=3.44..3.44 rows=1 width=12) (actual time=0.069..0.069 rows=0 loops=1)
   Output: mail_channel.id, mail_channel.create_date
   Buffers: shared hit=8
   ->  Sort  (cost=3.44..3.44 rows=1 width=12) (actual time=0.068..0.068 rows=0 loops=1)
         Output: mail_channel.id, mail_channel.create_date
         Sort Key: mail_channel.create_date DESC
         Sort Method: quicksort  Memory: 25kB
         Buffers: shared hit=8
         ->  Nested Loop Semi Join  (cost=0.98..3.43 rows=1 width=12) (actual time=0.061..0.061 rows=0 loops=1)
               Output: mail_channel.id, mail_channel.create_date
               Buffers: shared hit=8
               ->  Index Scan using mail_channel_livechat_visitor_id_livechat_channel_id_idx on public.mail_channel  (cost=0.41..2.43 rows=1 width=12) (actual time=0.020..0.020 rows=1 loops=1)
                     Output: mail_channel.id, mail_channel.create_date
                     Index Cond: ((mail_channel.livechat_visitor_id = 117513256) AND (mail_channel.livechat_channel_id = 1))
                     Filter: mail_channel.active
                     Buffers: shared hit=4
               ->  Index Only Scan using mail_message_model_res_id_idx on public.mail_message  (cost=0.57..2.77 rows=10 width=4) (actual time=0.040..0.040 rows=0 loops=1)
                     Output: mail_message.model, mail_message.res_id
                     Index Cond: ((mail_message.model = 'mail.channel'::text) AND (mail_message.res_id = mail_channel.id))
                     Heap Fetches: 0
                     Buffers: shared hit=4
 Planning time: 0.761 ms
 Execution time: 0.095 ms
(23 rows)
```
</details>

Total execution time goes from 1000 ms to 0.1ms.

Reference: introduced by 9a01a2953f,
           coming from #69812, which was fixing a performance problem.

[1]  https://github.com/odoo/odoo/blob/9b224f35f45876c86dc34934379bfa9e8b3e2160/addons/website_livechat/models/website.py#L40-L44

closes odoo/odoo#78186

X-original-commit: 3ab87a848c96b284eac3dbbd6f6f2a9ea971876a
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2021-10-18 07:56:21 +00:00
Fabio Barbero 54909f5339 [IMP] survey: update "Press Enter" tooltip depending on field type
Purpose
=======
Have the "or press CTRL+Enter" (metaKey if it's a mac) shown if the input field selected is a text area, and "or press Enter" otherwise.
Hide the text at the beginning of the survey if it's from mobile.

PR: odoo/odoo/pull/77726
Task-2637120

closes odoo/odoo#77726

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-18 07:56:17 +00:00
Sébastien Geelen (sge) 6b264fab91 [FIX] web_editor: use color css name fix reset color
`_updateEditorUI` was reseting color to old or non css color value.
due to a race condition in the editor selection.

task-2654666

closes odoo/odoo#78499

X-original-commit: fd3791d79377b270ab98d646710ecc1d2f364810
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Sébastien Geelen <sebgeelen@users.noreply.github.com>
2021-10-18 06:49:54 +00:00
Aktiv Software 94fc798743 [ADD] CLA Signature Aktiv Software
closes odoo/odoo#78495

X-original-commit: 389e88c382d26310574675eec060c8bc42eb8ceb
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-10-18 05:41:46 +00:00
Pierre Masereel cf875e4797 [FIX] point_of_sale: use correct rate date in test
Since changes made in currency rate default value made in this PR
https://github.com/odoo/odoo/pull/76513 the date is stored based on user
timezone, and so doesn't work if the test runs around midnight with the
belgian timezone on the servers.

closes odoo/odoo#78480

X-original-commit: 0dc9a2d47833f2a13dce9891e7710815b4d27584
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-10-17 10:37:41 +00:00
Christophe Monniez fae2bd0c28 [FIX] packaging: verify repodata exists
The rpm packaging fails to generate a repository when the repodata
directory does not exists previously to the build.

The reason is that the package.py script removes the repodata before
rpm repo generation without verifying the the directory exists.

That kind of corner case happens when a new odoo version comes out.
With this commit, the script now verifies that the directory exists.

Also, while at it, a time stamp based on seconds is added to the default
build directory name to allow to build more than one time the same day
without removing the build directory. It's mainly a testing use case,
when the packaging script is tested, the build dir is usually kept for
debugging purposes.

closes odoo/odoo#78386

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-10-15 22:09:41 +00:00
Christophe Monniez e7231db74e [IMP] packaging: automate win installer displayed version
When a new Odoo version is released, the displayed version in the
Windows NSIS installer has to be manually updated.

With this commit, the displayed version is computed from the release.py
file.

Part-of: odoo/odoo#78386
2021-10-15 22:09:41 +00:00
Aaron Bohy 798bdcc645 [FIX] web: clickbot: correctly test filters
Since commit [1], the filters were no longer tested by the clickbot
because the DOM of the filter menu changed, and the clickbot
selector hadn't been adapted.

[1] https://github.com/odoo/odoo/commit/84715436d87bb05b421bc9ccaacda67d07571690

closes odoo/odoo#78494

X-original-commit: 54d313e5ce708cf0420aaa2529fa3f32f281205e
Related: odoo/enterprise#21735
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-15 20:58:06 +00:00
tranngocson1996 1cf4cdaa1f [I18N] l10n_vn: Update translate file
closes odoo/odoo#78476

X-original-commit: c85828ea75d9450cc83039b673fbcd822a2fe839
Signed-off-by: Florian Gilbert <FlorianGilbert@users.noreply.github.com>
Signed-off-by: Mountain Tran <tranngocson1996@users.noreply.github.com>
2021-10-15 20:58:01 +00:00