Commit Graph
150107 Commits
Author SHA1 Message Date
William Braeckman ad48cd1de8 [FIX] sale_loyalty: fix pricing on free products
Previously free products from loyalty programs were given as the product
with a price_unit of 0, it will now have the complete price but with a
100% discount instead.

closes odoo/odoo#89691

X-original-commit: 39202e71b0df2f5f6d8bfec54e21b4ae4d899b7f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-04-27 07:51:51 +02:00
Antoine Guenet e9237ae800 [FIX] mass_mailing: add background image options for masonry
The masonry snippet was recently imported from website into mass_mailing
but its background image options were omitted, making it impossible to
changes these images.

task-2824014

closes odoo/odoo#89690

X-original-commit: a226c26255dfabff2ac10ca3ec9b56d01feb0d7e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-04-27 07:51:47 +02:00
Rahul Prajapati 588cffa967 [IMP] im_livechat, mail: replace _.str.sprintf to web sprintf
Before this commit:

_.str.sprintf was being used

After this commit:

replaced _.str.sprintf with sprintf

Task-2810721

closes odoo/odoo#89217

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-04-27 07:51:43 +02:00
Victor Feyens f6f4ed7bc9 [FIX] survey: using a f-string without interpolated variables (W1309)
closes odoo/odoo#86332

Related: odoo/enterprise#25232
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-04-27 07:51:25 +02:00
Victor Feyens d6d3493c13 [FIX] crm_iap_enrich: Duplicate key 'version' in dictionary (W0109)
Part-of: odoo/odoo#86332
2022-04-27 07:51:24 +02:00
Victor Feyens 7828fab39c [REM] core: unused import
Part-of: odoo/odoo#86332
2022-04-27 07:51:24 +02:00
Victor Feyens 6fea44277e [FIX] portal: Bad except clauses order (E0701)
UserError is an ancestor class of AccessDenied

Part-of: odoo/odoo#86332
2022-04-27 07:51:24 +02:00
Victor Feyens 835f07c7d4 [FIX] mass_mailing(_*): Using an f-string that does not have any interpolated variables (W1309)
Part-of: odoo/odoo#86332
2022-04-27 07:51:24 +02:00
Victor Feyens 862ad88bc4 [FIX] test_inherit: Bad first argument given to super() (E1003)
Part-of: odoo/odoo#86332
2022-04-27 07:51:23 +02:00
Victor Feyens 24f9af3fd0 [IMP] *: remove Trailing newlines (C0305)
Part-of: odoo/odoo#86332
2022-04-27 07:51:23 +02:00
Victor Feyens 3a43ba3ee0 [FIX] core: Method should have "self" as first argument (E0213)
Part-of: odoo/odoo#86332
2022-04-27 07:51:23 +02:00
Victor Feyens 7d422a2cd4 [FIX] *: unnecessary semicolon (W0301)
+ empty spaces removal
+ added space after comma (C0326 - bad-whitespace)

Part-of: odoo/odoo#86332
2022-04-27 07:51:23 +02:00
Victor Feyens dcc71b984e [FIX] test_converter: unused format argument (W1304)
Part-of: odoo/odoo#86332
2022-04-27 07:51:22 +02:00
Victor Feyens eaa091e540 [FIX] *: cls as first arg of class methods (C0202)
Part-of: odoo/odoo#86332
2022-04-27 07:51:22 +02:00
Victor Feyens 43ddbec741 [FIX] core: Too many arguments for logging format string (E1205)
Part-of: odoo/odoo#86332
2022-04-27 07:51:22 +02:00
Victor Feyens 55c8bcba68 [FIX] account_edi: Too many arguments for logging format string (E1205)
Part-of: odoo/odoo#86332
2022-04-27 07:51:22 +02:00
Laurent Desausoi (lade) 37bff17181 [FIX] website_sale: Ribbon Tree View by Default
When clicking on "Search More" on the Ribbon field on a Product,
we find a list of all the ribbons but only their ID are displayed.

Step to reproduce the issue:
1. Activate developer mode
2. Create enough Ribbons to have the "Search" option displayed (10 should do the trick)
3. Click on the "Search More", the list of all ribbons appears but we only see their IDs

Solution: There were no tree_view for the product.ribbon model. The default view was
thus rendered (default view with only the ID present). Jumped on the occasion to disable
the "Quick Create" button of the Ribbon as we cannot directly create a Ribbon from a bare field,
we need a form. Indeed, the `html_class` and `html` fields are both required.

opw-2820247

closes odoo/odoo#89686

X-original-commit: c0746a4fe21406ac5bd3441e25fd6383ebb7ad3f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Desausoi Laurent (lade) <lade@odoo.com>
2022-04-26 14:28:59 +02:00
Rohitkumar (roku) b2eed699f1 [FIX] project_timesheet_holidays: don't show private task in timesheet task
Before this commit, in time off form view, task field contains the private task.

So this commit fixes the issue by not displaying the private task in task field
of time off form view.

task-2733415

closes odoo/odoo#89674

X-original-commit: 76fcd0cfe5fc157f22825544e239f283831b49fd
Related: odoo/enterprise#26611
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-04-26 14:28:55 +02:00
pedrambiria f43995eab8 [FIX] google_calendar: Prevent resyncing of synced recurrence events
Before this commit: When you sync the Odoo calendar with Google for the
first time, it will resync all of the created recurrence events with
Google after fetching all of the Google events. The problem is that it
chooses the 'accepted' state by default for the current user's state.
If you were invited to events and you hadn't accepted that, it would
update your status and send an email per event for all attendees.

Steps to reproduce the issue:
 1. Create two new google accounts ( you'll bombard with emails)
 2. Create a recurrent event without ending with the first account and
choose the second account as a guest.(don't accept)
 3. Sync second account with Odoo
  => It'll send about 700 emails

The solution is to prevent synced recurrence events from syncing and.

opw-2691146

closes odoo/odoo#89633

X-original-commit: 084aeb239e85a4e3abb3e233af68c6838dfbb3d7
Signed-off-by: Arnaud Joset <arj@odoo.com>
2022-04-26 14:28:49 +02:00
Adesh Jolhe (adjo) 92de5d9502 [IMP] project: fix the rating visibility on kanban,list,form views
Before this commit, the rating feature is visible in some
`project.task` views even if the customer rating field is
disabled on the project related.

Unexpected behavior when the feature is disabled on the project:

  - the rating column field is visible in project.task list view
  - the rating icon is visible in project.task kanban and form view

This commit fixes the rating icon and rating field visibility by adding
a condition to check if the feature is enabled on the project.

task-2762166

closes odoo/odoo#86103

Related: odoo/enterprise#25129
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-04-26 13:25:06 +02:00
Audric Onockx (auon) c3c5c5ae72 [FIX] sale_project : set project's aa on sol
Steps :
Create a Project (P) :
	> Analytic Account : AA
Create a Product (A) :
	> Product Type : Service
	> Create on Order : Task
	> Project : P
Create a Product (B) :
	> Product Type : Consumable
Create and confirm a Quotation :
	> SOL > Product : A
Go to the Task consequently created.
Add B to the products.
Go back to the Quotation and create invoice.

Issue :
See Invoice Lines:
	> INVL(A)'s analytic account is AA.
	> INVL(B)'s is not set.

Cause :
To set the aa on the SOL, we use
SOL.task_id._get_task_analytic_account_id(),
which returns the task's aa or its project's.
Yet we do that only if the task has an aa.

Fix :
Call the method. If it returns something, set it on SOL.

opw-2817811

closes odoo/odoo#89660

X-original-commit: 9e7bf074c346c35325e14e14422f2d860d0db74e
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Signed-off-by: Xavier <xbo@odoo.com>
2022-04-26 12:22:08 +02:00
Brieuc-brd 1d21c78946 [FIX] mail: Message, MessageActionList in front of Composer
Prior this commit, the MessageActionList was behind and partly hidden by
the Composer when we edit small messages.

After this commit, the MessageActionList is in front of the Composer.

task-2819763

closes odoo/odoo#89610

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-04-26 12:22:05 +02:00
Brieuc-brd 23eb4541be [REF] mail: Message, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2819763

closes odoo/odoo#88535

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-04-26 12:21:56 +02:00
Nicolas Bayet b23437e5aa [FIX] web_editor: do not correct link on empty link
closes odoo/odoo#89641

X-original-commit: db8bf3b4cc1bce3f7f160bf4d09a9842e6e0d340
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-04-26 11:02:06 +02:00
Nicolas Bayet f694ecc71b [FIX] web_editor: keep the selection when opening linktool
task-2750970

closes odoo/odoo#89637

X-original-commit: 56f26a0277d72f6604dac153216385d0f5a8a34e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-04-26 11:02:03 +02:00
Nicolas Bayet a8109a384d [FIX] web_editor: debug collaboration _resetEditor
There are cases that seems to reset the editor content but shouldn't.
This commit:
- provide a dialog to allow the user to save his content before being
  lost forever
- reset only if the record content has changed

task-2810115

closes odoo/odoo#89625

X-original-commit: e812e923ffe040e734e4d913eceaae396adf6c3d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-04-26 11:01:59 +02:00
Philippe Wauthy ead794825e [IMP] hr_holidays: set default time off type based on sequence
In hr_holidays, when creating a time off, set the default time off type based
on the sequence of the time off type

task-2832674

closes odoo/odoo#89623

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-04-26 11:01:55 +02:00
Jordi Ballester 06e264e9ca [FIX] project: portal access error
- Install project
- Ceate an internal user without any access rights
- Go to `/my`

A 500 error is raised because of an AccessError.

When the user has no access rights to any of the mentioned applications,
the `search` call returns an AccessError.

We prevent the access error and return 0 as a fallback.

closes odoo/odoo#89648

X-original-commit: 53334071d3073e0404bb981e1309d351f5e3ab43
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-04-26 09:58:00 +02:00
Jinjiu Liu a40800868a [FIX] survey: stats for matrix question is not computed correctly
Reproduction:
1. Install Survey, create a survey with one matrix type question (3 rows
and 3 options for example)
2. Click share, copy the survey link in an incognito tab, and finish it
twice
3. Go to the backend, click “See results”, click “Data” tab
4. The ratio is calculated based on the total number of received options
(#options * #answers)

Reason: the ratio for matrix questions should be computed row by row.
This behavior was correct in V13, but lost in V14 after model rewriting

Fix: Use the number of answers to compute the ratio instead of the
number of options made

opw-2809433

closes odoo/odoo#89434

X-original-commit: da7e242187f304c64ca945ea3d6e9e1d48a9d393
Signed-off-by: Anh Thao PHAM <pta@odoo.com>
Signed-off-by: Liu Jinjiu (jili) <jili@odoo.com>
2022-04-26 09:57:54 +02:00
Dossogne Bertrand 3f3d37bdbc [IMP] hr_holidays: populate leaves
This commit adds the possibility to add the hr.leave and hr.leave.type models

taskID 2823582

closes odoo/odoo#89017

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-04-26 09:57:50 +02:00
Dossogne Bertrand f10b59c964 [IMP] hr_payroll: improve user experience
The commit brings various features to the payroll app :
- visual improvements
- choice to recreate the original after a work schedule change
- after a new contract is sign, its differences with the last one is displayed in the chatter

TaskID : 2762038 [Payroll] Misc improvements

closes odoo/odoo#85581

Related: odoo/enterprise#24873
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-04-26 09:57:43 +02:00
Cedric Prieels (cpr) 7a7ca7d631 [FIX] web: fix modal title display when too long
Issues found using a mobile device only.

On the planning module, go to the gantt view and select a shift with a long name.
The title of the modal that appears will be displayed in three separate lines, and
not all the information is visible. This was fixed globally to avoid having the same
issues in other modules as well.

On the industry fsm module, the worksheet info when signing a document
is not correctly structured.

task-2755200

closes odoo/odoo#89630

X-original-commit: 297eca04fb85ccf95cd0daab9d7062bf46cd6f04
Related: odoo/enterprise#26588
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-04-26 09:04:14 +02:00
Andrea Grazioso (agr-odoo) 50b84d1acf [FIX] account: wrong destination account id in internal transfer
- Setup at least 2 bank accounts [ACC1] and [ACC2]
- Setup a Journal [BNK1] with [ACC1]
- Setup a second journal [BNK2] with [ACC2]
- Create an Internal Outgoing Transfer from [BNK1]
setting as destination journal [BNK2]
- Save and confirm

partner_bank_id will be selected from:
- the Journal, for inbound payments, so [ACC1]
- one, possibly the first, bank account of the company for
  outbound payment, so [ACC1] or [ACC2]
This is wrong as [ACC2] should be used because defined on [BNK2]
which is the destination journal

opw-2794081

closes odoo/odoo#89599

X-original-commit: 4624d1ebdedf84ed3031f7af1be827de54f72566
Signed-off-by: William André (wan) <wan@odoo.com>
2022-04-25 22:33:12 +02:00
Vincent Larcin cb78740bbb [FIX] project: readd token value in portal.message_thread template call
A change introduced in https://github.com/odoo/odoo/pull/84644 removed the 'token' variable from a call to
the `portal.message_thread` template, which created a bug where a portal user
trying to submit a comment to a task would encounter an "Access Denied" error.

This commit reverts that change.

Task-2832688

closes odoo/odoo#89643

X-original-commit: 29c9eb4d65280dc5b23c89207dd7c2caa6ced596
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Signed-off-by: Xavier <xbo@odoo.com>
2022-04-25 21:32:52 +02:00
Nicolas Lempereur 4c69f52cef [FIX] web: get timezone offset from local time
Currently, the timezone offset is taken from the date with reverse
timezone offset applied.

So if there is a change of timezone offset between the wrong date and
the local date, we apply the wrong timezone.

Example:

- be in "Australia/Sydney" timezone
- select date in datetime field 2021-04-03 16:12:34 (at UTC+11)
- save => time becomes 17:12:34
- change time to 17:12:35 and save => time becomes 18:12:35
- change time to 18:12:36 and save => time becomes 19:12:36
- ...
- this issue is happening until 01:59:59 of the following day

Fix:

When we are selecting "2021-04-03 16:01:23" we will get the timezone
offset from the date "Sun Apr 04 2021 02:01:23 GMT+1000" (at UTC+10)
but the DST change was at "2021-04-04 03:00:00 (UTC+11)" with time
becoming "2021-04-04 02:00:00 (UTC+10)".

With this changeset, we are getting the timezone from the local time,
not from local time with reverse timezone offset applied.

opw-2735369

closes odoo/odoo#89619

X-original-commit: 84eb850af614887f7040bffa71cbb7fd239ba857
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2022-04-25 19:11:34 +02:00
Prakash Prajapati 4b488c2c7e [ADD] project_timesheet_holidays: add test for public holiday and timeoff
task-2727561

closes odoo/odoo#86914

Related: odoo/enterprise#25464
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-04-25 19:11:27 +02:00
Prakash Prajapati 0d1dd59fec [ADD] hr_timesheet: add test for create timesheet with multi-company
task-2727561

Part-of: odoo/odoo#86914
2022-04-25 19:11:27 +02:00
Prakash Prajapati b364b5aa00 [IMP] project_timesheet_holidays: improve test for employee timeoff
task-2727561

Part-of: odoo/odoo#86914
2022-04-25 19:11:26 +02:00
Prakash Prajapati 8e52c36a56 [ADD] hr_timesheet_attendance: add test for timesheet/attendance report
task-2727561

Part-of: odoo/odoo#86914
2022-04-25 19:11:26 +02:00
Jacky (trj) c56b1e618e [FIX] point_of_sale,pos_{sale,gift_card}: product taken in total discount
When showing the discount the to the public, the down payment and gift card products were taken into account in the discount computation shown in the receipt.

This also fix a mistake made in fc546e0481ae0159e67791240833bc1e38a4440f where it was implemented in the wrong place and returning a wrong value in a reduce callback.

closes odoo/odoo#89603

X-original-commit: 597ea7aa3f28ad82e602e1ba5679bb49d2973b78
Signed-off-by: Masereel Pierre <pim@odoo.com>
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-04-25 18:15:24 +02:00
Audric Onockx (auon) 2beaa78d30 [FIX] hr_timesheet : round hour spent correctly
Steps :
Install project and activate Timesheets.
Go to a task and add a timesheet with 30', then click elsewhere.

Issue :
The hours spent adapts, rounding to integer.

Cause :
The digits are not specified.

Fix :
Specify them.

opw-2822018

closes odoo/odoo#89596

X-original-commit: 307f403156f20e56fe91cad5397b3db1b3ae3f99
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Signed-off-by: Onockx Audric (auon) <auon@odoo.com>
2022-04-25 18:15:18 +02:00
Aurélien (avd) 1412c6edf2 [FIX] point_of_sale: speed-up picking creation at closing
Forward-port of PR odoo/odoo#86643.

Add a unittest for multi_step route on Ship Later warehouse to
ensure that the fix 5959d77f344 is not unintentionally reverted.

closes odoo/odoo#89595

X-original-commit: d5fb77e9d4716dd509e2e98ff39f7e1cb91ddaca
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-04-25 18:15:14 +02:00
roen-odoo 84b847020f [FIX] point_of_sale: add warning for SN not set in PoS
Current behavior:
In PoS when you access payment screen with product tracked by SN
and if some of the SN are not set you have no warning.

Steps to reproduce:
- Create product tracked by SN
- Sell it in a PoS
- Don't set the SN
- Click on payment button
- No warning is displayed

Solution:
Add a warning popup to inform the user that he is going
to make a payment with missing SN

opw-2818511

closes odoo/odoo#89565

X-original-commit: c1a4b89e93207d7e18c5f7491db110f0d28ae836
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-04-25 18:15:10 +02:00
Yolann Sabaux f9d6bda792 [FIX] delivery: wrong invoice status for partially delivered orders
Steps to reproduce:
- Select any two storable product that has invoicing policy set on 'Delivery'
- Create a sales order lines with these two products and make sure that one of the lines should have a quantity set to 0
- Add shipping

Issue:
- The Invoice Status has changed to 'To Invoice'

Solution:
Add en extra filter to consider only lines that have not been invoiced.

opw-2750861

closes odoo/odoo#89548

X-original-commit: bfeb5f6317786edfd0fa464fe5798c7f7bc65ac9
Signed-off-by: yosa-odoo <yosa@odoo.com>
2022-04-25 18:15:06 +02:00
Lucas Perais (lpe) 6af8b7f95e [FIX] web: basic_model: applyOnChange with 2 consecutive one2many
The problem is generally due to the use of `var`, this one

https://github.com/odoo-dev/odoo/blob/58a046d2146e884d467cde827f89fa603ed98a3b/addons/web/static/src/js/views/basic/basic_model.js#L1780 followed by an asynchronous call to a function using it

We can therefore summarize the part of the `_applyOnChange` function
that interests us by

```js

for () {
  if (field. type === 'one2many' || field. type === 'many2many') {
    var list;
    ...
    //using list
    ...

    promiseFunction(list).then(function(){
      //using list
    })
  }
}
```

In the case where we have two one2many which follow each other,
this scenario occurs:
  - `list` is initially the first o2m
  - the `promiseFunction` is called with `list` (first o2m)
  - before the promise is resolved the loop continues
  - `list` is `Promise.then()` the second o2m
  - the first call to `promiseFunction` with `list` (first o2m) is done
    - we enter in `Promise.then()`
    - `list` is currently worth the value of the second o2m because
      `list` is a `var`
  - the second call to `promiseFunction` with `list` is finished
    - we enter the `Promise.then()`
    - `list` is currently worth the value of the second o2m because
      `list` is a `var`

Result: `Promise.then()` is called twice with the first o2m and never
with the second

We can see what happened with this code example:

```js
  const array = ["a", "b"];

  const asyncRead = async(value) => {
    console.log("async function arg", value)
    setTimeout(()=>{
      return Promise. resolve(value);
    }, 100)
  }

  const forFunction = () => {
    for (let i = 0; i < array.length; i++){
      var list = array[i];
      asyncRead(list).then(function (){
        console.log("then async function arg", list)
      })
    }
  }
  forFunction()
  /*
    async function arg a
    async function arg b
    then async function arg b
    then async function arg b
  */
```

While if:
  We use `let`
    by replacing `var list = array[i];` with `let list = array[i];`
  OR
  We force the use of `Promise.resolve()` argument
    by replacing `.then(function (){}` with `.then(function (list){}`

We will get:
```js
  /*
    async function arg a
    async function arg b
    then async function arg a
    then async function arg b
  */
 ```
opw-2694855

closes odoo/odoo#89160

X-original-commit: 99cb2f52e109ccf94ac8bd735cd776e84ef04260
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2022-04-25 18:15:01 +02:00
Cedric Prieels (cpr) 75c4468b9a [IMP] project: rename starred field and other generic improvements
- The starred field was renamed as priority.
- The assigned date is now set back to False when the user is unassigned from the task
- An action helper was added to the collaborators view
- The year mode was added to the calendar view of tasks

task-2802506

closes odoo/odoo#87139

Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-04-25 14:42:04 +02:00
Aaron Bohy a40cbf9f04 [FIX] web: action service: do not switchView in dialogs
Have an action with target="new" and a list or kanban view as
first view. This view is displayed in a dialog. Click on a record.
Before this commit, the action service tried to switch view, but
in the action displayed in the background (since we cannot switch
view inside the dialog anyway). As a consequence, if the action in
the background was a window action with a form view, we opened that
form view, which is absolutely not what we want (different action,
different model...). And if the action in the background was a client
action, it crashed, because we can't switch view in those actions.

With this commit, we simply ignore calls to switchView when there's
a dialog opened.

opw 2791201 and 2793678

closes odoo/odoo#89539

X-original-commit: 81f8de82daa47a31e4a33478aeb537f2c9c1519c
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-04-25 11:32:09 +02:00
Aaron Bohy a097215061 [FIX] web: action service: correct breadcrumbs in dialogs
Have an action with target="new" and a list or kanban view as
first view. It is displayed in a dialog, and a there is a control
panel. Before this commit, the breadcrumbs in that control panel
contained the complete history of controllers displayed in
background, which isn't what we want. For instance, clicking on
an element of the breadcrumbs crashed. After this commit, there's
only one element in the breadcrumbs, which corresponds to the
controller displayed in the dialog.

Spotted when investigating on opw 2791201 and 2793678

X-original-commit: 9838bb3a35e8b205fe30ceb5f86dcd81d536d1d0
Part-of: odoo/odoo#89539
2022-04-25 11:32:09 +02:00
roen-odoo a73e69b2bb [FIX] mrp, sale_mrp: set bom_line_id on all moves for kits
Current behavior:
When using 2 steps delivery and selling a kit product, not all
moves had bom_line_id set. So if you go in the transfers you
couldn't always see the "Kit" column in the operations.

Steps to reproduce:
- Activate 2 steps delivery
- Create a Kit with 2 products
- Create a quotation with kit and confirm it
- Go in the delivery
- In WH/Pick you can't see Kit column
- In WH/Out you can see the Kit column

opw-2796974

closes odoo/odoo#89371

X-original-commit: 88c3c3f49393af08e4070c0d2f5cccbec9096c1f
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2022-04-25 11:32:03 +02:00
Pieter Claeys (clpi) 71bc97c19b [FIX] mrp: Preserve component registration steps on backorder creation
Impacted versions: 15.0

Steps to reproduce (starting from ENTERPRISE 15.2):
- enable Work Orders
- create new BoM for a new product
- add 1 operation w/ 1 step (e.g. Instructions)
- add 1 component to BoM with operation_id (Consumed in Operation) = the operation
- Create and confirm a MO with new BoM + 2 Quantity to Produce
- Produce 1 product via the tablet view flow (i.e. complete instruction step + Validate 1 component in "Register Consumed Materials" step + Mark As Done)

Current behaviour:
Backorder is correctly created, but its workorder is missing the "Register Consumed Materials" step

Expected behaviour:
Step is correctly created

Note: same issue occurs with Byproducts having an operation_id (i.e. "Produced in Operation")

Issue is due to when _split_productions() first creates the backorders, they are created without move_raw_ids and move_finished_ids (see: _get_backorder_mo_vals()). When the backorders are created, they auto-create and auto-confirm their workorders. Since a quality point (e.g. operation step) exists for the workorder, the initial _action_confirm will _create_checks() for the quality point, but the "Register Consumed Materials" steps are created by the operation_id values in the move_raw_ids and move_finished_ids which haven't been set yet. This makes it so when the second _action_confirm() is called on the workorders (i.e. after their moves have been set) at the end of _split_productions(), the _create_checks() will be skipped because it assumes all the quality points have been created since one already exists.

Task: 2800975
Community PR: https://github.com/odoo/odoo/pull/87681
Enterprise PR: https://github.com/odoo/enterprise/pull/26437

closes odoo/odoo#89486

X-original-commit: 67524eb948b7e122f33abf344b28b59bd81eb88d
Related: odoo/enterprise#26534
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-04-25 10:27:51 +02:00