Commit Graph
24 Commits
Author SHA1 Message Date
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
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
William Henrotin 0e2765f5fd [REF] mrp: no more produce wizard
Use a view similar as the pickings one.

task-2241471
2020-06-15 16:59:41 +02:00
Rémy Voet (ryv) 53252608d7 [REF] mrp: backorder mechanism
Allow to "backorder" a production, meaning create another manufacturing
order with the quantity remaining to produce. We also use the
reservation of the first order on the next ones by using
`post_inventory` on the first one and moving the newly created stock
moves to the backorder.

We introduce a wizard similar to the one in stock.
Backorders have a sub-sequence.
Backorders are linked together through the procurement group.
We allow creating a backorder even if workorders are running by closing
them, the backorder will call `button_plan` and create its own.

task-2241471
2020-06-15 16:59:40 +02:00
Rémy Voet (ryv)andAnkita Raval bd2bbb27fe [IMP] mrp: add unbuild button on MO
In this commit:
- On done MO's form, add an Unbuild button, it would open a
wizard with the form view of an unbuild, and some pre-filled fields
such as MO, product, BOM, quantity and total quantity finished which
can be edited.
- In the unbuild order, improve the on_change of mo_id:
if the selected product is tracked by serial number,
set quantity to 1 by default and readonly
- Also clean the testcase of unbuild order.

task-2144636

closes odoo/odoo#43719

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Co-authored-by: Ankita Raval <anr@odoo.com>
2020-01-24 10:47:52 +00:00
Yannick Tivisse 14a6fc9ce9 [IMP] mrp: Adapt tests to work with/without demo data 2019-11-05 13:08:03 +01:00
Arnaud Baes 0c6488a95a [REF] stock: Set action_done on pickings private
`action_done`on pickings should be a private method,
and called only trough the picking validation process.

task-1938108

closes odoo/odoo#39174

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-10-23 07:43:01 +00:00
Simon Lejeune 96406dc2a9 [REF] mrp: multi company
Ensure proper domains are applied and enforced on relation fields thanks
to the `check_company` attributes.

Make sure unbuild have proper sequence for each companies.

The produce wizard and workorders company is the one of the production.
The BoM line company_id is the one of its bom_id.
Added some tests.

task-1985992
2019-09-03 15:05:03 +00:00
William Henrotin 199bb65b42 [IMP] mrp: rename final_lot_id
Commit 5ef46664a2 share code between produce
wizard and workorder. Field final_lot_id is now commonly used but not very
well named. This commit rename it into finished_lot_id as it represent the
lot number of the finished product.

Task : 1998064

closes odoo/odoo#32761

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-05-27 07:45:07 +00:00
Arnold Moyaux 030db4a4b0 [IMP] mrp: tracability on byproducts
In MRP the tracability is only set between the finished
products and the components. However when the by-products is
tracked by serial number, it could be usefull to know from which
components it was created. This commit add the link between by-products
and raw materials (only in produce wizard at the moment).

Technically we replaced the one2many field by a many2many.
2019-04-12 12:50:34 +00:00
Arnold Moyaux a4c0994cf4 [REF] mrp: byproduct as a workorder line
Technical refactoring in order to set by-products the same way
than raw materials. Before this commit byproduct were always set
at the last workorder or automaticaly set at the end of produce
wizard with the same quantity than in the BoM. In order to modify
it, the user has to produce the finished product then unlock and edit
the finished move line linked to the byproduct. In this commit, the
user could specify at which workorder the byproduct is created and
he could directly specify another quantity done in the produce wizard
inside a specific tab for by-products.

Technicaly, abstract workorder will add a new many2one key on workorder
line in order to set 2 different one2many (one for finished goods and
the other for raw materials). The key is set depending the many2one
key for production on the linked stock move. On the by-products itself,
it is now managed as a workorder line, thus the code to generate them
and transform them in a finished stock move line is the same than for
the raw components.
2019-04-12 12:50:34 +00:00
William Henrotin 5ef46664a2 [IMP] mrp: add production lines
To record a production via a manufacturing order, the user can either
use the produce wizard or the workorders views. Those two objects was
technically different but act more or less the same. This commit aims to
merge the similar behaviors in common code

We introduce two new abstract models :
 1. Abstract workorder to share workorders and the produce wizard
 2. Abstract workorder lines to share active_move_line on workorder and
    product_produce_line on the wizard. Those abstract line keep the information
    about the quantities and lot number to put on component move lines and
    finished product move lines

Task : 1891864
2019-02-01 08:13:25 +00:00
Arnold Moyaux 7206b385b5 [IMP] mrp: raw moves generation in onchange 2018-11-27 11:58:02 +00:00
Arnold Moyaux 3bb3e6a530 [IMP] mrp: add a 'draft' state to MO
The purpose is to be able to plan manufacturing order
without propagate the components's documents directly.
Except when the manufacturing comes from a pull rule, it will
be confirmed directly.

In order to do it, it will just create the moves without confirm them.
They will be only confirmed after a 'Mark as Todo' click.
2018-11-27 11:57:43 +00:00
Kirti Choudhary 09ba95b2d0 [FIX] mrp, mrp_byproduct: Pull/push rule on warehouse level for MO/Unbuild Order.
Finished product moves from a MO where created without warehouse_id.
It implies that push rule based on warehouse where not trigger on those
moves confirmation.

This commit adds warehouse_id on unbuild/production's finished/raw
moves. It also add a test for this behavior.

Task ID - 1865574
2018-08-06 14:04:27 +02:00
Pratima Gupta 3935bdc3de [IMP] mrp: update mrp tests to the new 'Produce' wizard
New test :
- Create a MO with a finish product tracked by SN with a dozen as
quantity
- Click on produce button in order to open the produce produce wizard
The quantity to do is 1 dozen although the tracking is by serial number

Task #55494.
2018-06-11 14:46:53 +02:00
Josse Colpaert d8ae935e74 [IMP] mrp: traceability of quantity of non-tracked product
When producing a finished product with a lot, also the raw materials
without lot tracking should split the move lines to at least know the
quantities consumed for every lot produced.  This way, the traceability
report will not confuse the user.
2017-10-03 13:57:31 +02:00
amoyaux 7dfcbc6b96 [REF] mrp: move test MO generation to common
Since the function in order to generate a MO is usefull
for mrp test. It could be great if we could use it in
every test.

This commit also add 3 arguments in order to modify the
quantity needed for each product.
2017-09-29 16:55:36 +02:00
Josse Colpaert fc680f5a6b [FIX] mrp: always add theoretical qty on produce
Before, in case of non-tracked components, when everything foreseen had
already been consumed, it would not add the theoretical quantity on
producing through the produce wizard.  This makes little sense as the
behaviour of the wizard is not the same anymore for all cases and this
can only confuse the user.
2017-09-27 18:10:20 +02:00
Simon Lejeune d08b4407be [REF] stock: _get_available_qty and tracked products
Suppose you have a product tracked by serial number. In your inventory,
you have two quants: -1 for serial1, +1 for serial2.

If you create a move for 1 product and try to run `action_assign`, it
didn't work before this patch because stock.move's
`_update_reserved_quantity` is guarded by a call to
an unstricted `_get_available_quantity` (unstricted meaning considering
all quants regardless of their lot_id/package_id/owner_id). This call
resulted in an available quantity of 0, thus the stock move could not be
reserved

To fix this issue, we patched `_get_available_quantity` so that it
rightly considers products of different lot_id as different products,
i.e. it returns an available quantity of +1 in the initial scenario. Of
course, we consider all quants of the same lot_id, i.e. if you have -1
for serial1 and +1 for serial2, the available quantity amounts to 0.

In another scenario, let's say we have only -1 serial1 in stock, if we
run `_get_available_quantity`, the method should return 0: nothing is
reservable. We continue this reasonment by returning 0 everytime the
available quantity is negative, tracked or not. This is probably what a
method named `_get_available_quantity` should have done since the
beginning.

There's only a single case where we need to know the quantity even if
it's negative: it's just after we move a quant to its destination
location. If this quant was tracked and resulted in a negative quant
(i.e. we moved something we didn't have), we try to compensate with an
untracked quant. In this special case, we do not want to ignore the
negative quants when calling `_get_available_quantity`.  That's why we
introduce a new argument to this method. We could have added a new method
`_get_quantity` for clarity sake.
2017-09-12 10:50:04 +02:00
amoyaux 01429dc29b [FIX] mrp : Unbuild manually and with lot
Since refactoring in saas-17 quant_ids are removed and
the logic is instead locate on stock_move_line. This commit
adapt the method by trying to undo the created move_line
during the MO.

This commit also add a default_uom_id in the view's context in order
to remove a traceback. Since 0469d2e
uom is mandatory on stock_move_line.

It also add a bunch of tests in order to check the behavior of unbuild
with 4 test: without tracking, consumed product tracking, produced product
tracking and everything tracking.

Know limitation of this commit:
-> No warning message when unbuild more than in stock.
-> Wrong result if trying to unbuild twice the same MO
with consumed product tracked with different lot/SN
2017-08-07 16:13:13 +02:00