Commit Graph

2198 Commits

Author SHA1 Message Date
Alexandre Fayolle 9f65dad250 [FIX] stock: mutation of the context
If the method do_enter_transfer_details is called form the new API, the context
is a frozendict and can not be updated and the previous code would crash.

Copying it before updating.

Closes #9872
2015-12-10 12:25:34 +01:00
Matthieu Dietrich 0d0bb69bb1 [FIX] stock: Only re-reserve moves not done or cancelled
`Recheck availability` must ignore
the done or cancelled moves.

Otherwise, it raises the warning telling you cannot
unreserve a done move.
856b31719c/addons/stock/stock.py (L1899)

To reproduce the issue:
 - Create a delivery order,
   with 10 stockable product A
   & 10 stockable product B,
   mark as todo.
 - Create a receipt,
   with 5 stockable product A,
   mark as todo & transfer.
 - Cancel the move of stockable product B from the delivery order,
   in Traceability -> Stock Moves.
 - Come back to the delivery order, `check availability`,
   then, `recheck availability`

Closes #9550
2015-11-16 17:13:25 +01:00
Jos De Graeve 92bfe3208a [FIX] stock: speed up backorder creation in barcode ui
Set no_recompute to True
in order to speed up barcode picking UI

This is done for the same reason than
7b306fc17a
merged through #6754.

The remaining quantities will be computed in the
`do_transfer` method, thanks to the call
`picking_recompute_remaining_quantities`.

There is therefore no need to recompute
the remaining quantities for each pack operation.

Closes #9142
opw-645883
2015-10-20 10:34:15 +02:00
Josse Colpaert f102a8bc23 [FIX] stock: in assign method, to force_assign moves should avoid duplicates courtesy of Wolfgang Taferner closes #8522 2015-10-16 15:12:36 +02:00
Leonardo Pistone 3349187aab [FIX] stock: propagate owner to backorder moves
When delivering partially a picking in which the moves
had an owner (`restrict_partner_id`) set,
the owner were not kept in the backorder moves.

Closes #4693
2015-10-12 17:47:29 +02:00
Nicolas Martinelli 186c77dad1 [FIX] stock: do not remove lot id when splitting lot
Partial revert of the commit b62191c171.
We want to keep the lot number if we don't add all the products at once.

opw-648629
Fixes #7044
2015-09-09 10:50:04 +02:00
Josse Colpaert 56a6483477 [FIX] stock: inventory filters check used the wrong groups 2015-09-02 18:21:31 +02:00
Denis Ledoux 772112e8d0 [FIX] stock: warehouse rename with missing operation types
It wasn't possible to rename a warehouse if one
of its picking types (except `In Type`) was
not set

opw-647815
2015-08-24 10:15:20 +02:00
Alexandre Fayolle 74b7b97209 [FIX] stock: let resupply from warehouse work
If you set WH B to be resupplied from WH A, then the scheduler will
generate a procurement with warehouse_id = B and location_id = B.stock.
Running the procurement will find the resupply rule, and this will
create another procurement with warehouse_id = A and location_id =
transit location.

However, without this patch, the resupply route is not part of the
route_ids of warehouse A, and so the 2nd procurement goes in exception
because if cannot find a rule (the search will force a rule linked to a
route which is part of A.route_ids).

Closes #7956
2015-08-12 08:14:48 +02:00
Nicolas Martinelli fb3dd3f0f4 [FIX] stock: do not overwrite date_done when a backorder is created
When the user specifies a Date of Transfer ('date_done') and only transfers the
order partially, we must keep the value instead of overwriting with today's
date.

opw-646908
2015-08-10 11:28:44 +02:00
Denis Ledoux 6ebbbdbae9 [FIX] stock: no uom rounding for DO availability & reservation
Instead of rounding the availability and reversation
of a delivery order line to the current UOM rounding,
we round to the generic Product of measure precision.

This is to have the real availability, even for a unit
of measure that normally cannot be split.

For instance, for a product for which the default
uom is 'Unit(s)', but for a specific delivery order
you deliver 1 'Dozens' of this product,
if you have 6 Units available, it will now display
that 0.500 'Dozens' is available and reserved, which
is what is actually happening.

Before, it displayed that 1 dozens was available, even
if only 6 units were available, on the 12 needed.

opw-643312
2015-08-07 15:25:07 +02:00
Josse Colpaert fa1842cb1d [FIX] stock: add procurement group for extra moves in picking
When pack operations generate extra moves, they should
take the same procurement group as those of the picking.

That way, when invoicing, they will be put on the same
invoice when there is a different invoice address on the
sale order.
2015-08-06 14:55:44 +02:00
Denis Ledoux 28f89db7b7 [FIX] stock: call to `create` of ir.sequence using args=
By default, the argument to pass the record values is `vals`,
not `values`.
Besides, it's not mandatory to provide the argument name
when it's not optional.

opw-646374
2015-08-03 18:04:57 +02:00
Holger Brunn 1e8f8eabec [IMP] procurement, stock: make procurement.rule.name and stock.location.route.name translatable
Closes #4222
2015-07-08 13:42:59 +02:00
Christophe Simonis acc7d20ea9 [MERGE] forward port of branch saas-3 up to ac865c8 2015-07-07 15:12:41 +02:00
Christophe Simonis ac865c8a78 [MERGE] forward port of branch 7.0 up to 9fa7624 2015-07-07 13:58:35 +02:00
Nicolas Martinelli 9fa7624e25 [FIX] stock: onchange_quantity and onchange_uos_quantity use rounding
It is necessary to round the quantities with the appropriate precision. Indeed,
since onchange_quantity and onchange_uos_quantity trigger each other indirectly,
it is quite easy to fall in an infinite loop if the uom and uos precisions are
different.

Follows commit 6e346f0adb

opw-643651
2015-07-07 11:25:19 +02:00
Loïc BELLIER 34b9f43011 [FIX] stock: add location in context on prodlot search
To be consistant with the results of _get_stock. Otherwise search made on
stock_available may not display results with the same value than the search
criteria.
Fixes #3976
2015-07-06 14:41:56 +02:00
Nicolas Martinelli 6e346f0adb [FIX] stock: product_uos_qty must have the precision of Product UoS
If 'Product UoS' has a higher precision than 'Product Unit of Measure', the
method onchange_uos_quantity will be called over and over by an infinite loop
if 'product_uos_qty' doesn't have the sufficient number of decimals.

opw-643651
2015-07-03 16:42:34 +02:00
Nicolas Martinelli e69a9b1ea8 [FIX] stock: modify default destination location for Pick
Ship in 2 steps:
The Packing zone location is inactive but it is used by default as destination
location (instead of Output) in the Pick operation.

opw-643734
2015-07-02 15:35:17 +02:00
Goffin Simon 6531f4063a [FIX] stock: origin of push picking
To determine the origin of a push picking.

opw:641887
2015-07-02 09:20:47 +02:00
Denis Ledoux fcc2852a27 [FIX] stock, jit: run isn't supposed to be called without jit
This is related to ddfc07a6a2.

If procurement_jit_stock is not installed,
the method `run` of `procurement.order` is not
supposed to be called
2015-06-30 18:34:03 +02:00
Denis Ledoux 3378e6212b [FIX] stock: `stock.move` `action_confirm` without context passed 2015-06-30 18:07:17 +02:00
Denis Ledoux ddfc07a6a2 [IMP] stock: run all procurements together on moves confirmation
On moves confirmation, multiple procurements can be created
and ran.

For performance concerns, we now run all procurements together.

opw-643560
2015-06-30 17:24:24 +02:00
Denis Ledoux 7d01029320 [FIX] stock: computation fields depending on `_get_pickings`.
This revision is related to 279f225cf0.

`_get_pickings` is used as trigger store method
for several computation fields.

The trigger restriction applied in the above commit should
only be applied on the `min_date`, `max_date` and
`priority` fields.
2015-06-30 14:38:49 +02:00
Denis Ledoux a4aa4e5c75 [FIX] stock: product_qty compute field priority.
This rev. is related to 279f225cf0.

The `product_qty` computation priority should be
important, as other compute fields depends on it
such as `weight` and `weight_net` from the
delivery module
2015-06-30 14:36:47 +02: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
Goffin Simon 2a6564872b [FIX] stock: Source document
The procurement created from a move has as source document[by priority]:
	[1] move.rule_id.name
	[2] move.origin
	[3] move.picking_id.name
ps: the internal transfer is created with this procurement.
opw:641887
2015-06-18 09:24:34 +02:00
Alexis de Lattre 404b668370 [IMP] stock: Add _prepare_picking_assign method in _picking_assign for easier inheritance 2015-06-16 18:07:08 +02:00
Goffin Simon 70c21d7b0d [FIX] stock: source document
The origin of a stock.move must be the same of its  picking destination.

opw:641887
2015-06-16 09:38:11 +02:00
Goffin Simon cc6c4f2408 [FIX] stock: theoretical quantity
The default real quantity must be the theoretical quantity.
2015-06-12 15:30:22 +02:00
Goffin Simon 3a9e6828f1 [FIX] stock: Unit of Measure
When the uom(Unit) set by default is not in the same category than the uom category of the product,
the uom of the product is set.
When the uom is changed, the theoretical quantity and the real quantity are recomputed.

opw:641027
2015-06-12 13:23:40 +02:00
Nicolas Martinelli ed6a622c02 [FIX] stock: choose quants depending on original move when scrapping
When a product is scrapped, we set the reservation_id of the scrapped move on
the quant corresponding to the original move (e.g., the move which brought a
manufactured product from production to stock). By doing so, we will subtract
the quantity to scrap from the appropriate quant.

opw-641852
2015-06-12 12:38:55 +02:00
Leonardo Pistone a3e4a1f39f [FIX] stock: propagate owner when generating extra move 2015-06-08 18:23:31 +02:00
Goffin Simon 1da3a8b353 [FIX] stock_account: description for extra moves
The extra moves must take into account the field description_sale or description_purchase and
the field default_code set on the product.

opw:640387
2015-05-28 13:59:11 +02:00
Nicolas Martinelli 9fe2e04c0d [FIX] stock: prevents multiple source/destination locations for the moves of the same picking
opw-640414
2015-05-28 08:44:19 +02:00
Nicolas Martinelli 4a7b383527 [FIX] stock: method do_prepare_partial takes into account moves in state 'waiting'
When scrapping received products, the state of the move will be switched back
from 'assigned' to 'waiting' in method 'recalculate_move_state'. These moves
must be taken into account in 'do_prepare_partial', which is called when
clicking on 'Transfer'.

Note that this bug would only appear if:
- reception in 2 steps is set
- the products are received without scrapping in the first step
- on the second step, we first scrap, then transfer. If we transfer,
  cancel, scrap and transfer, it works since the pack_operation_ids have been
  calculated correctly during the first click on 'Transfer'.

opw-640415
2015-05-27 15:13:57 +02:00
Nicolas Martinelli f4a9afdd31 [FIX] stock: add a default group_id if stock.move created from stock.picking
The group_id of a picking is related to the group_id of the first stock.move
related to it. When a stock.move is added to a picking manually, the group_id
is normally not set. This can be an issue in a very specific case:

- In Settings / Sales, tick "Allow setting a different address for delivery and invoicing "
- Create a SO - Invoicing on delivery
- Customer: Agrolait; Delivery address: Thomas Passot
- Add a line: ice cream
- Confirm the SO
- In the DO, add a line , with an expected date higher than the one of the existing move
- Save
- Mark as todo
- Force reservation
- transfer - transfer
- Create invoice
=> See that two invoices are created, one for Agrolait, one for Thomas passot ( the DELIVERY address )

opw-639955
2015-05-26 15:37:41 +02:00
Christophe Simonis b62ee0734c [MERGE] forward port of branch 7.0 up to eaaca65 2015-05-21 14:11:39 +02:00
Nicolas Martinelli ba896aabe7 [FIX] stock: if cost_method of a product is 'average' do not round the currency conversion
This prevents rounding errors if product decimal precision is different from
currency precision.

Fixes #6547
opw-634390

Do not fowardport since already done in v8.0:
https://github.com/odoo/odoo/blob/8.0/addons/stock_account/stock_account.py#L310
2015-05-20 17:00:37 +02:00
Denis Ledoux f66b7ee62a [MERGE] forward port of branch saas-3 up to 70f2225 2015-05-19 10:28:30 +02:00
Denis Ledoux 70f22254f5 [MERGE] forward port of branch 7.0 up to 335a8af 2015-05-19 10:26:33 +02:00
Nicolas Martinelli 335a8afe79 [FIX] stock: remove state modifiers for field note in stock.picking
Remove the state modifiers for field note in stock.picking in order to have a
behavior which is consistent with sales orders or invoices.

opw-639956
2015-05-18 14:52:06 +02:00
Nicolas Martinelli 769fc81140 [FIX] stock_account: fix dependencies
Purchase and Sale are not part of the dependencies of stock_account, so purchase_line_id
and sale_line_id might not exist.

Fixes #6619
2015-05-13 12:51:18 +02:00
Goffin Simon 71b3861a54 [FIX] stock: Inventory adjustment
When importing a csv in Inventory Adjustement, a default product_uom_id is set if there 's
no product_uom_id given in the csv.

opw:634612
2015-05-13 09:14:49 +02:00
Nicolas Martinelli b8779f0c53 [FIX] stock: keep inventory options consistent
Make sure that appropriate fields are emptied when switching to in between inventory filters.
This prevents incoherent results due to hidden fields which were filled in a previous selection.

opw-634388
Fixes #6512
2015-05-11 08:30:10 +02:00
Nicolas Martinelli 561346db9e [FIX] stock: forbids possibility to make inventory of all products when a given product is chosen
opw-634388
Fixes #6512
2015-05-07 14:04:26 +02:00
Denis Ledoux 576cf26a53 Revert "[FIX] stock: `product_qty` field is not recomputed at record creation."
This reverts commit a1da6c2132.

This revision was a temporary patch to solve function fields
computation issues, solved thanks to the commit b7f1b9c01e
2015-05-06 17:27:17 +02:00
Denis Ledoux 90cb409be9 [FIX] stock: procurement set as done of sets bom.
In the case of sets, several stock moves can have
the same procurement.

Therefore, appending procurements in the list `procurement_ids`
without checking if the procurement isn't already in the list
could lead to having several times the same
procurement in that list,
and could therefore lead to the check of the same procurement
over and over, leading to performances issues and the fact you cannot
call `write` on a list having several times the same id.
See models.py 3875

Using a set instead of a list solve this issue

opw-634393
2015-05-04 18:05:17 +02:00
Martin Trigaux 6e25d6e589 [FIX] stock: better recomputation of pack operations
Revert c06a96 "[FIX] stock: force recomputing transfer information on picking"
and unlink packoperations only when move lines are changed (fix opw 620636).

c06a96 introduced a regression as it prevents to plan moves (e.g. assigning lots
through the barcode interface) before the reception.
2015-04-29 17:36:20 +02:00