Commit Graph
34 Commits
Author SHA1 Message Date
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
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
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
Ivan Yelizariev 30230d9f4c [FIX] mrp: fix uom conversion in bom kit
no need to make rounding during computing qty_available

STEPS (see the test):

* create product with uom dozens
* create product with uom units
* create bom kit to convert one to another
* set qty on hand to 1 for product dozens
* check qty for product units

BEFORE: qty=11
AFTER:  qty=12

---

opw-2632782

closes odoo/odoo#76242

X-original-commit: 26b28408d8970baa8cbf59ffaff90cab1e579410
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-09-09 13:17:39 +00:00
Rémy Voet (ryv) 7b7f65d504 [IMP] mrp: improve bom filter line by variant feature
On BoM, a component line can be filter out depending
of the product variant to manufacture
(with "Apply on Variant" field).

Extend this feature to operation and byproduct line.

task-2614126

closes odoo/odoo#74973

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-08-16 07:20:03 +00:00
Nicolas Pierre fd19b0d7a2 [IMP] stock: replenishment using qty from the BoM
The replenishement creation currently calculates the quantity to order
using a default multiple quantity of 1. In case of manufacturing route,
we want to calculate the multiple quantity according to the quantity
produced in the BoMs.

closes odoo/odoo#62766

Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-02-18 11:51:18 +00:00
Goffin Simon f78e04e026 [FIX] mrp: Existing operations can only be added to one BOM
Generic operations will be applied for every manufactured product passing
through the work center.

An operation linked to a bom will only be applied when the specific manufactured bom is produced

So on a BOM, every operations must be created for this specific BOM

The widget many2many is wrong because it will overwrite the generic operations

opw:2458974

closes odoo/odoo#66888

X-original-commit: a430c06ec6ec286a2d9ef55de6eebec60feeae3f
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-02-25 21:49:19 +00:00
Goffin Simon 2ad6f4e14e [FIX] mrp: Existing operations cannot be added to BOM
Steps to reproduce the bug:

- Go to an existing BOM B
- Edit B and try to add an existing operation O in operations tab

Bug:

It was impossible to add an existing operation

opw:2458974

closes odoo/odoo#66712

X-original-commit: ffab43fbf54b2f914b34c18da2391f3a18b3326c
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-02-23 15:23:44 +00:00
Denis Ledoux e402cd496f [FIX] mrp: qty_available computation of a kit and its component
When `qty_available` was being called
for a kit and its components at the same time,
e.g.:
 - Kit product
   - Product 1
   - Product 2

The kit product available qty was always computed to `0.0`,
because when computing its component available quantity,
they were computed to `0.0` because they were marked
as `protected` by the ORM when calling the compute method
for these records at the first call.
When the `qty_available` compute method for the kit
then called recursively the `qty_available` compute
method for the component, as the component record
were marked as protected,
the ORM filled their value with the Falsy value `0.0`.

This issue occured particularly in the upgrade integrity unit test
which makes sure the available quantities of the products remain
unchanged after upgrade. This test computes the available
quantities for a bunch of products at the same time,
and its therefore likely a kit product gets its available
quantity computed as the same time than its components.

upg-3185
upg-4215
upg-4228
upg-5558
upg-5745
upg-5856
upg-6012
upg-6064
upg-6076
upg-6306
upg-6514
upg-6588
upg-6729

closes odoo/odoo#65758

X-original-commit: 8e152a567a6003dae4abb3b537b963eec4142d6d
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2021-02-08 18:58:04 +00:00
Rémy Voet (ryv) 4d57ce473b [REF] mrp: clean BoM operations
- make `bom_id` required. No sense to have a operation without BoM
- `company_id` of operation is now related
- Clean the multiple `allowed_operation_ids` into related
fields instead.

task-2373638
2021-01-05 08:32:58 +00:00
Nicolas Galler 4c2a03aa8f [FIX] mrp: validate BOM lines with same product as BOM
Current behavior before PR:

It is possible to create a BOM that has a BOM line that reference the
same product as the BOM itself.  This is undesirable as when we create a
manufacturing order for this product we will have an error.

It is a regression bug that was introduced in commit
575353e251a0cce3bbff759edaeb56b5718beb11 between v12 and v13.

Behavior after PR is merged:

When saving a BOM it will validate that no product line references the
same product, or the same product variant, as the BOM itself.  Note that
it is allowed to have a BOM for a product variant that references
another variant of the same product.

opw-2347941

closes odoo/odoo#59633

X-original-commit: 917e4c67b4aa14ca71ec6cba4bc6d20a86459f42
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-09 12:05:27 +00:00
Rémy Voet (ryv) 5011ec520c [REF] mrp: review consumption allowing
Now, by default, a Bill of Material have a flexible
consumption instead of strict consumption. Also
add new consumption choice: a flexible consumption
but with a warning when the bom isn't respected.
Also, now, the strict (a new warning option) consumption
is checked only when we try to mark as done the MO.

task-2241471
2020-06-15 16:59:41 +02:00
Simon Lejeune c660770ebd [REF] mrp: remove routing model
Set the operations directly on the Bill of Material.
Duplicate the demo data where a routing was shared.
Adapt the tests.

Remove the following feature:
    - set the same routing on parent and kit child bom
    - when planning, if the component of the kit have the same operation
      than a component of the parent bom, merge these operations

task-2241471
2020-06-15 16:59:40 +02:00
Sébastien Theys 22a11a6f4d [REF] product, *: save product.template.attribute.value on variants
* account, hr_expense, mrp, sale, sale_product_configurator, stock_account,
  website_sale, website_sale_comparison

Before this commit, the `product.attribute.value` were stored on the variants.
This required filtering of attribute lines to find the appropriate matching
`product.template.attribute.value` that were used in most of the business code,
such as when computing the `price_extra`.

This also prevented to have multiple attribute lines for the same attribute,
which is needed to handle use cases such as grape varieties for wine products.
This will be done in the following commit.

After this commit, the combination of `product.template.attribute.value` will be
directly stored on the product variant.

Other changes
=============

Add `combination_indices` on product, which allows to quickly find a variant
matching a combination (1 simple indexed equality query as opposed to 1 query
with as many joins as there are attribute lines), and to add an easy
SQL constraint to ensure active combination uniqueness.

Add active field on `product.template.attribute.line` and
`product.template.attribute.value`, with the same behavior as variants:

They become archived if they can't be unlinked. This allows to keep the database
consistent, such as archived variants correctly keeping all their values, sales
order lines keeping their custom and no_variant. This is done with the help of
`ondelete=restrict` on the corresponding m2m fields, and the `unlink` methods
falling back to archiving when `unlink` is restricted.

Part of task-1912579

PR: #32946
2019-08-26 13:01:13 +00:00
Arnaud Baes 062ad598bf [IMP] stock: default sequence for picking types 2019-08-14 12:27:04 +00:00
Sébastien Theys e05442fe19 [IMP] product, *: clean test and demo set up with attribute lines
* = account, mrp, purchase_stock, sale, sale_product_configurator,
stock_account, website_sale

It is always better to create the product template attribute lines before
creating the variants. In a following commit, this will become mandatory.

The variants that are created should always match the combination of attributes
set on the template.

Finally explicitly call `create_variant_ids` when possible instead of reassigning
the attribute lines to implicitly call `create_variant_ids`.

closes odoo/odoo#34122

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-17 10:52:01 +00:00
Christophe Simonis cc3a2c1bf3 [MERGE] forward port branch 12.0 up to e11bacfe51 2019-05-09 21:07:44 +02:00
Jorge Pinna Puissant 97b44806f5 [FIX] mrp: recursive bom with different quantities
Having 4 products and 3 BoMs:
BoM 1:
 product = Finished
 quantity = 100 units
 - Semi-Finished 10 units

BoM 2:
 product = Semi-Finished
 quantity = 10 units
 - Assembly 10 units

BoM 3:
 product = Assembly
 quantity = 10 units
 - Raw Material 10 units (product.product 5$/unit)

Before this commit, the price for 100 units of Finished product was
500$, which is wrong. The price was calculated using 100 units of
Semi-Finished product and not 10 units as it should be.

Now, the price is 50$

opw-1973347

closes odoo/odoo#33115

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2019-05-03 11:02:35 +00:00
Christophe Simonis 93d736e905 [MERGE] forward port branch 12.0 up to 6e8dff1952 2019-02-11 16:17:02 +01:00
Nicolas Martinelli afc5ec8bdf [FIX] mrp: cost and attributes
When retrieving the BOM lines in `_get_bom_lines`, we check the product
attribute values to know if the BOM line should be taken into account or
not. However, we do not do such a check when we retrieve the price in
`_get_price`.

It can lead to an inconsistency between the sub-lines displayed and the
total price.

We need to apply the same filtering logic when getting the price.

opw-1932437

closes odoo/odoo#30917
2019-02-08 13:49:49 +00:00
Arnold Moyaux 7206b385b5 [IMP] mrp: raw moves generation in onchange 2018-11-27 11:58:02 +00:00
Christophe Simonis 3b3a65bef0 [MERGE] forward port branch saas-11.4 up to dc35de9d30 2018-11-06 14:12:51 +01:00
Arnold Moyaux ba239e4cac [FIX] mrp: subproduct price + rounding
On the BoM structure report the price on line with a
child BoM is inchoerent. Also the sum of all lines in
the report is not always equals to the total of the parent
line.

For the first issue, it happens due to commit 17b6256955
that use the number of operation cycle as quantity.
The second issue happens because sometimes the rounding is not done
at the smallest level and thus the rounding of the sum is different than
the sum of the rouding.
2018-11-05 10:02:09 +01:00
Simon Lejeune d5c31e231a [REV] mrp: block updating live BoM
This reverts commit d78b6f5e25.

This constraint is considered too harsh. It was applied to circumvent
inconsistencies when a bom is modified while being used in a
manufacturing order and the user chose to update the quantity to
produce. The current code will look at the existing move if no
intermaddite post of inventory was done else look at the new bom.

A code to re-construct the original BoM from the stock moves isn't easy
to write to handle all cases, one particularly complicated is the
deletion of bom lines of the same product.

We also considered to block the update qty button if the bom is modified
after the create date of the MO, but if we have to read all the bom
lines of all the sub bom in a computed field it may be slow on large
databases.

We thus chose to remove the constraint and think of a better approach in
a future version.

task 1891407

closes odoo/odoo#28155
2018-10-25 12:25:50 +00:00
William Henrotin d78b6f5e25 [IMP] mrp: block updating live BoM
When modifying a BoM that is used in a MO not done, raise a blocking
warning to avoid inconsistenties at production.

Proudly pair programmed with pim <pim@odoo.com>.

Some mrp tests has been adapted to not raise the new error. They used
demo data while they should created inside the test.

This commit is related to task id : 1855566
2018-08-23 20:32:27 +02:00
Mitali Patel ac41cd8195 [IMP] mrp: Change the condition 'and' to 'or' in product variants having the same attribute value
For example: I want to consume a component A if the product is grey OR yellow.
Currently,the component A will be consumed if the product is grey AND yellow. But this variant never exists as grey and yellow are values for the same attribute. So if the values are for the same attribute, odoo should check for a product that is GREY OR YELLOW (and not GREY AND YELLOW).

TASK-ID: 1865604
2018-08-23 15:54:23 +02:00
Arnold Moyaux 1e160dffd3 [IMP] stock, mrp: picking before and after manufacturing
Currently MRP do not handle multi locations for components. In order to
be able to use both feature at the same time, we could:
- Improve mrp in order to handle multiple stock.move.line for a
componenet stock.move
- Add a rule that allow to bring all the good from multiple location to
a single location. (was already possible but it requires some
configuration)
This commit introduce a checkbox on the warehouse in order to
automatically configure all the routes/rules/locations/picking_types,...
necessary to bring all the components to a single location before
running the manufacturing order.

Technically it also refactor some stock_warehouse.py methods in order to
easily override the picking_type, rules and routes creation.

Thank to Hetashree Chauhan <hch@odoo.com> for his help.

task_id: 27785
2018-08-13 15:38:34 +02:00
Goffin Simon 2bf5d1ab0c [FIX] mrp: Test recursive BOM
Test that detects a recursion in BOM when exploding.

opw:745453
2017-06-20 21:12:39 +02:00
Goffin Simon 4623fe8a81 [FIX] mrp: Wrong test
Introduced by dc98d174c7

opw:745453
2017-06-20 09:02:04 +02:00
Goffin Simon dc98d174c7 [IMP] mrp: Test recursive BOM
Test that detects a recursion in BOM when exploding.

opw:745453
2017-06-19 23:40:27 +02:00
Goffin Simon a133afe8a1 [FIX] mrp: same products in different sub-phantom-BoMs should be allowed
Let's consider 4 products P0, P1, P2 and P3 where:

- P0 depends on P1, P2 and P3
- P1 depends on P2 and P3
- P2 depends on P3

NB: "x depends on y" means that there is a phantom BOM for x where
y is in a line.

With this example, before the fix, when creating a MO for P0,
the function "explode" raised a user error saying that there
was a recursion error.

Even if in this case there was no recursion.

Now to check if there is a recursion, a graph of the dependencies of
the bom is created while exploding the boms and a function "isCyclic"
is applied on the graph to verify that there is no cycle which means
no recursion in the dependencies.

The algorithm was taken from this site: http://www.geeksforgeeks.org/detect-cycle-in-a-graph/

opw:745453
2017-06-19 23:40:27 +02:00
Thibault Delavallée 53fe7e9fa6 [TESTS] mrp and various: updating tests 2016-07-04 16:22:37 +02:00
Josse Colpaert 2ddc35a530 [REF][NEWPIE] mrp: new MRP
This commit contains the core of the new MRP. It contains a whole refactoring
of the MRP application, with improved and new features, written in new API.
Among other here are the main manufacturing workflow improvements :

 - Picking type not only for pickings but also for manufacturing orders
 - Properties replaced by picking type
 - BoM can only be produced with its routing (no other)
 - Either produce without routing with only production orders, or produce with
   routing
 - By default, there is an order in the work orders (serially), but you can
   override it to be able to work in parallel
 - Time clocking on work orders and block time on work centers with reporting
   on OEE, performance, losses, ...
 - Real-time adaptation of timings on operations
 - Lots/serial numbers can be inputted like in the pickings on manufacturing
   orders.  It is also possible to input them in the work orders.
 - Material availability independent of production order state (possibility to
   start production when only part of it is there)
 - Work sheets on work orders
 - Put messages on work orders to make your workers pay attention to something
 - Full traceability link to see for each produced piece of stock, the
   consumed pieces, ...
 - Separate scrap object (a scrap is not done based on an original move
   anymore)
 - Separate unbuild system (if you want to unbuild into its original
   components)

Thanks to all people that helped during this development, notably but not
limited to Chirag A Dodiya (cod@odoo.com), Gaurav Panchal (gan@odoo.com),
Jignesh Rathod (jir@odoo.com), Mansi Trivedi (mtr@odoo.com), Pariket Trivedi
(ptr@odoo.com).
2016-07-04 16:22:37 +02:00
Thibault Delavallée ab9335fa92 [TESTS] mrp: yml to new API unit tests 2016-07-04 16:22:35 +02:00