Commit Graph
6529 Commits
Author SHA1 Message Date
Triet Ngo aa14a8027c [IMP] mrp: Allow multi-edit workorder
This commit allows users to multi/mass-edit the Work Order fields

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:59 +02:00
Triet Ngo d494f5988a [IMP] mrp: Add setup/cleanup time to Workcenter Specific Capacities
- Add columns setup/cleanup time to Specific Capatities of Workcenter
- Take into account these 2 fields when compute expected duration in WO

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:59 +02:00
Triet Ngo a968404a84 [IMP] mrp: UI Improvement of review split window field rearrangement
rearrange the fields of the tree from
Quantity, User, Date to Date, User, Quantity

task_id: 2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:59 +02:00
Triet Ngo e2d4586ac7 [IMP] mrp: Improve UI of Manual Consumption field on BOM
Auto mark manual_consumption as True as soon as the component is use in
an operation and make the field read-only

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:58 +02:00
Triet Ngo dae82e7aae [IMP] mrp: UI Fix for Lot/serial column in MO form view
The commit modifies the following:
- add tooltip : 'Displays the consumed Lot/Serial Numbers consumed.'
- Change the column Serial Numbers to also display lot number
- Make the column read-only

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:58 +02:00
Triet Ngo 562e01eb28 [IMP] mrp: Match qty field in Work Order kanban view
Currently, the kanban view show qty_production. However, the Listview
show the qty_remaining. So this commit match the field for 2 views (both
should show qty_remaining)

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:58 +02:00
Triet Ngo 5f684778f4 [IMP] mrp: Add color to warning multi-lot mass produce
When mass producing from several reserved lots, we display a warning
message that the lot reservation is 'multiple'. This commit displays
that message in red.

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:58 +02:00
William Henrotin 2c91ad3ae8 [FIX] mrp: remove onchange in import hack
Since d7716f071d, the onchanges to create the stock moves in mrp
production have been replaced by computes.
There was a hack in the create() method to trigger the onchanges in case
of import. As those onchanges do not exist anymore, this hack needs to
be remove too.
The compute methods are called naturally in imports.

closes odoo/odoo#99434

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-09-01 19:17:36 +02:00
kir-odoo 3bb348bdde [FIX] mrp: mo split and merge fix
This commit fixes two bugs:
1) Wrong source location

    Before this commit:
    - Source location is incorrect after merging MOs and 3-step manufacturing is selected.
    - Operation type is incorrect after merging MOs

    After this commit:
    - Set the source location from the correct picking_type's value while merging MO.
    - Set the Operation type for the merged MO to be the same as the original MOs';

2) Traceback when splitting mo

    Before this commit:
    - When splitting a MO without a "responsible user" set then boom it's throwing traceback

    After this commit:
    - The "responsible user" is no longer required which matches the existing MO behavior

TaskID - 2754217

closes odoo/odoo#99374

X-original-commit: 67e3f2f66aeb1aa1a93ad5091af7c0375f6d9a93
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-09-01 15:33:15 +02:00
Stefan-Calin Crainiciuc (stcc) 592f39eba4 [FIX] mrp: scraps have wrong destination location
Steps to reproduce:

- Manufacturing app > Operations > Manufacturing orders > Create
- Set product to [FURN_7800] Desk Combination > Save > Confirm
- Click on scrap, choose any product > Done
- Edit the manufacturing order > set the quantity to 1/1 > Save

An error pops up: You cannot change the UoM for a stock move that has
been set to 'Done'.

This happens because the scrapped product has its destination location
wrongly set to the production location of the manufacturing order.
Because of this, it is considered as a component of the manufacturing
order. The scrap is also confirmed right after creation, so its state
is set to 'done'. Finally, when confirming a manufacturing order, all
of its component moves are also confirmed, hence the error.

This commit prevents the override of the scrap's destination location,
so that it is not wrongly considered a component anymore.

The commit also adds tests for the override method, added in
commit 0b247ab17ccc5be0c2058ef92ccf3502c97e0bb3

opw-2945182

closes odoo/odoo#99218

X-original-commit: 81820d4df5f23d9b6b2701e513ada89b528a865a
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-08-30 21:25:25 +02:00
Tiffany Chang (tic) e4988b70ab [IMP] stock{_account}: add reference opening magic in list view
The move line form view is too technical for the average user so instead we
can to auto-magically open the reference document instead (picking or MO
only for now).

We do the same with stock valuation layers as well, but this feature
will not be available until its custom JS is converted to OWL

"product moves" part of b2b task: 2882539

closes odoo/odoo#97109

Related: odoo/enterprise#29974
Related: odoo/upgrade#3819
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-08-29 23:46:36 +02:00
Tiffany Chang (tic) f752b98889 [IMP] mrp, stock{_account,_picking_batch}: update inventory menus
- reorder/rename/remove menu contents for "Inventory" and "Reporting",
  including:
 - removed "Forecasted Inventory" menuitem since this view is no longer
   considered useful (code for view to be removed in separate commit)
 - removed "Stock Moves" (moves report) menuitem
 - renamed "Product Move" (move lines report) menuitem => "Moves
   History", this will also be reflected in any "History" buttons that
   open this view from other views.
 - made "Inventory Report" menuitem visible only when applicable (i.e.
   multi-location or consignment is active/debug mpde)
 - made "Run Scheduler" menuitem only available in debug mode (
   main_flow_tour updated to skip scheduler click since general flow is
   expected to still the same/work)

Goal of renaming/ordering of menuitems is to clean them up and make them
more intuitive for users.

- "Run Scheduler" in mrp menus has also been made debug only viewable as
  well to mirror the inventory change.

"menu" part of b2b task: 2882539
ENT PR: odoo/enterprise#29974

Part-of: odoo/odoo#97109
2022-08-29 23:46:33 +02:00
Ahmed Khalaf (ahkh) 24306ca244 [IMP] stock,mrp: remove lazy_column_list
Removes legacy component js_class `lazy_column_list` as it loads
legacy views.

closes odoo/odoo#98881

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-08-29 22:43:31 +02:00
Denis Ledoux 8b91cab67f [IMP] base: remove groups_id from ir.ui.view
The goal of this revision is to get rid of the `groups_id` field of the model `ir.ui.view`.

- This feature wasn't really known or used by most developers,
   and not straight-forward to understand.
   Removing it allows one less complicated thing to learn for developers.
   Besides, thanks to odoo/odoo#95729,
   changing the behavior of the `groups=` attribute,
   we can easily get rid of this `groups_id` feature
   by simply adding `groups=` in the elements of the views
   using the `groups_id` field, it will have the same effect:
   adding the elements in the view only for the users part of the specified group.

- By getting rid of the groups_id many2many field on ir.ui.view,
   it makes possible to cache the view architecture without
   requiring to use the groups in the cache key.
   Currently, if we want to cache the view architecture,
  it would be required to use the intersection of the user
  groups with the groups_id groups of the view,
  making it costly to compute the cache key,
  therefore altering the performance point to cache the view
  architectures.

Part-of: odoo/odoo#98551
2022-08-29 22:42:50 +02:00
svs-odoo 81c801c894 [IMP] mrp: BoM overview button in forecast report
In the product's forecast report, if the product has a BoM, a button is
displayed to go to the BoM overview report.

task-2628323

closes odoo/odoo#93194

Related: odoo/enterprise#28191
Related: odoo/upgrade#3686
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-08-26 17:16:42 +02:00
clesgow 2b2a7712e1 [IMP] mrp: Add automatic Days to Prepare MO
Since the new Overview report can compute the lead days and availability
delays from a BoM and all of its components and/or subassemblies, we can
use this data to compute the days that would be required to resupply all
components from a BoM.

So we add a button to compute it directly on the product form.

Task-2628323

Part-of: odoo/odoo#93194
2022-08-26 17:16:42 +02:00
clesgow 02cd750da6 [REF] mrp: change BoM Structure&Cost into Overview
Changes "Structure & Cost" report to "Overview", as the goal for this
report is improved.

The point is to have on a single report all components and sub-assemblies
that make it up, in parallel with the route and lead times associated to
each. This way it becomes easier to identify issues, such as:
- Missing routes.
- Longer lead times on a specific sub-assembly.
- Unavailable component in the foreseable future.
- ...

Also did the conversion to OWL, changing drastically the structure of
the report.

Task-2628323

Part-of: odoo/odoo#93194
2022-08-26 17:16:41 +02:00
FrancoisGe d531848034 [REF] mrp: Convert MrpFieldOne2ManyWithCopy to owl
The legacy field MrpFieldOne2ManyWithCopy added a control create
that performed an action when clicked.
In the new listRenderer we have added the possibility to define control
action buttons. So it is no longer necessary to create a custom field
for this use case.

Part-of: odoo/odoo#97558
2022-08-23 16:28:57 +02:00
Denis Ledoux 0501bbd62e [IMP] base: uniform "groups" in back-end view
This revision is to make uniform the behavior of the `groups` attribute
on the Python model fields
and on the node in the view architecture.
In both cases, remove the node from the view completely.

Before this revision,

in a back-end view:
 - In the Python model, if a field has the `groups` attribute set
   and the user is not part of
   the groups, the field is removed, completely, from the view.
 - In the view architecture, if a node has the `groups` attribute set
   and the user is not part of
   the groups, the node is made invisible (not completely removed, just
   made invisible).

in a front-end view:
 - if a node has a "groups" or "t-groups" set and the user
   is not part of the groups, the node is removed from the view.

So it's 2/3 cases removing nodes restricted to a group.
and 1/3 case making invisible nodes restricted to a group.
It's simpler to have a uniform behavior for the 3 cases,
simpler to understandard for developers.

In addition, this will help for the goal to cache back-end views.
It makes possible to convert views using the `groups_id` field
by moving the content of these views directly
in the view to which they add content which is suppose to be completely
removed when the user has not the according group.
By getting rid of the `groups_id` many2many field on `ir.ui.view`,
it makes possible to cache the view architecture without
requiring to use the groups in the cache key.
Currently, if we want to cache the view architecture,
it would be required to use the intersection of the user
groups with the `groups_id` groups of the view,
making it costly to compute the cache key,
therefore altering the performance point to cache the view
architectures.

closes odoo/odoo#95729

Related: odoo/enterprise#29592
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-08-19 19:10:39 +02:00
Vikash Tiwari 8263d0b496 [FIX] mrp: set default Operation Type in picking
Purpose
======
When creating a specific Operation Type of type 'Manufacture' the default
operation type is not the correct one on object creation.

So in this commit, we set default `Operation Type` in picking when Type of
Operation is `Manufacture`.

taskID - 2939078

closes odoo/odoo#98145

X-original-commit: b28c44a38698018ebbbc420f6567c17b2b97c279
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-08-19 10:31:06 +02:00
Touati Djamel (otd) f4e9e15618 [FIX] mrp: avoid a traceback when using SN in a transfer
Steps to reproduce the bug:
- Go to Inventory→ Configuration→ Warehouse Management →Operations Types
- Go inside “Receipts”, and enable the checkbox “Create New Lots/Serial
Numbers for Components” and `Use Existing Lots/Serial Numbers`under the
traceability section
- Create a receipt transfers with a traceable product
- Mark as to do the transfer
- Try to add a SN for the product

Problem:
Traceback is triggered: “key error: raw_material_production_id”
because we use this field to add it in the context from the parent in
the `stock.move.line` view:
https://github.com/odoo/odoo/blob/15.0/addons/mrp/views/stock_move_views .xml#L53

But this field is not present in all views of the `stock.move` model

Solution:
To avoid adding this field in all the `stock.move` views, it is better
to add it in the context from the `python` code

closes odoo/odoo#98110

X-original-commit: 545713ae0a559e7f2747dd3cb4211ab752e1ef0c
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-08-16 09:19:28 +02:00
JF Aubert 144dd4c7f9 [FIX] mrp: fix workorders duration expected
_split_productions wrongly compute duration expected.

task: 2925901
related to task 2884562

closes odoo/odoo#98029

X-original-commit: fb1abddb20131f087d39abd1b87e920acd7282a4
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-08-12 11:29:00 +02:00
Stefan-Calin Crainiciuc (stcc) 2e6b64cfab [FIX] mrp: correct barcodes on production order report
Steps to reproduce:

- Inventory app > Settings > enable barcode scanner
- Manufacturing app > Create a new manufacturing order
- Under components, add a product that has a barcode
- Save > Print > Production order

The barcodes of the products on the report all encode the
same (incorrect) value, which is the manufacturing order name.

This commit changes the barcode value to the corresponding
barcode string of the products.

opw-2930848

closes odoo/odoo#97968

X-original-commit: 71d4d977d42e69e8e3d7e069098707b84812ee07
Signed-off-by: Adrien Widart <awt@odoo.com>
Signed-off-by: stcc-odoo <stcc@odoo.com>
2022-08-11 17:57:20 +02:00
William Henrotin 360924b4b7 [FIX] mrp: do not compute unit_factor at mrp install
Installing mrp on a large database will take lots of time computing the
unit_factor of stock_moves created in stock. As this value is only
needed in mrp, this commit bypass the computation for moves that have
been generated before the mrp installation

closes odoo/odoo#97750

Task: 2918852
X-original-commit: a2f064446b1e232efc3e6924879f63b79e0bc986
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-08-11 17:56:48 +02:00
stefanorigano (SRI) af90e9f754 [FIX] mrp: mrp.report_bom_search design
Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2896849

closes odoo/odoo#94767

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-08-11 09:35:47 +02:00
stefanorigano (SRI) 07a465c792 [IMP] mrp: revamp scss
This commit improves the design and removes unnecessary SCSS.
Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2896849

Part-of: odoo/odoo#94767
2022-08-11 09:35:47 +02:00
Victor Feyens 546721e441 [REF] product: test infrastructure
* commons & setup refactoring:
  * convert setUp to setUpClass
  * move setups where needed (stock/mrp commons or specific test
classes)
  * create test data in batch (faster, less sql queries & batched
operations)
* move most tests post-install to allow runbot splits
* by default, run tests without mail logic
* by default, run tests in a consistent environment (fixed currency
imposed in the BaseCommon)
* refactor existing tests to use new commons data (while trying to keep
diff reduced)
* add dedicated test file to test the common data
* use mute_logger to reduce useless test logs (less spam to scroll in
logs, less data on runbot builds, ...)

Part-of: odoo/odoo#96791
2022-08-08 12:33:03 +02:00
stefanorigano (SRI) 71611ff3c0 [REM] *: drop bg-muted class in favor of bootstrap defaults
Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2918463

Part-of: odoo/odoo#97051
2022-08-04 13:54:14 +02:00
Nicolas Pierre 92744b7895 [FIX] mrp: allow creation of QC for MO backorders
Since https://github.com/odoo/odoo/pull/77254, Quality Checks are not
created on the backorders of a MO because the moves of the backorders
are not confirmed anymore. We therefore create the QC of the backorders
at the confirmation of the workorders.

closes odoo/odoo#97296

Task-id: 2901900
Enterprise-pr: https://github.com/odoo/enterprise/pull/29476
X-original-commit: 702dd5c902c40972e4362d28c8f10a1eb911a241
Related: odoo/enterprise#30033
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-08-02 13:06:36 +02:00
Martin Trigaux ffc525419a [IMP] base: avoid render with env mixup
The render API was confusing as mixing the access to the report and
the rendering env.

The ambiguity was present for code such as
`report.sudo()._render(record_ids)` where it was not clear if the
`sudo()` is needed to access to `report` or to `record_ids`. For low
priviledge users (such as portal or public), it was common to use
`report.with_user(SUPERUSER_ID)._render(record_ids)`.

This PR changes the render methods signature to be `api.model`. The
`report_ref` can be:
- ir.actions.report external id
- ir.actions.report id
- ir.actions.report recod
- `report_name` value

This will allow to call the report methods with any user and no longer
need to use `with_user(1)` to render reports as public user.

Task-id 2670865

closes odoo/odoo#91341

Related: odoo/upgrade#3650
Related: odoo/enterprise#27323
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-08-02 11:48:46 +02:00
Fabien Pinckaers 3363e55cac [IMP] cleanup of help messages in all modules
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
   fields having a tooltip in the future UI.
4/ some cleanup of existing messages too

The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX

closes odoo/odoo#97279

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-08-02 00:26:53 +02:00
Touati Djamel (otd) 2ab878aecb [FIX] mrp: do not confirm empty production with MTO rule
Steps to reproduce the bug:
- Create a storable product “P1”:
    - routes:
        - MTO
        - Manufacturing
- Create a SO:
    - Select the product “P1”
    - Confirm the SO

Problem:
The created MO is in confirmed state instead of draft.

This blocks the user, for example imagine that he has configured
the product with a first BOM without components and 2 others with
components. when the MO is created, the first bom will be selected,
and as the MO will be confirmed, the user will not be able to
select another BOM

Solution:
Since the MTO rule is not linked to an order point, we could be more
flexible, so the production created via `_run_manufacture()` without
bom or with a bom without component and operation via the MTO mechanism
will not be confirmed

opw-2897267

closes odoo/odoo#97099

X-original-commit: c623478aba040c0493e6da8a67c9742880572199
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-07-29 17:13:02 +02:00
Touati Djamel (otd) d108db36ca [FIX] mrp: prevent the creation of component SN if option is disabled
Steps to reproduce the bug:
- Go to Inventory→ Configuration→ Warehouse Management →Operations Types
- Go inside “Manufacturing”, and disable the checkbox
“Create New Lots/Serial Numbers for Components” under the traceability
section
- create a MO with a traceable component
- Confirm the MO

Problem:
You can create a new SN for the component without any warning,
while the user is supposed to be blocked by a user error:
https://github.com/odoo/odoo/blob/master/addons/mrp/models/stock_lot.py#L11-L16

The solution:
We need to add the `active_mo_id` key in the context so that the user
error will be triggered

opw-2900256

closes odoo/odoo#96648

X-original-commit: 6d0ddc388d1c389e1911a6bb1c59c252870da1a7
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-07-29 13:11:04 +02:00
PNO 33ed562cab [FIX] mrp: Wrong replenishment order notification
On the commit 69dcdd4, the order='create_date desc'
 was removed and the way of getting the MO for the notification changed. Now, the context is used, it should be written_after instead of written_date.
(The MO created is correct, only the notification is wrong)

OPW-2877457

closes odoo/odoo#96856

X-original-commit: b80287b265a4c01babedcbb58459c35d36a48066
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-07-28 05:04:26 +02:00
odoo 3d7247ad4d [FIX] mrp: don't miscount child/parent MOs in 2/3 Step Production
Steps to reproduce the bug:
- Enable 'Multi-Step Routes' option in Inventory settings
- Edit warehouse and update Manufacture = 'Pick components, manufacture and then store products (3 steps)'
- Create a storable product 'P1' with BOM:
    - BOM type: Manufacture this product
    - operations: “OP1”
    - Components: product 'C1' consumed in the operation 'OP1'
- Set Reordering rules for product 'P1'
- Run Scheduler and MO will be generated with order points
- Edit MO and add Producing Quantity less than to produce
- Validate the MO and create backorder.

Current behaviour:
- child/parent MO were getting visible when backorder was created in 2/3 Step Production.

Expected behaviour:
- No child/parent MO visible until child/parent relations are there

closes odoo/odoo#96533

Task: 2846768
X-original-commit: 14431b2497dcf4aaf778ef1b06e023101b00a4e2
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-07-22 16:22:06 +02:00
JF Aubert 3ced21cf87 [FIX] mrp: fix duration expected
_split_productions wrongly compute duration expected for backorders.

Setting quantity on production adapt many things including workorders,
so adapt original production after copy_data for backorders.

closes odoo/odoo#96179

Task: 2884562
X-original-commit: 71b8531881ff6924762ec34db3f2ddf858383218
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-07-18 19:55:16 +02:00
Denis Ledoux cf664a5dc8 [FIX] mrp: mo creation with move_finished_ids without byproduct_id
When creating a new manufacturing order with `move_finished_ids`
passed in the values, but `byproduct_id` is not amongst the move values,
the creation of the manufacturing crashed.

```
  File "/home/odoo/src/odoo/master/addons/mrp/models/mrp_production.py", line 811, in create
    vals['move_finished_ids'] = list(filter(lambda move: move[2]['byproduct_id'] is False, vals['move_finished_ids']))
  File "/home/odoo/src/odoo/master/addons/mrp/models/mrp_production.py", line 811, in <lambda>
    vals['move_finished_ids'] = list(filter(lambda move: move[2]['byproduct_id'] is False, vals['move_finished_ids']))
KeyError: 'byproduct_id'
```

By reading the implementation of the byproduct moves field:
```py
    @api.depends('move_finished_ids')
    def _compute_move_byproduct_ids(self):
        for order in self:
            order.move_byproduct_ids = order.move_finished_ids.filtered(lambda m: m.product_id != order.product_id)
```
it seems a better implementation to filter the move on the fact their
product is different than the manufacturing order to determine whether
they are byproduct or finished product moves.

Take the opportunity to write a unit test testing the tricky behavior
of the create override when both `move_finished_ids` and `move_byproduct_ids`
are passed in the create values.

This is related to revision
odoo/odoo@6c087f2043

closes odoo/odoo#96044

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-07-15 14:22:08 +02:00
Touati Djamel (otd) a4c00c071f [FIX] mrp: allow using an unbuilt serial number in manufacturing order
Steps to reproduce the bug:
- Create a storable product “P1”
    - Tracking: by serial number
    - BOM:
        - Component: C1

- Create a storable product “P2”
    - BOM:
        - Component: P1

- Create a MO to produce one unit of P1:
    - serial number: SN1
    - Confirm and mark as done

- Unbuild the manufactured product
- Manufacture the same product using the same serial number again

- Create a new MO to produce one unit of “P2”:
    - Component P1 → select SN1
    - Try to confirm and validate the MO

Problem:
Get User Error: The serial number “SN1” used for component “P1”
has already been consumed

We do a search in the `stock.move.line` to find if the SN has already
been used in a previous MO, but there is no specific condition to get
only those used in an MO so the unbuild order is in the same condition
and therefore the SN is considered as it has already been used
opw-2883450

closes odoo/odoo#95935

X-original-commit: 5ac7f4d6fa5551ba7c6da49a52edf0a7df2d0745
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-07-14 11:42:57 +02:00
Touati Djamel (otd) 8467f7b9ff [FIX] mrp: allow selecting only the SNs linked to the MO
Stpes to reproduce the bug:
- Create a storable product “P1”:
    - tracking: Serial number
    - BOM: 1 unit of C1

- Create the MO 1:
    - produce 1 unit of P1:
        - Create the SN1

- Create the MO 2:
    - produce 1 unit of P1:
        - Create the SN2

- Create an Unbuild order:
   - Select the MO1

Problem:
You have the possibility to select any Serial number linked
to the product “P1”, whereas only SNs created in this MO can be selected

opw-2834529

closes odoo/odoo#95956

X-original-commit: 167b1668450c5af44bc1d36d1c7d59921bc2b811
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-07-14 10:22:51 +02:00
Denis Ledoux d369929d60 [IMP] mrp: convert unbuild uom and locations onchanges
This allows to create a mrp.unbuild record without
the need to call the onchanges to set the uom and locations
or to set them manually during the `create` call.

For instance, this makes easier to create unbuild orders
using XMLRPC when you do not use multiple UOMs or multiple locations.

closes odoo/odoo#95557

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-07-12 01:29:20 +02:00
Denis Ledoux 3d7c14a7e4 [IMP] mrp: fix import order in test_order.py
CI/Style
```
odoo/addons/mrp/tests/test_order.py:8
from odoo import Command, fields
C0412(ungrouped-imports) coll 0: Imports from package odoo are not grouped
```

closes odoo/odoo#95733

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-07-11 20:25:11 +02:00
Denis Ledoux 4abacd9cff [IMP] mrp: default workorder duration_expected without form/onchanges
With this revision, the expected duration is correctly set
when creating a production order with work orders without the need of
onchanges, through a form.

For instance, this allows an easier implementation to create a production
order with work orders through XMLRPC API calls,
as you will not need to manually set the expected duration value
or to call onchanges manually to set it.

For instance, without this change to remove the `default=60.0`,
the part added by this revision in the test `test_update_quantity_3`
would fail
```
2022-07-11 09:15:14,644 21 ERROR master odoo.addons.mrp.tests.test_order: FAIL: TestMrpOrder.test_update_quantity_3
Traceback (most recent call last):
  File "/home/odoo/src/odoo/master/addons/mrp/tests/test_order.py", line 347, in test_update_quantity_3
    self.assertEqual(production.workorder_ids.duration_expected, 90)
AssertionError: 60.0 != 90
```
while it just does the same thing than the existing `test_update_quantity_3` test
but without the use of a form / onchanges.

Part-of: odoo/odoo#95733
2022-07-11 20:25:11 +02:00
Denis Ledoux aa07793d9d [IMP] mrp: convert production order product, uom, bom onchanges
This allows to create a production order record without
the need to call the onchanges to set the product, uom or bom
or to set them manually during the `create` call.

For instance, this makes easier to create production orders
using XMLRPC when you do not use multiple UOMs.

closes odoo/odoo#95544

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-07-08 17:10:42 +02:00
Denis Ledoux 5ccc32fcf7 [IMP] tests: common.Form, can't write on invisible fields
In the web client, in a real use case, it's not possible
to write on fields which are invisible,
as it's not possible to write on fields which are readonly.

This is a first step in the goal to change the behavior
of the `groups=` attribute in the back-end views,
to remove them for the view instead of making them invisible.

This is mainly to reduce the diff of the revision that will introduce
the mentioned above behavior change.

As nodes with `groups=` will be removed from the view
when the user doesn't have the group, it's no longer possible
to set a value on a field having a `groups=` the user doesn't have
in the `Form` test class, as the field will no longer be at all in the
view.
However, these unit tests shouldn't have been able to set values
on invisible fields in the first place.
This revision therefore aims to correct the unit tests setting value
on fields which were invisible because the user executing the
test was not part of the required group(s) for these fields
to be visible in the view.

closes odoo/odoo#94337

Related: odoo/enterprise#28936
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-07-08 14:33:47 +02:00
kado-odoo 37d30e7c40 [FIX] mrp: add domain in copy existing operation action
Currently, when a BOM is archived via the ECO mechanism, its operations are
still selectable via the `copy existing operation` action on the BOM.

In this commit, we have added domain in `copy existing operation` action.

TaskID - 2845022

closes odoo/odoo#95548

X-original-commit: 272cd5358e8b78bc273d4aa72b8c42649f1f5171
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-07-07 17:31:13 +02:00
Romeo Fragomeli 1fcd098af5 [REF] *: BS5: migration
Automated change made by a lot of RegEx to change all think that is
possible to automate.

https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli 9b5c9484fe [REF] *: BS5: adapt changes in media query mixin
> Media query mixins parameters have changed for a more logical approach

> media-breakpoint-down() uses the breakpoint itself instead of the next
> breakpoint (e.g., media-breakpoint-down(lg) instead of
> media-breakpoint-down(md) targets viewports smaller than lg).
> Similarly, the second parameter in media-breakpoint-between() also
> uses the breakpoint itself instead of the next breakpoint (e.g.,
> media-between(sm, lg) instead of media-breakpoint-between(sm, md)
> targets viewports between sm and lg).

https://getbootstrap.com/docs/5.1/migration/#sass

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli ac584e171d [REF] *: BS5: Migrate Badge
From [1]:
> Dropped all .badge-* color classes for background utilities
> (e.g., use .bg-primary instead of .badge-primary).

We now have to manage constrast for some badge. It's why we
add 'text-dark' at some point.

Note:
Due to the backport of 'text-bg-#{theme}', we can use this to
avoid to use 'text-dark'.

Ref:
[1] https://getbootstrap.com/docs/5.1/migration/#badges

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:18 +02:00
Denis Ledoux b92d42b3ae [IMP] mrp: convert byproduct product_id onchange to compute
Convert the onchange on `product_id` to a compute field

This allows to create a `mrp.bom.byproduct` record without
the need to specify the uom during the creation nor calling the onchange
method. The uom defaults from the product uom.

This way, if the database is not configured to use multi UOMs,
the users do not have the specify the UOM to use.
For instance during an XMLRPC call to create a byproduct.

closes odoo/odoo#95270

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-07-07 11:22:52 +02:00
Aurélien (avd) 6c0744d672 [FIX] stock: speed up _find_delivery_ids_by_lot
Rewrite _find_delivery_ids_by_lot to reduce the number
of recursive calls by grouping the producing move lines
together before each recursive calls. This reduces
the number of search calls, speeding up the whole method.

Add a unittest to check if the delivery_ids field
of a lot recordset is properly computed.

opw-2824464

X-original-commit: e7b9f14d4a9ce4ed61451b24b567f751fb4bcbe2
Part-of: odoo/odoo#95398
2022-07-06 13:11:48 +02:00