Commit Graph
76 Commits
Author SHA1 Message Date
Christophe Simonis cbdd0b20dc [MERGE] forward port branch 10.0 up to ffd4442b06 2017-02-10 13:17:02 +01:00
Nicolas Martinelli 3f16ed9ef7 [FIX] mrp: crash onchange
In a MO, change a product in "Consumed Materials" by clicking on "Search
more...". It crashes.

Clicking on "Search more..." triggers the onchange since it empties the
line. Since there is no product on the line anymore, it crashes.

opw-705644
2017-02-09 15:51:08 +01:00
Nicolas Martinelli 88af7c9392 [FIX] mrp: expected date
When a MO is created with a deadline start date in the future, the
scheduled date of the stock move is still the creation date.

opw-707396
2017-02-07 17:18:28 +01:00
Nicolas Martinelli c1047e9adf [FIX] mrp: quantity_available depends 2017-02-07 16:33:46 +01:00
Nicolas Martinelli 364036017b [FIX] mrp: UoM of quantity available
The field `quantity_available` can be computed in two different ways:
- equal to `product_uom_qty`
- equal to `reserved_availability`

However, `product_uom_qty` is in the UoM of the move, while
`reserved_availability` is in the UoM of the product.

We convert into the UoM of the move, because `quantity_available` is
supposed to be in the same UoM than `product_uom_qty` ("To Consume").

opw-704775
2017-02-07 16:33:46 +01:00
Christophe Simonis 6a942a9e96 [MERGE] forward port branch 10.0 up to 8a0151b4bc 2017-02-02 12:42:51 +01:00
Josse Colpaert 347f140fe6 [FIX] mrp: rounding issues and efficiency replacement
Before, when you would put a quantity in a BoM line that was not rounded
to its UoM (e.g. use 0.3 piece with rounding 1.0) it would not round this
quantity in the MO also (when exploding the BoM), and the user could also
enter a not rounded quantity himself for the quantity produced or
consumed.

The moves were split with the exact quantities, but the moves were validated
taking into account rounded quantities. This resulted in either moving 2
pieces instead of 1 (entering 0.7 or 1 piece) or raising an error telling
you can not process moves with 0 quantity (0.3 piece).

As product_efficiency and product_rounding was removed from the BoM/BoM
line in v10, if the rounding is correctly handled, the feature could work
like in v9, by e.g. putting 1.03 in the bom line (97% efficiency) and
rounding up when exploding the BoM (e.g. producing 10 pieces would put
it to 11).

When "producing", we round the produced qty to the product uom (it does
not make sense to produce 1.32 if your uom rounding is 1.0). The user
might now change the produced quantity, that's why we round-up when
validating the move: indeed, if the user slightly increase the produced
value (below the uom unit), it actually means he produced more.

This way, instead of not rounding anything and doing rounding behind the
scenes, leading to errors, we round everything and the user sees the
result directly.
2017-01-27 19:22:02 +01:00
Christophe Simonis 7b2924253b [MERGE] forward port branch 10.0 up to 7427825790 2017-01-25 16:27:38 +01:00
Josse Colpaert 1bf2173240 [IMP] mrp: ensure_one in cal_price
We want to ensure not to mix the price calculation
of multiple MOs when posting inventory.
2017-01-25 12:11:55 +01:00
Christophe Simonis 6c4389df41 [MERGE] forward port branch 10.0 up to 6804085b8c 2017-01-23 14:33:53 +01:00
Josse Colpaert c453358c88 [FIX] mrp: intermediate post inventory during a MO
When posting inventory during a manufacturing order,
all raw material and finished product moves are used,
also those done from a previous post inventory.

This is no problem for the moving of quants because
a filtering is done in the move_validate method,
but it is a problem for the price calculation in
mrp_account and for linking the consumed/produced_quant_ids
of the quants of the raw and finished moves.

Before this fix, it would calculate already consumed materials
a second time in the price of the finished products and would
link quants produced with previously consumed quants (and vice versa)
when doing a second post inventory.

We add a test to show the issue.
2017-01-19 16:21:27 +01:00
Josse Colpaert ffe13756f5 [FIX] mrp: manufacturing vignette in inventory dashboard
When clicking on the "manufacturing" vignette in the inventory
dashboard, the records were not filtered correctly (example: add a new
warehouse, a new "manufacturing" vignette appears for this warehouse in
the inventory dashboard, clicking on it would display the MO of all the
warehouses).

With this fix, as with the pickings, it will only show the count of MO
filtered to that specific picking type in the vignette, and clicking on
it will displayed the filtered ones.

We implementent the method of the compute field the same way the similar
method for the picking is implemented.

fixes #15008
2017-01-17 14:43:06 +01:00
Josse Colpaert ff098a7ad4 [FIX] mrp: procurement creation for raw materials
According to the routes set on the products of the raw materials, a
procurement may have to be created for the consumed lines of the MO.

A route may also be set on a product category. Before this patch, we
only look for procurement rules for the routes defined on the products
and on its category, ignoring the inherited route of the parent category.

Fortunetaly, we have a computed field on the product model returning
all the routes from the current category, so we use this one in the
search for procurement rules.

A test has been added to show the failure.
2017-01-10 18:42:37 +01:00
Josse Colpaert 2f66e7abde [FIX] mrp: handle the case of empty routings
Before, when the routing of a production order was empty (no operations),
it got into an inconsistent state (you click on "plan" and nothing happens).

Empty routings were used before to do subcontracting or 2-steps inventeory
(we did not set any operations on the routing but we set a location).

Here, we change the related routing field on the production order into a
calculated field which becomes empty when the routing has no operations.
This way, the "produce" button is displayed (as for production orders
without routing) and working/

This is a temporary patch to workaround the issuein a stable release.
In master, we might remove the location on routing and place it on the
workcenters and put a constraint that does not allow an empty routing.
2017-01-10 18:37:53 +01:00
Josse Colpaert c2040da0ba [REF] mrp: inventory post when last work order is finished
Before this patch, the inventory was automatically posted when you click
on "done" on the last planned work order. This behavior was preventing
the user from correcting, for example, the consumed quantity on the raw
materials move on the manufacturing order if it was different from the
theoretical quantity. Note that finishing anyone but the last work order
still let you edit the consumed quantity. Same with changing the lot.

Now you have to click on "mark as done" on the manufacturing order to
post the inventory. Note that this is the same behavior when working
without work order (produce > mark as done will post).

We adapt the tests to reflect this change.
2017-01-10 15:32:14 +01:00
Christophe Simonis 557feb950c [MERGE] forward port branch 10.0 up to 482fd04167 2017-01-10 13:50:48 +01:00
Ravi Gohil 23d07478e3 [FIX] mrp: fix migration issue using recordset instead of record in loop 2017-01-10 09:44:35 +01:00
jeffery chen fan f89c4c2002 [FIX] mrp: typo in the error message
Closes #14854
2017-01-03 15:35:39 +01:00
qdp-odoo 4f29b77e3d [MERGE] foward port of 10.0 up to revision 84a650e33a 2016-12-30 17:21:25 +01:00
Ravi Gadhia 1d62b59fda [IMP] mrp, mrp_repair: add support of activities
mrp.production and mrp.repair models now supports activities. Filters have been
added to ease their management.
2016-12-21 11:00:16 +01:00
Martin Trigaux 51e6bb4727 [FIX] mrp: do not rename warehouse when changing code
If only the code of a warehouse is changed, `name` is None.
Do not try to set None as the new pull name.

Fixes #14766
2016-12-19 16:07:31 +01:00
Martin Trigaux 9d9592137b [FIX] purchase,mrp: match method signature
To have the same as the main method in stock
2016-12-19 16:06:50 +01:00
Josse Colpaert 54107a36e3 [FIX] mrp: blocking a work order and workcenter state
The issue is that if you block a workorder when you exceeded the
expected time, the workcenter is not blocked.

The workcenter state is computed according to its productivity lines.
The productivy lines are marked with a loss type type that define the
reason of the time loss (availability problem like missing equipment or
quality problem like broken equipment). There are also two magic loss
type that define if the work on the workcenter is done in the expected
time (fully productive time) or is done exceeding the expected time
(reduced speed). The unblock button appears if the workcenter is
blocked.

To compute the workcenter state, we have to look through the last
productivity line of the workcenter having no end_date. Before the
patch, we look for the last productivity line and it could return one
with an end_date while there was a productivity line without one and it
was this one that would define the workcenter state.

This is solved by immediately searching for a record without end date.
We also add some comment to the code to understand a little more what's
going on.
2016-12-16 17:28:25 +01:00
Goffin Simon 49eb6176c2 [FIX] mrp: manufacturing manager can unbuild an order
A manufacturing manager can unbuild an order without being an inventory manager.

The action unbuild only appears when the user is manufacturing manager.

opw:695734
2016-12-15 09:59:31 +01:00
Christophe Simonis c292202a47 [MERGE] forward port branch 10.0 up to 18456b9 2016-12-09 15:58:39 +01:00
Nicolas Martinelli e3ee78c7ef [FIX] mrp: start date
The start date of a manufacturing order is never set. One consequence is
that the Gantt view, which relies on this field, is never populated.

opw-693743
2016-12-07 15:50:31 +01:00
Jérome Maes 13f84b9aca [REM] *: remove ir.needaction mixin
ir.needaction_mixin is not used anymore by the webclient.
From 9.0, the concept has changed: this feature is now
available in mail module, with the mail.thread mixin,
and message_neeadction field.

Remove all code handeling needaction bullet and
counter on ir.ui.menu, knowing that since 9.0
webclient does not display the counter anymore.

This code was, thus, useless and some RPC calls
were done for nothing, and adapt accounting
reconcialiation widget.
2016-12-05 11:30:03 +01:00
Christophe Simonis e348330b57 [MERGE] forward port branch 10.0 up to 6a18e31 2016-11-22 17:59:41 +01:00
Josse Colpaert 91acb7f04c [FIX] mrp: take langage into account when checking if the production order has still the default name 2016-11-22 13:00:11 +01:00
Christophe Simonis e2fcace05e [MERGE] forward port branch 10.0 up to 13dc704 2016-11-17 15:27:29 +01:00
Christophe Simonis dece72d010 [MERGE] forward port branch saas-12 up to ca20038 2016-11-15 13:58:55 +01:00
Josse Colpaert 7e15fa59e4 [FIX] mrp: correctly update lot_product_id to final lot for stock.move.lots
When there are 3 different lots reserved for 3 different serial
numbers for the final product, if you do the first finished product, the
finished lot is put on all stock.move.lots even if nothing has been
consumed for it.

This results in traceability report for the first finished lot being linked
to all of lots instead of just the one that was consumed.

Now we update lot_produced_id only on stock.move.lots where quantity_done > 0.
That way it will only links with the correct one.
2016-11-10 17:32:15 +01:00
Foram Shah 4022a47de2 [IMP] mrp,sale_mrp: add origin of MO in chatter
Set sale order and production order link on Mo. override make_mo method in sale_mrp module to set sale order reference in mo.
.and to find final destination move, i created one common private method to get parent move.

MESSAGES TO DISPLAY:

-Set a Reordering Rule (stock.warehouse.orderpoint) that creates a manufacturing order:
"This manufacturing order has been created from: OP/00001"

-Create new Sales order of manufactured product , there will be a Source Document with procurement of that Sale Order
"This manufacturing order has been created from: SO001"

-create MO for BoM items of the product, there will be a Source Document with procurement of that Manufacturing Order
"This manufacturing order has been created from: MO/00001"
2016-11-02 14:18:24 +01:00
Christophe Simonis 3bb022d57c [MERGE] forward port branch saas-12 up to 6f8e40c 2016-10-27 18:17:59 +02:00
Josse Colpaert 7a65ec28b9 [FIX] mrp: extra moves set correct quantity_done and product_uom_qty
Before, when we consumed 3 instead of 1 in a production order, it
gave a traceback.  It was because it created moves
with negative quantities.  So, something was wrong with
the quantity_done/product_uom_qty set when creating the extra moves

When creating an extra move because of the procurement,
but you still need to split afterwards (e.g. procurement 10, production order 12, you do 11),
then you should have a difference between quantity_done and product_uom_qty
in the extra move and not try to change it on the original.
That way, we make sure we pass the correct quantities.
2016-10-27 17:34:43 +02:00
Christophe Simonis dabf82870a [MERGE] forward port branch saas-11 up to 25e0b25 2016-10-24 13:07:46 +02:00
Josse Colpaert 157db49d9c [FIX] mrp: in production orders, we don't want the possibility to select phantom BoMs
As the finished move or the one after might automatically split into its components,
it is not a good idea to select a Phantom BoM for a production order, so
this is for the moment, the best way to avoid it.
2016-10-02 21:08:31 +02:00
Josse Colpaert 98c97b03d6 [FIX] mrp: when posting inventory in mo, don't allow to pass stock.move.lots with quantity done > 0, but without lot
It is good to have this check, otherwise
it risks taking whatever lot or creating
a piece without lot if you would by accident
say you did so many quantities but no lot was given.
2016-10-02 21:06:02 +02:00
Christophe Simonis a7ba6cde9c [MERGE] forward port branch saas-12 up to 7134aff 2016-09-28 16:28:31 +02:00
Haresh Shyara ae7cb1483c [IMP] mrp: create graph and pivot of duration_expected of workorders related to a workcenter and add stat button with load to come
This replaces the old workcenter load report
2016-09-28 12:45:03 +02:00
Josse Colpaert 153a6d0814 [FIX] mrp: correct interpretation of explode's quantity parameter
In previous versions, the quantity passed to the bom_explode was the number
of times you needed to count the BoM.  If the BoM was for 2 dozens and you pass
48 units, 2 was passed to the bom_explode method.  We are now doing the same
for the explode method and we check it is called this way everywhere.
2016-09-28 12:38:13 +02:00
Josse Colpaert fbab021a9b [FIX] mrp: extra move should split move lots also and take into account procurement
When you produce or consume more than foreseen in a production order,
the system creates extra moves.  Before, in case of tracking, it did this without
transferring the stock.move.lots resulting in a wrong stock.  That is why now,
when we split moves, we also split the stock.move.lots

For the finished move, it is also important to split between the quantities
of the original procurement and what is extra as the extra might use a push rule e.g.
2016-09-28 12:38:13 +02:00
Josse Colpaert 24a16f5db5 [FIX] mrp, mrp_byproduct: updating the quantity of production orders fixes
When updating quantity, it should take use a similar
method as for generating the moves, but with
the quantity already produced (and posted) deduced.
The parameters for these method needed to be changed.

When all the moves are posted,
we should create the necessary extra moves.
If the quantity is put back to the quantity posted, it
might also need to delete moves.
In byproduct, it should take into account the subproduct factor.

When the quantity produced  on the work orders has reached the quantity to do,
it should not allow anymore to use the "Done" button on work orders, but
rather use the Finish button instead.  With the Update button on the manufacturing order
it is possible to do more.
2016-09-28 12:38:13 +02:00
Josse Colpaert 3e95e4e58e [IMP] mrp: help message for the explaining the Next Operation field on the routing 2016-09-28 12:38:13 +02:00
Josse Colpaert 0239202be4 [FIX] mrp: problem with blocking times starting at server start time
The default of the date_start on the time records was a
result of the function fields.Datetime.now instead of the function itself
resulting in the start of each blocking time as the start of the server
2016-09-28 12:38:13 +02:00
Josse Colpaert ca7b15b58c [FIX] mrp: typo Produced Qty -> Quantity To Produce 2016-09-28 12:38:13 +02:00
Josse Colpaert 0efc835fa9 [FIX] mrp: correct workorder qty_producing onchange
When changing the quantity being produced on a work order and
serial numbers are consumed, we need to delete or add lines
for every serial number in function of the quantity through the onchange.

We changed the quantity_done to be set to quantity by default (automatically)
as otherwise we forgot to set it.  But for the onchange, it means
we need to take it into account otherwise the number of records
would not be diminished.
2016-09-28 12:38:13 +02:00
Josse Colpaert 777ea73f23 [FIX] mrp: make sure we see in mo from stat button when only one (was taking 2 domains) 2016-09-28 12:38:13 +02:00
Haresh Shyara 841c1c3adb [FIX] mrp:workcenter: blocked and productive time correction
The labels of the fields say that they store hours, but actually they store minutes. Correct the code to store hours.
Add digits to fload field for a better display in the webclient
2016-09-28 12:38:13 +02:00
Josse Colpaert 5043d77128 [IMP] mrp: mo view: date_planned_start, user_id and origin fields should be editable
date_planned_start should also be Start Deadline instead of Expected Start Date.
We don't want the Expected dates to function as a planning tool, but as
a priority for the planning of the workorders.
2016-09-28 12:38:13 +02:00