Commit Graph

777 Commits

Author SHA1 Message Date
jesusVMayor ebda8caa97 [FIX] mrp: Use the route on the production if set to create the previous moves
Description of the issue/feature this PR addresses:
The production routing is ignored when creating previous movements

Current behavior before PR:
When you create a production that does not have a routing established in the BOM, and you set a route manually, it is ignored when creating the previous movements
2017-05-30 11:53:03 +02:00
Isaac Gallart Bochons 48cebafdaf
[FIX] mrp: call message_post separately
message_post accepts only one id

CLA signature for igallart done at #15625

Closes #15625
2017-02-27 12:26:42 +01:00
Anton Engelhardt 8914de8c53
[FIX] mrp: missing context
context was not passed to move objects in action_cancel

Closes #12598
2016-07-04 17:24:47 +02:00
Josse Colpaert eafebcb308 [FIX] mrp: for the consume move lines, the expected date should also be the planned date of the production order
It was like that for the date field, which is taken into account for the forecast quantity,
but in the view the scheduled date field is shown.  We put the scheduled date equal to the date.
That way it is clear to the user when the products are foreseen to be consumed.
2016-02-17 10:11:57 +01:00
Denis Ledoux 279f225cf0 [IMP] mrp, stock, stock_account: compute stored fields trigger
This is a performance revision.

Some stored functions field were recomputed uselessly.

In mrp, `hour_total` and `cycle_total` were recomputed
at each write on `mrp.production`, while they should be recomputed
only when there is a change on the `workcenter_lines` field,
or when there is a change in the `hour` or `cycle` field
of these `workcenter_lines`.

In stock, `min_date`, `max_date` and `priority` of
`stock.picking` were recomputed each time a new move
was added to the picking,
wether or not the 'expected_date' of this move
was between the `stock.picking` `min_date` and `max_date`,
and the priority not greater.

In stock, `product_qty` of `stock.move` was recomputed
at each write on the `stock.move`, while it should be
recomputed only when there is a change in `product_id`,
`product_uom` or `product_uom_qty`, as the computation
method only depends on these three fields.

In stock_account, the `invoice_state` of `stock.picking`
was recomputed each time a new `stock.move` was associated
to the picking, wether or not the `invoice_state` of the move
was already the same than the `invoice_state` of the picking.

opw-643560
2015-06-30 13:12:37 +02:00
sve-openerp 91998e3a5a [FIX] mrp: Missing log in procurement chatter when cancelling a MO.
When a MO is cancelled, it sets the related procurements in exception.
This fix logs this action in the procurement chatter, for WMS administration
and maintenance purposes.
2015-06-22 14:34:35 +02:00
Valentin Chemiere b60d419848 [IMP] mrp: add a method, for easier inherit, with the selection of BoM line in manufacturing order
Closes #7079
2015-06-19 11:33:50 +02:00
Goffin Simon 415401f3e7 [FIX] mrp: action_produce
Introduced by #6451
The method "precision_get" returns the precision in digits.

opw:642773
2015-06-18 12:23:42 +02:00
Denis Ledoux 235cd2d015 [FIX] mrp: find company bom when MO created from procurement through cron
Manufacturing Orders can be created from procurements,
as SUPERUSER_ID, since the procurements can be processed
through the WH scheduler, which is always ran as SUPERUSER_ID

In such a case, the record rules are ignored, and a BOM
normally not accessible to a user thanks to the multi-company
record rule could be chosen as the BOM of the MO.

This revision forces to find a BOM from a specific company
in such a case.

opw-640120
2015-05-18 17:20:31 +02:00
Daniel-CA 68599dcd43 [FIX] mrp: avoid float representation error
Avoid ZeroDivisionError if a move is confirmed with quantity of 0 (when stored
in database where the rounding is done by the precision defined on product_qty
field.
Fixes #6439
2015-05-08 10:47:32 +02:00
Goffin Simon 44fecec058 [FIX] mrp: Manufacture Order Sequence
The name of the manufacture order created must include the sequence linked
to the company of the salesperson.

opw:632600
2015-05-08 08:46:16 +02:00
Lionel Sausin 9d7b6aa67f [FIX] mrp: default sequence on bom line
To avoid null sequence
Fixes #6074
2015-05-05 17:25:21 +02:00
Goffin Simon 8a7993958d [IMP] mrp: properties on mrp.bom.line
Now it's possible to put a property on a bom line.
For example, the bom for an apple pie and for an apricot pie can be made
in a single bom.
Three lines are necessary in the bom of the product "pie":
	- First line with product " dough" without property
	- Second line, with product "apple" with property "apple" if you want an apple pie
	- Third line, with product "apricot" with property "apricot" if you want an apricot pie

The type of this bom pie must be "set" to allow the customer to assemblate
his favorite pie by himself.

Now to sell an apple pie, you must create a SO with the product "pie" and
the property "apple".

In that way, the delivery order consists of two lines:
	- dough
	- apple
2015-04-28 11:11:29 +02:00
Goffin Simon 5b479e6114 [FIX] mrp: bom properties
The bom related to the product in a sale line order must be
filtered by the function _bom_find. If two boms can be applied
on a product, the bom with the smallest sequence is applied.

opw:632558
2015-04-28 11:11:29 +02:00
Goffin Simon 1aed46d2a8 [FIX] mail: Work order translation
The action_confirm function losses the context when called by a workflow.
To have the right translation, the lang of the user must be written in the context.

opw:632873
2015-04-20 15:56:48 +02:00
Christophe Simonis b5e1e14c5d [MERGE] forward port of branch saas-3 up to 59d82e6 2015-04-07 14:08:15 +02:00
Christophe Simonis 59d82e6fe7 [MERGE] forward port of branch 7.0 up to 5042d91 2015-04-07 13:36:01 +02:00
Martin Trigaux 49e7e67a27 [FIX] mrp: allow same product on different bom line
Relax the constraint on BoM to allow to have two different lines with the same
product. As the error message says, the purpose of the constraint was to forbid
having the manufactured product as one of the components but had this side
effect.
Such scenario of the same product twice makes sense when using the date
attributes on the lines (e.g. changing quantities)
opw 621468
2015-04-02 16:06:14 +02:00
Nicolas Martinelli 7ecb78adfa [FIX] mrp: cancel remaining products to consume if no more products to produce
opw: 630222
2015-03-27 13:35:18 +01:00
Denis Ledoux 8e48eb625d [FIX] mrp: ability to search BOM on BOM lines containing ...
In BOM, when performing an advanced search
on "BOM Lines" contains "a name"
all lines were returned, whatever the lines content.

This was due to the simple fact no field 'name'
was set on the mrp.bom.line model.

We set "product_id" as _rec_name, it seems the more
logical choice.

opw-631335
2015-03-26 09:55:24 +01:00
Christophe Simonis 3540ec53e4 [MERGE] forward port of branch saas-3 up to 6b70b80 2015-03-25 18:00:08 +01:00
Christophe Simonis 6b70b80a0e [MERGE] forward port of branch 7.0 up to 881c10b 2015-03-25 17:41:53 +01:00
Nicolas Martinelli 52649934e3 [FIX] mrp: constraints capacity_per_cycle to be strictly positive
A capacity per cycle only makes sense if it is strictly positive. This also prevents to
divide by zero in _bom_explode.
2015-03-19 11:33:04 +01:00
Josse Colpaert 06909462b1 [IMP] mrp: Make it possible to define a rule from stock > production to use the correct procure method
It is very cumbersome to define routes which have 2 step in on production for certain products with
procurement rules (e.g. Stock > Raw Materials Location > Production), when the
products are MTS elsewhere.  That is why we add the possibility, which might be elaborated in the future,
to define rules e.g. from Stock > Production, which you can put on the product / product categories.  These
rules will only define the procure_method for now.
2015-03-12 18:23:20 +01:00
Josse Colpaert 656f5a4498 [FIX] mrp: Extra moves and multiple split corrections in consumed and produced moves
ORM will show lines in production.move_lines even if done (which the domain should avoid)
when processing the production (as they are probably still in cache).  We explicitly skip those lines.

When producing more with lots in consumed and produced, we added the consumed_for link as
the lot tracking requires to have this link between the consumed and produced moves.

The extra move of the produced goods should also be confirmed and not created as confirmed immediately.
That way it can still apply the push rules.  (Gabriel Demmerle)
2015-03-11 16:07:26 +01:00
Denis Ledoux 20173836b1 [FIX] mrp: preserve bom lines order within produce wizard
BOM Lines are ordered by a sequence field,
the "handle" widget makes even possible the lines reordering.
The order was respected within the mrp.production
(in o2m products to consume and consumed products)
but not within the mrp.product.produce wizard

opw-629629
2015-03-09 12:14:24 +01:00
Denis Ledoux d93c4bef1d [FIX] mrp: always use float_compare to compare floats
When comparing a float value to 0.0,
it can happen the float value is very near to 0.0,
but not exactly 0. This is the point to use float_compare,
```float_compare(qty, 0, self.pool['decimal.precision'].precision_get(cr, uid, 'Product Unit of Measure'))´´´
will compare qty to 0, with the product unit of measure precision (0.01 by default).
So, if qty is equal to 0.00001, this means the qty is regarded as equal to 0.0.
(float_compare will return 1).
2015-03-09 11:49:41 +01:00
Denis Ledoux 87dd06c941 [MERGE] forward port of branch saas-3 up to 8c150c6 2015-01-15 14:43:32 +01:00
Denis Ledoux 8c150c609e [MERGE] forward port of branch 7.0 up to 7530d28 2015-01-15 13:37:30 +01:00
Ravi Gohil 7530d28183 [FIX] mrp: production traceability
Upstream traceability on produced goods (serial number on finished product) was
broken due to wrong values in cache for production.move_lines2 after production.
Refresh the value of production after each action_consume to make such the state
of the cache is correct. opw 609450

Similar fix for manufactruing order not going in done state in some specific
configrations (e.g. some components being phantom BOM).
Again due to wrong cache state after consumption. opw 610515
Fixes #1296
2015-01-15 12:04:23 +01:00
Denis Ledoux a692c6e934 [MERGE] forward port of branch 7.0 up to f406847 2015-01-15 11:49:28 +01:00
Denis Ledoux 30a7bea024 [FIX] mrp: prevent creating production lines when testing if production is of product type
The method test_if_product, used in the workflow to test that the mrp production is for a product (!= service), used to call the method _action_compute_lines in order to compute the production lines and determine from them the production type.

The thing is, the method _action_compute_lines, despite the fact it returns the lines of the production, actually creates the lines. So, just to test if the production was of product type, the productin lines were created, in database.

This rev. introduces a _prepare_lines method, which returns the computed production lines, without actually creating them in database, so the test_if_product method can test if the production is of product type without creating the production lines.

Therefore, production lines are now computed and created during the action_compute method, instead of computing them when the production was tested to get the production type.

Computing the lines before the action_compute has as side effect to not set the scheduled date of the work orders in module mrp_operations, at MO confirmation (as, on confirmation, the action_compute method is called only for productions for which the lines are not yet computed, and mrp_operations overide action_compute to set the scheduled date)

opw-620189
2015-01-14 15:37:27 +01:00
Akash Balar 70a51cd761 [FIX] mrp : skip lines not within date range specified on BOM
As date_start and date_stop are date field and not datetime, should use
DEFAULT_SERVER_DATE_FORMAT for search. opw 619592
2015-01-14 12:10:46 +01:00
Josse Colpaert d2d4a3bb71 [IMP] When cancelling MO, cancel the procurements of the consume lines related 2014-12-17 14:58:31 +01:00
Holger Brunn 8eae018b27 [FIX] mrp: keep traceability of procurement.group
Pass group_id information when a manufacturing order is created from
a procurement to keep a better traceability and know the reason of stock.move
creation.
Fixes #4019
2014-12-03 17:30:44 +01:00
Denis Ledoux 02f4f9a572 [MERGE] forward port of branch 7.0 up to e2dd18f 2014-11-26 12:35:36 +01:00
Denis Ledoux e2dd18f1e7 [FIX] mrp: prevent recursion from phantom boms with no lines
if the bom is phantom and has no line, we attempt to find a new bom with the default product uom
This is possible that we find the same bom that the current one
In such a case, we must not explode, to avoid recursion.
2014-11-26 12:34:45 +01:00
Denis Ledoux d9e48bae42 [MERGE] forward port of branch saas-3 up to 7ab4137 2014-11-14 16:58:24 +01:00
Raphael Collet b8071bbaca [FIX] addons: incorrect new-api invocation of method write() with context
This fixes #3411.
2014-11-13 13:34:55 +01:00
Christophe Simonis e74fb09a00 [MERGE] forward port of branch 7.0 up to ab5ecef 2014-11-12 10:56:38 +01:00
Martin Trigaux e27afc13cb [FIX] mrp: prevent suppression of bom if used in mo
The field bom_id is required on a manufacturing order and deleting a mrp.bom would block the current mo.
Restrict the suppression for manufacturing order in progress.
Fixes #3417
2014-11-10 15:37:53 +01:00
Denis Ledoux 3a7dffd6cc Revert "[FIX] mrp: chain product move and MO locations"
This reverts commit 61a8971db5.

This rev. is from a 7.0 forward port b4d602fdd3379a0310ec0b9a56f9b88226

This is no longer needed in 8.0, with the new WMS
2014-11-05 13:51:52 +01:00
Denis Ledoux 89716cb4d6 [MERGE] forward port of branch saas-3 up to c666030 2014-11-05 13:40:30 +01:00
Denis Ledoux c666030539 [MERGE] forward port of branch 7.0 up to cd69dee 2014-11-05 13:39:41 +01:00
Julien Legros 61a8971db5 [FIX] mrp: chain product move and MO locations
When validating a SO containing a `make to stock` + `manufacture` product
(with bom + orderpoint), we have the following stock moves:
* Product move
* Manufacturing order
Selling 1 such product would yield 2 as incoming quantity, an
inconsistency that this commit solves by setting the location_id of the
product move to the MO's location_dest_id (in the same fashion that
the create_pickings method does in an mts/buy case)

opw-616229
2014-11-05 12:44:02 +01:00
Josse Colpaert c589b49afa [FIX] When extra move for consumption lines, copy lot and when producing more than produced, create extra move 2014-10-25 21:30:18 +02:00
kevin wang ef4d8b2df0 [FIX] mrp: traceability of production
When consuming product, the main_production_move is set as the source of production (used for consumed_for parameter)
However the method action_consume now (since 661a204) returns the new moves (when spliting) instead of the original one. This means that the tracebility would fail.
2014-10-17 17:21:30 +02:00
Josse Colpaert 85f1efac61 [FIX] Produce line should be connected to its procurement
[FIX] Better to work through the production_id of the procurement
2014-10-17 13:19:39 +02:00
Josse Colpaert 3b46d03255 [FIX] Can not execute line when stop date is EARLIER than current date 2014-10-07 13:57:09 +02:00
Josse Colpaert 884a8ad4a5 [IMP] UoM corrections + Adapt tables in stock doc
[IMP] Float_compare before splitting moves in mrp
2014-09-30 10:31:33 +02:00