Commit Graph

2208 Commits

Author SHA1 Message Date
Josse Colpaert fe15829c16 [IMP] stock: when applying a push rule the new move should not be linked to the same procurement anymore 2016-06-21 10:16:07 +02:00
Nicolas Martinelli d39d191cec [FIX] stock: reserve if move not assigned
Commit 4a0b6f6 slightly improves the performances of `action_assign` by
skipping moves which already have pack operations. However, if the move
is not completely assigned, it prevents the possibility to search for
new quants to assign to the given move.

opw-672069
2016-03-22 17:17:37 +01:00
Goffin Simon f66fcf97b2 [FIX] stock: Transfering the pack
When transfering the pack, the priority to the moves in state "assigned"
or partially_available(=true) must be given.

Used case (steps):

-set warehouse with three steps to delivery
-create one product A with qty on hand 10
-create sale order with first line product A by qty 2 and the second line with product A with qty 10
-confirm sale order
-check availability
-transfer pick by qty 10
-transfer pack by qty 10

The pack couldn't be transered

Now the pack is transfered.

Closes: #10764

opw:668682
2016-03-15 16:15:18 +01:00
bima d01ecb6e79 [FIX] stock: wrong variable used in _handle_renaming
Could incorrectly rename the stock.location.path objects, and in case
the route has push_ids but no pull_ids would crash the method entirely.

closes #10747
2016-02-03 09:55:43 +01:00
Nicolas Martinelli 3ac46ee3d4 [FIX] stock: propagate UoS quantity
Both UoM and UoS quantity change should be propagated.

Fixes #10623
opw-667805
2016-02-02 11:25:57 +01:00
Goffin Simon bafa1a677e [FIX] stock: creation of stock inventory adjustement
The system cannot create two inventory adjustements in state 'in Progess'
with the same product, with the same location, same package, same lot and
same owner.
Example:if two adjustments(ADJ1, ADJ2) are created with the same product(P)
and with the same location(L), let's say:
qty_available for P is 10
in ADJ1: Theoritical Quantity=10 and Real Quantity=20 => a quant with +10 is created
in ADJ2: Theoritical Quantity=10 and Real Quantity=30 => a quant with +20 is created

When ADJ1 is validated then qty_available for P is now 20(that 's ok)
When ADJ2 is validated then qty_available for P is now 40(that's wrong because
the Real Quantity is expected which is 30)

This is why this fix is required.

opw:660658
2016-01-29 12:25:30 +01:00
Goffin Simon 5009944410 [FIX] stock: action_cancel
When writing several times on the same record in the same transaction,
the orm raise a Missing error because the rowcount only gives one
difference.

opw:666470
2016-01-21 14:51:56 +01:00
Denis Ledoux d349584f9d [FIX] stock: state change tracking
The `stock.picking`.`state` field is set
to track the change of values
(`track_visibility='onchange'`)

It's supposed to write the state changes
within the picking thread.

It does not work properly for function fields,
as the onchange tracking is designed to work
only with direct user changes, direct
`write` operations on the record, while,
here, the state value changes according to the
picking moves changes, for instance.

To solve this, the tracking changes have to be
hooked within the `create` & `write` methods
of the model on which this function depends on.

Therefore, from now, when changes are
performed in the moves, on the fields that
could lead to the picking state change, we
force the tracking of the picking state.

In addition, we had the `mail_notrack` key
in the context when creating back orders,
to avoid displaying the back and forths
in the state
e.g. when transferring 9 units on 10, the
changes were displayed as below:
Draft -> Waiting availability
Waiting Availability -> Ready to Transfer
Ready to Transfer -> Draft
Draft -> Partially available
Partially Available -> Waiting availability
Waiting Availability -> Transferred

opw-666317
2016-01-20 15:10:00 +01:00
Josse Colpaert 4bd64dc91b [IMP] stock: avoid deletion of quants by user
Quants should never be changed or deleted by a user.
We make it not possible anymore in the views.
And also in the code we avoid to unlink without
passing a specific key in the context.
(as we still need to be able to delete quants in case of
negative quants reconciliation)
2016-01-15 13:40:09 +01:00
Nicolas Piganeau 9bab0aca2f [FIX] stock: can not unpack a package
Quants can only be written by the administrator.
A stock user could not use the unpack feature and was getting an access rights error.
Closes #9961
2015-12-28 15:21:47 +01:00
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