Commit Graph
6352 Commits
Author SHA1 Message Date
Adrien Widart 683c02b099 [FIX] repair,mrp,stock: count returned SN products
Suppose a tracked-by-usn and consumed product returns in the stock
thanks to a repair order. Using again this component in a new
manufacturing order will raise an error

To reproduce the issue:
1. In Settings, enable "Storage Locations"
2. Create two products P_finished, P_compo
    - Storable
    - P_comp tracked by USN
3. Update the quantity of P_compo:
    - WH/Stock: 1 x Lot01
4. Create a manufacturing order MO:
    - Product: P_finished
    - Components:
        - 1 x P_compo
5. Confirm, Check availability and Mark MO as Done
    - (Lot01 should be consumed)
6. Create a repair order RO:
    - Product: P_finished
    - Parts:
        - Type: Remove
        - Product: P_compo
        - Lot: Lot01
        - Destination Location: WH/Stock
7. Confirm RO, Start RO, End RO
    - (There should be one Lot01 available in stock)
8. Repeat 4-5

Error: When checking the availability on the MO, Lot01 is correctly
reserved. However, when marking the second MO as done, a User Error is
displayed: "The serial number Lot01 used for component P_compo has
already been consumed" although this lot should be available

When checking the uniqueness of the lot, nothing includes the products
back in stock thanks to the repair orders.

OPW-2701668

closes odoo/odoo#82544

X-original-commit: 3d9355f90fa1dd9436f1745c515c89947ed04de0
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-01-11 15:24:11 +00:00
Florian Damhaut 8f4dc7d00f [FIX] mrp : Removing a workorder broke the continuity
Unlinking a workorder which was in the middle of a chain of workorder created two subchains which both created a product when reaching their new respective ends.
The issue was solve by assuring that when we a link is remove from a workorder chain, their adjacent workorders are linked together using next_workorder_id

opw-2669514

closes odoo/odoo#82553

X-original-commit: a826608044f2a0b50c2ad9ed0228717f9ec66522
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-01-11 14:27:05 +00:00
Florian Damhaut ecd24930e6 [FIX] mrp: Context irrelevant of hidden parameters for stock_mrp
Step to reproduce:
- Inventory > Configuration > Operations Types > Manufacturing (or any other operation type with code 'mrp_operation')
- Change 'Type of Operation' to 'Receipt' (or any other but 'manufacturing')
- Uncheck box field 'Use Existing Lots/Serial Numbers'
- Change 'Type of Operation' back to 'Manufacturing'
- Set correct value for 'Default Source Location' (type Receipt changed the value to 'Vendor', need to fix it)

- Create a storable product with the route 'Manufacture' selected.
- Create a BoM for this product, with a component tracked by lot (Add quantity to component)
- Create a MO for the product > Confirm > Check Availability

Current Behaviour :
Quantity are reserved, but the lot_ids are not visible
The behaviour is due to the fact that hidden parameters still have effect when they should act as their default value. To ensure it's the case, they are set back to their original value when the user switch between configuration to avoid ending in a wrongful configuration.

Behaviour after PR :
Lot ids are shown no matter the hidden configuration of picking type

opw-2680370

closes odoo/odoo#82377

X-original-commit: 22bbf43eba0927bdf27218da16f8435b33756112
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Damhaut Florian (flda) <flda@odoo.com>
2022-01-10 13:52:41 +00:00
JF Aubert 13842ca9ae [IMP] mrp: Add multiple lots components warning to Mass Produce
Mass produce originally prohibited multiple lots components.
Later commit removed this limitation (among others).
This one displays a warning to make sure it is intentional.

task 2633369

closes odoo/odoo#77254

Related: odoo/enterprise#22797
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-12-22 17:55:49 +00:00
JF Aubert f11fcf6bb4 [REF] mrp: split productions
There is 2 major issues with the production of multiple serials number
- Performance issue
- Duplicated code with classic backorder mechanism

The performance issues exist since backorders were create one by one
and `stock.move` and `stock.move.line` are always recomputed. They
are not created in batch neither.

_generate_backorders is removed and replace by _split_productions. The
functionality are the same. Technicaly it does the maximum in batch,
first it creates all the `mrp.production` then all the `stock.move`
and finaly, it splits the existing `stock.move.line` among the new
`stock.move`
It means that the reservation is not recompute anymore during a
backorder process and will remain the same than the splitted production
order.

Performance metrics (10 components):

	|	2   |	10	100	 1000
before	|   0.47s   |  2.84s | 32.25s | 580.53s
-----------------------------------------------
after	|   0.13s   |  0.36s |  2.60s |  35.17s

task 2633369

Part-of: odoo/odoo#77254
2021-12-22 17:55:49 +00:00
Tiffany Chang (tic) 631b111ead [FIX] mrp(_subcontracting): avoid view inheritance conflict
Both mrp_subcontracting and a module in Enterprise both inherit
`mrp.mrp_production_form_view`. This was leading to a conflict where the
Enterprise view could overwrite the invisible=1 attribute added by
mrp_subcontracting, therefore we update the views to avoid this.

Part of Task: 2695173
ENT PR: odoo/enterprise#22637

X-original-commit: 6317c34808d381e54bae2431fec2de4b8503b447
Part-of: odoo/odoo#81649
2021-12-20 15:09:50 +00:00
Tiffany Chang (tic) 509a32c3dc [FIX] mrp_subcontracting: show correct view when subcontracted product
Fixes 2 issues:

Issue 1: wrong view shown when registering strict consumption
To reproduce:
- create tracked product to subcontract
- create subcontract BoM with no tracked components + strict consumption
- create receipt of subcontracted product (remember to select From =
  subcontractor)
- click on `action_show_details` burger button in Operations

Expected result:
- Detailed Operations window with no move lines in it (i.e.
  stock.view_stock_move_nosuggest_operations view)
Actual Result:
- Detailed Operations window with move lines w/ 0 Done
  (i.e. stock.view_stock_move_operations view _ lines also do
  not get filled in when using the `action_assign_serial_show_details`,
  => twice as many lines as needed end up in view)i

Similar issue can occur when using a non-strict BoM + tracked product.

Issue appears to be that conditional was incorrectly updated during
refactoring to allow non-strict BoMs also record components.
stock.view_stock_move_operations view should only appear when all
productions are recorded

Issue 2: Consumption warning wizard not showing correctly
To reproduce:
- same as Issue 1, except consume less than BoM amount

Expected result: Consumption Wizard
Actual Result: stock move view shown instead

Issue was due to 'form_view_ref' value in context of picking view,
therefore we force clear this value everytime we expect this wizard
to open.

Task: 2695173
X-original-commit: b9990a5dab8731a8f69fd07aa73a318fc9d4a808
Part-of: odoo/odoo#81649
2021-12-20 15:09:50 +00:00
Yannick TivisseandVictor Feyens 18952cdc76 [IMP] *: Convert single create method into multi
Taskid: 2703085
Part-of: odoo/odoo#80824
Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-12-14 19:13:18 +00:00
William Henrotin 9bb5c31a92 [IMP] stock,mrp: add indexes on picking type
This commit adds an index on picking_type_id for models stock.picking
and mrp.production.

Filtering on picking_type_id is often done via the Inventory Overview.
This should speed up the list render in case of many object.

Task : 2648449

closes odoo/odoo#80434

Related: odoo/upgrade#3068
Related: odoo/enterprise#22535
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2021-12-07 16:20:07 +00:00
William Henrotin 56e7bcf0cb [REF] *{stock,mrp}*: rename reserved fields
This commit rename product_uom_qty into reserved_uom_qty and product_qty
into reserved_qty on stock move line to stop mistake them with the stock
move quantities fields.

Task: 2648449
Part-of: odoo/odoo#80434
2021-12-07 16:20:06 +00:00
William Henrotin cd9833e4ad [REF] *stock*: rename location destination fields
The stock convention on location name is always to name the destination
`location_dest_id`. It was not the
case on the stock rule model

Task: 2648449
Part-of: odoo/odoo#80434
2021-12-07 16:20:06 +00:00
William Henrotin c146c7d16f [REF] *stock*: rename model stock.location.route into stock.route
Task: 2648449
Part-of: odoo/odoo#80434
2021-12-07 16:20:06 +00:00
William Henrotin 6a23b9bcd6 [REF] *stock*: rename model stock.production.lot into stock.lot
Task: 2648449
Part-of: odoo/odoo#80434
2021-12-07 16:20:05 +00:00
William Henrotin 71489e8fb6 [REF] mrp: remove unnecessary access
As mrp users are by definition stock users too, there is no to redefine
the same access rules on stock objects

Task : 2648449

Part-of: odoo/odoo#80434
2021-12-07 16:20:05 +00:00
Martin Trigaux d99cfd9416 [I18N] *: export saas-15.1 source terms
closes odoo/odoo#80964

X-original-commit: 0663892a34896980008eb0de69aeb58019a67e89
Related: odoo/enterprise#22759
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-07 13:48:53 +00:00
Touati Djamel (otd) e2b965cd89 [FIX] stock, mrp: fix the manufacturing product moves filter
Steps to reproduce the bug:
- Create a storable product > add a BOM
- Create a MO> add the product > confirm > Mark as done
- Go to the product form > click on product moves
- The move linked to the MO is displayed
- Add the "Manufacturing" filter
- No move is displayed

Solution:
Display all "stock.move.line" which are linked to a "stock.move" with a "mrp.production"

Bug2:
The "Manufacturing" filter should be defined in the MRP module instead of the stock
otherwise, users who do not have MRP installed will have access to this filter as well

opw-2697254

closes odoo/odoo#80578

X-original-commit: f4ab29a19f0aaac567da27d4c4d5c79119982bc6
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2021-11-30 12:06:18 +00:00
Touati Djamel (otd) e2d89d0b94 [FIX] mrp: fix the qty in the BOM report
Steps to reproduce the bug:
 - Create a BOM:
    - Set the quantity of the finished product and component as more than 1
- Save > Go to BOM Structure & Cost > the quantity in the input is set on 3
- Print

Problem:
The report generated shows the qty and cost for production of 1 unit of product, regardless of the BOM quantity set in the input

The "_onClickPrint" function tries to get the quantity of the bom in the context,
but since the value of "this.given_context.searchQty" is null, the function will use the default value of 1.
The "searchQty" is only set in the "onchange", so we can manually trigger it when initiating the page so that the "searchQty" is set correctly

opw-2691632

closes odoo/odoo#80524

X-original-commit: dcd3de94f708425ca06527483cf30e21077caab0
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2021-11-30 12:05:59 +00:00
yhu-odoo 79b7967785 [FIX] mrp: cancel leftover moves when create backorder
Previously, when underconsumption occured, we split the move (in
post_inventory). And if backorder, the moves not done would be linked to
the new backorder MO (when backorder MO is created).
After 8883c06ada, we create backorder MOs
before _post_inventory, making it so the moves not done will not be
linked to the backorder MOs and reserved qtys are not released.
To fix, we set cancel_backorder to be true to cancel all the leftover
moves and release the reserved qty.

Task-2697611

closes odoo/odoo#80446

X-original-commit: cffb2b455d73f64d96f91b9e0301c346989eae63
Signed-off-by: Tiffany Chang <tic@odoo.com>
2021-11-26 12:06:20 +00:00
Adrien Widart 42331b3fb5 [FIX] mrp: fully cancel MO even if no component
When cancelling a manufacturing order that does not include any
component, the associated moves won't be cancelled.

To reproduce the issue:
1. Create a storable product P
2. Create & Confirm a MO for 1 x P
3. Cancel the MO
4. Consult the form page of P

Error: The forecasted quantity of P is 1 instead of 0

The finished move associated to the MO hasn't been cancelled. Since [1],
we have the possibility to process MOs without any component, so the
cancellation process shouldn't be bypassed anymore.

[1] bf5e1debf9

OPW-2691422

closes odoo/odoo#80407

X-original-commit: 2adff866a598fc8fb872fb8127875fbb7cc7335c
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-11-25 15:19:53 +00:00
Tiffany Chang (tic) 481806137c [FIX] mrp: sync operation's work center and bom
Fixes 2 issues:
1 - odoo/odoo#61027 made mrp.routing.workcenter.company_id =
  self.bom_id.company_id. This made it so the work center selection is
  empty until a BoM is selected, which is confusing to users. To make it
  less confusing, we switch the order since we expect users to fill in
  the fields from top to bottom.

2 - odoo/odoo#65628 made it so the BoM can be changed. This made it so
  it's possible to save the record and have the company of the BoM and
  the work center not match. This can lead to a usererror when users try
  to start the WO associated with the operation. Steps to reproduce:

  - create a new operation from Configuration > Operations
  - select a BoM from company 1 and a Work Center from company 1 + save
  - edit and change BoM to a BoM from company 2 and DO NOT change the
    Work Center

  Expected result: save error
  Actual result: Save will be allowed, but WO will throw an usererror
                 when you try to start it.

  To fix this, we prevent the user from saving when the workcenter
  company does not match the BoM's (if both have a company_id assigned).

closes odoo/odoo#80337

Task: 2682365
X-original-commit: f77c9560ad304940610d797018246a8f5d32f721
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
2021-11-24 15:49:14 +00:00
Martin Trigaux a8e50921af [FIX] *: correct typos and English errors
closes odoo/odoo#80181

X-original-commit: efd178daee689192d4e930a075475587038b3e0d
Related: odoo/enterprise#22439
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-11-22 14:48:04 +00:00
Touati Djamel (otd) 5646476dbf [FIX] mrp: improve mrp BOM report
Steps to reproduce the bug:
- Create a BOM:
    - set the quantity of the finished product and component as more than 1
    - save > print > BOM Structure

Problem:
The report generated shows the qty and cost for production of 1 unit of product, regardless of the BOM quantity

opw-2691632

closes odoo/odoo#80145

X-original-commit: d08b0abd56a04a23e155b345bf1796a031321f2f
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2021-11-22 07:49:55 +00:00
roen-odoo f12c91d162 [FIX] mrp : BoM report
Current behavior:
When creating a BOM with quantity different than 1 (here 12) with operation duration 1 minute and work center capacity 23
The BoM Structure & Cost report only changes the time for the operation when the quantity is > 276
However, when planning a MO the expected duration changes to 2 minutes when the quantity is > 23

Expected behavior:
Expected duration should be the same in the MO and BoM report

Steps to reproduce:
- BOM with quantity different than 1 (here 12)
- operation duration 1 minute
- work center capacity 23
- go in BoM report

closes odoo/odoo#80048

X-original-commit: cf90943875da25456cde4faf967ce27d886c0851
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2021-11-19 09:58:45 +00:00
Adrien Widart 2a19948833 [FIX] mrp: configure in and out moves of draft MO
In multi steps configurations, the additional products of a MO could be
missing in the associated picking

To reproduce the issue:
(Use demo data)
1. In Settings, enable "Multi-Step Routes"
2. Update the current warehouse:
    - Manufacture: 2 steps
3. Create a MO for product "Table Top"
4. Edit the MO:
    - Add 1 x Screw in the components
5. Confirm the MO
6. Open the generated Picking

Error: The operations only contains one line for "Wood Panel". There
should be a second line for the "Screw"

When adding the new component, a new stock move is created but the
latter does not have any `group_id` defined. This is the reason why the
generated picking does not include this stock move.

OPW-2671995

closes odoo/odoo#79894

X-original-commit: 720f29fc6b7626ae734187242870a27065441ac2
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-11-17 08:26:19 +00:00
Adrien Widart ef158c5f36 [FIX] mrp: set component's lot as readonly in MO
Updating the producing quantity may wrongly change the consumed quantity
of tracked products

To reproduce the issue:
1. Create two storable products P1, P2:
    - P2 is tracked by lots
2. Update P2's quantity >= 10
3. Create a BoM:
    - Product: P1
    - Components: 1 x P2
4. Create and confirm a MO for 10 x P1
5. Check availability
6. Edit the MO and set the consumed quantity of P2 to 10
7. Edit the MO and set the producing quantity to 8

Error: The consumed quantity of P2 becomes 1

When saving the MO, it also writes the `lot_ids` on `move_raw_ids` while
it shouldn't. As a result, it triggers method `_set_lot_ids` for no
reason and lead to an undesirable behavior.

OPW-2667412

closes odoo/odoo#79757

X-original-commit: 66a1e96f88b3b06f40f9fd8035fca61d4e2a4e3a
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-11-15 12:53:27 +00:00
roen-odoo e1a55d8324 [FIX] mrp : bom report duration for dozens
Current behavior :
When a bom is created with uom set as dozens the report
operations time is not correct. For exemple if the operation
time is 10 minutes. The operation time for a dozen should be
120, but at the moment it's 10 minutes

Steps to reproduce:
Have a product in units.
Create a bill of materials in dozens.
Have a operation where the workstation that has a capacity of 1.
Look at the Bill of material cost and structure even though it uses a dozen it shows
the operation time for one unit.

opw-2669899

closes odoo/odoo#79624

X-original-commit: 11f905737ea73aaf26dc792639abf66549a31864
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2021-11-12 12:49:52 +00:00
Tiffany Chang (tic) b1e2610390 [IMP] mrp: remove obsolete reception report label
In a previous commit, the reception report label was refactored to be
better, making this report obsolete. For migration purposes, we remove
it in this separate commit.

Previous COM PR refactoring: odoo/odoo#76411

closes odoo/odoo#76147

Task: 2632884
Related: odoo/upgrade#2815
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-11-09 13:19:51 +00:00
Aurélien (avd) f74eb30709 [FIX] mrp: restrict _post_process_scheduler search domain
stock.orderpoint._post_process_scheduler confirms
productions after procurements have been run.

This was introduced to avoid conflict between
procurements, conflicts that can happen e.g. in
the purchase_mrp module.

However, currently action_confirm might
also be called on done or cancelled productions.
That can happen if there are already been lots
of procurements for the same product/orderpoint,
i.e. MO with the same values have been created multiple times.

To avoid this, add ('state', '=', 'draft' in the search_domain.

opw-2666960

closes odoo/odoo#79437

X-original-commit: 11c7b92f90804a4d73833e22c071e1665058fbdb
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-11-05 16:51:51 +00:00
Florian Damhaut df28381992 [FIX] mrp : Auto-fill Number of SN for mass produce
Current Behaviour :
When mass producing with SN, the default number of SN to generate is set to 0.
Behaviour after the PR :
When mass producing with SN, the default number of SN to generate is the number of item to produce.

opw-2680306

closes odoo/odoo#79431

X-original-commit: 38e5d002acc2e516987acc0afe38648473fff708
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Damhaut Florian (flda) <flda@odoo.com>
2021-11-05 16:02:59 +00:00
Tiffany Chang (tic) 1c97b75c97 [IMP] mrp,stock: always show product in reception report labels
Previously the reception report > "print labels" would only print the
picking name (or SO if provided) + delivery address (if provided) when
not for a MO. Label has been updated to include the product name.

During this update a few other related improvements were made:
- make the label based on stock.move (so extending is no longer
  needed in MRP)
- formatting of label is improved so now address will be truncated
  instead of wrapping (and potentially losing lines at end of address)
- line padding is reduced so we can fit more lines in the label
- "Print Labels" button at source level will now be enabled when its
  corresponding "Assign All" button is pushed (previously only the
  "Print Label"s of each moves' line was enabled.

Part of Task: 2632884

X-original-commit: 9774c1ab1d68cf095b64a82b56f100d747fc8a56
Part-of: odoo/odoo#79408
2021-11-05 13:48:50 +00:00
Touati Djamel (otd) fdc2ed1ee6 [FIX] mrp_workorder: fix the WO planned date
we recently fixed this issue via this commit: https://github.com/odoo/odoo/pull/78377/commits/f3bb0dcc013960d6a43b9182b7daa5d33cab5aaa
But we forgot to add a “break” in the loop in order to go to the next available interval when the current interval duration has been used

the test has been modified to better cover the use case

closes odoo/odoo#79361

X-original-commit: b8201b7a523b66cfdbb4a220250608e15d67190c
Related: odoo/enterprise#22096
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2021-11-04 13:40:52 +00:00
Adrien Widart 714fc63ac4 [FIX] mrp: compute MO's components status
The component status of a MO is not correctly computed

To reproduce the issue:
(Use demo data)
1. Create and confirm a MO for 1 x [FURN_9666] Table
2. Unlock and edit the target of To Consume Qty:
    - For [FURN_8522] Table Top: 0.1
    - For [FURN_2333] Table Leg: 0.1
Error: The Component Status of the MO becomes "Available" while Table
Top and Table Leg are not available.

Due to the signature of `float_compare`:
https://github.com/odoo/odoo/blob/56f8c1c0487bf95325ca859e2f266d1beed28ad4/odoo/tools/float_utils.py#L127
`move.product_id.uom_id.rounding` is implicitly given to
`precision_digits`, which is incorrect.

OPW-2669931

closes odoo/odoo#79362

X-original-commit: c7077dedd63ad317517ad383855821e6570b963d
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-11-04 12:58:48 +00:00
yhu-odoo 8e599caf7a [FIX] mrp: trigger RR after change product qty
In 1e93c161ca454313436b65427542db961f6ddcdd we trigger RR when
confirming a MO. Same thing should be done if we changed the product qty
for a confirmed MO.

Task-2653116

closes odoo/odoo#79332

X-original-commit: 22eb5c38ff45f4e5cd5d2025d31960efa051ad6b
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-11-04 10:22:02 +00:00
Touati Djamel (otd) ec109b48ad [FIX] mrp_workorder: calculate correctly the WO scheduled end date
Steps to reproduce the bug:
- install mrp_workorder
- Create a new work center which will work every day from 8:00-9:00
- Create a BOM with component and operation, which takes 24 minutes in your work center
- Create 4 MO for this bom
- Set manually scheduled date > 1 MO should have a different date than others, e.g:
    - 3 MO → 01/dec/2021 08:00
    - 1 MO → 02/dec/2021 08:00
- Plan the MO which has different date than others

The ```planned_end_date``` is not calculated correctly

Current behavior before PR:
MO_1 : 01/dec/2021 08:00 → 01/dec/2021 08:24
MO_2 : 01/dec/2021 08:24 → 01/dec/2021 08:48
MO_3 : 02/dec/2021 08:00 → 02/dec/2021 08:24
MO_4 : 02/dec/2021 08:24 → 02/dec/2021 08:24

Problem
The MO_4 should only last 20 minutes, while it lasts 23 hours and 48 minutes.

opw-2648065

closes odoo/odoo#79184

X-original-commit: b02cdbbe36ead262331fc74ec3039c8ded313d3d
Related: odoo/enterprise#21992
Signed-off-by: Rémy Voet <ryv@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2021-10-29 12:39:49 +00:00
Touati Djamel (otd) 6b8c367a16 [FIX] mrp: display a warning when archiving a used work center
If a work center is used in any routing, a warning will be displayed when it will be archived

opw-2658596

closes odoo/odoo#79185

X-original-commit: a05f4e05b9f4df88948ac3dfc1522828b63bfb64
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2021-10-29 11:54:25 +00:00
Tiffany Chang (tic) dd12194834 [FIX] mrp: allow backorder immediate production for SN product
Steps to reproduce:
1. Create Manufacturing Order with quantity >1 of Serial Tracked product
2. Press Mark done. (One Product will be immediated produced with a new
   SN auto-created)
3. Create Backorder
4. Press Mark done on the backorder

Expected Result:
Backorder will also be able to immediate produce and auto-create a new SN

Actual Result:
Usererror because env is still referring to original MO and tries to
produce the same SN again.

closes odoo/odoo#79151

Fixes: odoo/odoo#78134
X-original-commit: 58cd10eb7277312d7d6c5e9da7b52dcbdb114734
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
2021-10-29 07:00:44 +00:00
William Henrotin 3a1473c75c [REF] *stock*: rename move_lines into move_ids in stock.picking
closes odoo/odoo#78732

Task: 2673000
Related: odoo/enterprise#21815
Related: odoo/upgrade#2956
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2021-10-27 15:48:51 +00:00
Tiffany Chang (tic) 3b48029022 [FIX] mrp: don't default additional components "To Consume" to 1
Previous PR: odoo/odoo#69483 changed the default 'product_uom_qty' from
0 to 1. This was intended for Planned Transfers that are still draft to
default the demand to 1. Unfortunately this made it so new lines added
to confirmed MOs would default their "To Consume" to 1 even when the MO
is locked and the form says 0 (value would auto-switch to 1 after
saving). This commit makes it so the added lines correctly save as 0
again.

closes odoo/odoo#79041

Task: 2677212
X-original-commit: 56a05aeed64b36ca34ff6466c2b890951bdfbc61
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
2021-10-27 07:23:54 +00:00
Rémy Voet (ryv) 88bacad9a0 [FIX] stock,mrp: fix confusing labels
"Material Availability" vs "Component Availability" label means
the same thing but it shouldn't.
- Rename these and add a help string for both fields.
- Change decoration to be green if the MO Readiness is
'ready'.
- The logic of `_compute_*_availability` doesn't take in account the
'ready' `(reservation_)state` to distinct clearly both fields
(`(reservation)_state` vs `*_availability`)

task-2668922

closes odoo/odoo#79033

X-original-commit: acc385137a6a59f3632d91a7fcabd5ab42e8bc7f
Signed-off-by: Tiffany Chang <tic@odoo.com>
2021-10-26 19:40:56 +00:00
Rémy Voet (ryv) de09253d53 [REF] stock,mrp: move assets to be lazier
Move some file to other asset bundle to be load
less.

task-2643681

closes odoo/odoo#77174

Related: odoo/enterprise#21172
Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
2021-10-22 08:38:33 +00:00
Rémy Voet (ryv) 068dadcd09 [REM] mrp: remove unused widget bullet_state
During the refactor for v14 the bullet_state was not used
anymore (used for product_availability of workorder).

task-2643681

Part-of: odoo/odoo#77174
2021-10-22 08:38:33 +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
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
Tiffany Chang (tic) 9a4fae9e06 [FIX] mrp: control archive operations within form view
PR odoo/odoo#76376 made it so operations (of a BoM) can now be
(un)archived in the list view. This commit makes it so we can also do
the same in the form view as well as see the "Archived" ribbon in the
form view.

Part 3 of Task: 2660820

closes odoo/odoo#78094

X-original-commit: e995860157becf34300365ac09e12ae57512e22a
Related: odoo/enterprise#21569
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-10-15 09:29:42 +00:00
Rémy Voet (ryv) b33983d532 [REF] stock*,mrp*: clean setUp vs setUpClass
In a lot of test class, we use `setUp` instead of
`setUpClass`. `setUp` is execute for each test method and `setUpClass`
will be execute only once by Class (and use savepoint + rollback).

Then change setUp into setUpClass reduce the time to make all tests
and avoid to repeat this error for the future.

closes odoo/odoo#78082

Related: odoo/enterprise#21563
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-10-13 18:24:16 +00:00
JF Aubert 92049fc165 [FIX] mrp,mrp_workorder: Fix (+) generate serial number button
The generate serial number button uses the stock.lot.serial sequence by default
(default value for name of stock.production.lot)
Serial Mass Produce (and other parts) allow to generate serial numbers
starting from a user supplied initial value.
This fix makes the button generate the next serial number
according to the last generated.

task 2647238

closes odoo/odoo#78258

X-original-commit: b80259dff3aaafb9d11af9d936f5106bdf5ed781
Related: odoo/enterprise#21641
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: Jean-François Aubert <ajf-odoo@users.noreply.github.com>
2021-10-13 06:03:37 +00:00
Mathieu Duckerts-Antoine 85b8a95116 [REF] *: clean some useless %% in xml files
The commit https://github.com/odoo/odoo/commit/1b40e9265f88f57aaaf311bb8fae3d1fd1966d7d
allows to get rid of most escapings %% in xmls but there were still occurences
of useless %% in some of them. We remove them.

closes odoo/odoo#78069

Related: odoo/enterprise#21553
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-11 12:34:47 +00:00
wan 9b0baa3aa4 [FIX] *: product back2basics post-freeze fixes
This should have been a fixup of 37eb0dfbb54db1c062276cd8c172bf8dac9e557b but we needed
to freeze 🤷‍♂️

closes odoo/odoo#77344

closes odoo/odoo#77876

Related: odoo/enterprise#21425
Related: odoo/enterprise#21467
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-10-11 10:15:49 +00:00