100 Commits
Author SHA1 Message Date
Simon Lejeune ffdc64a57d [REM] stock,mrp,purchase: outdated documentation
An updated and user friendly documentation is available at
https://www.odoo.com/documentation/user/14.0

closes odoo/odoo#46185

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-10-15 09:20:05 +00:00
Simon Lejeune c065d5b92d [REF] mrp: is_planned and is_partially_planned
the `planned` state was removed but still used in a bunch of places
make `is_planned` stored and use it instead

closes odoo/odoo#54845

Related: odoo/upgrade#1710
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-09-02 08:04:18 +00:00
Simon Lejeune 5adb0463ea [FIX] stock: default quantity to return
The code was wrongly always taking the reserved quantity on the already
returned moves, but if they're done their value is zero.

task-2291973

closes odoo/odoo#54807

X-original-commit: 7b08f0ae0a39e8f575b21e744de16264b6365704
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-07-23 08:00:08 +00:00
Simon Lejeune f44da631f4 [ADD] stock: forecast widget 2020-07-31 12:36:54 +00:00
Simon Lejeune 058698e104 [FIX] stock: move line: write
Write is overridden on reserved move lines to make sure the quants are
correctly updated. It is divided in two parts: if you update the reserved
quantity and if you update a characteristic. If somehow both are updated
in the same call (which doesn't happen in the standard interface), then
the quants are unreserved two times, which is wrong.

This issue showcased by [0] and on databases where the reserved
quantities are made editable by customization.

We grouped the two update in one, such as the TODO indicated us since a
long, long time.
We removed `result_packaged_id` from the trigger because it should not
impact the reservation whatsoever.
We needed to remove a tricky logic in the stock move's backordering part
but it was fishy anyway.

[0] eac8c06e2233

closes odoo/odoo#53928

X-original-commit: 507101434f9221f2cfa6de66e1952676fff322fd
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-07-01 16:09:31 +00:00
Simon Lejeune 249a1a7541 [FIX] mrp: bunch of fixes
Bunch of last minute fixes including:
- serial handling in tablet view
- expected durations and backorders
- button unplan unlinks the leave but the computed aren't recomputed
  then we need to manually set the date_planned_start/finished
  then we need to not propagate them on the related document
  (move/production) because they are required
- operation company_id wrongly set

task-2241471
2020-06-15 16:59:42 +02:00
Simon Lejeune 4060387988 [REF] mrp: start next workorder (community)
task-2241471
2020-06-15 16:59:41 +02:00
Simon Lejeune b435508fcf [FIX] stock: _action_confirm on confirmed move
task-2241471
2020-06-15 16:59:41 +02:00
Simon Lejeune bffd343d5a [REF] mrp: check availability not primary
This action isn't a mandatory step.

task-2241471
2020-06-15 16:59:41 +02:00
Simon Lejeune b0a905a41d [REF] mrp: move plan_from to a wizard
task-2241471
2020-06-15 16:59:41 +02:00
Simon Lejeune 1b6421285c [REF] stock: allow using _set_quantity_done in onchanges
task-2241471
2020-06-15 16:59:40 +02:00
Simon Lejeune 93156e7c31 [FIX] stock: move: allow writing the same quantity done
..even if multiple move lines already exists.

task-2241471
2020-06-15 16:59:40 +02:00
Simon Lejeune 02359fd78b [FIX] stock: quantity done compute
mismatch on the move lines used by the compute.

task-2241471
2020-06-15 16:59:40 +02:00
Simon Lejeune bd250eb18a [FIX] stock: done quantity and reservation compute in onchange
Following v13, newId records are instances of NewID and are ignored from
any `read_group` call. This breaks an important feature: when encoding a
stock move line (thus, in an onchange context), the `quantity_done` field
of stock move should be recomputed.

task-2241471
2020-06-15 16:59:40 +02:00
Simon Lejeune c660770ebd [REF] mrp: remove routing model
Set the operations directly on the Bill of Material.
Duplicate the demo data where a routing was shared.
Adapt the tests.

Remove the following feature:
    - set the same routing on parent and kit child bom
    - when planning, if the component of the kit have the same operation
      than a component of the parent bom, merge these operations

task-2241471
2020-06-15 16:59:40 +02:00
Simon Lejeune 0a768b9c3f [FIX] stock: multi-steps, backorders and return
1. Activate receipt in 3 steps
2. Make a PO of 50
3. Receive 20 (pick 1), backorder
4. Receive 29 (pick 2), backorder
5. Receive 1 (pick 3)
6. Transfer to quality check location 45 (pick 4), backorder (pick 5)
7. Go to pick 5, unreserve the quantity
8. Go to pick 3, return 1 => the quantity suggested by the return wizard is 1

The return is not able to reserve the necessary quantity.

This happens because 45 units are considerd out (from pick 4), but only
1 unit is considered in (pick 3). Therefore, in the following:

https://github.com/odoo/odoo/blob/23511dffb9e3f597a7df9bb834d008f74abb07b8/addons/stock/models/stock_move.py#L1276

we have `quantity = -44.0` and `available_quantity = 5.0`, so we can't
reserve.

We count as `move_orig_ids` all the siblings coming from
`move_dest_ids`.

opw-2261473

closes odoo/odoo#52084

X-original-commit: ba89e26750baab2309cccc4ffd0b3ade804d19ce
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-05-28 11:53:14 +00:00
Simon Lejeune fadaf8b748 [FIX] stock: _check_backorder
Check backorder is divided in 3 blocks:
1) quantities on move lines linked to a move
2) quantities on move lines without moves nor products but with a
package
3) quantities on move lines without moves but with a product

1) added quantities in the move's uom, 2) added quantitis in the product
uom, 3) doesn't seem to be used (and shouldn't be). Clarify all of that.

task-2239964

closes odoo/odoo#49790

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-05-25 09:50:11 +00:00
Simon Lejeune 6c3ddc3ad0 [REF] mrp: bom not required on production order
task-2226404

closes odoo/odoo#49494

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-04-10 13:02:28 +00:00
Simon Lejeune 0172a12298 [FIX] stock: return: allow stock user to unlink line
Unlinking a return line is convenient and should be allowed for stock
user. Note that the same functionality could be achieved by setting the
quantity to 0 on the line.

related to 65530dfd6a

closes odoo/odoo#48988

X-original-commit: dc77519066993ed245ef863cdf42f6c25e10c99c
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-04-03 15:31:06 +00:00
Simon Lejeune d0fc2ecfaa [FIX] stock: unlink zero quants
If you create a quant through the inventory mode of the list view and
you don't set a quantity, the quantity is null and the quant isn't
unlinked by _unlink_zero_quants.

Also consider null quantity as 0.

We don't have the issue for the reserved_quantity field since this one
is not nullable.

closes odoo/odoo#48005

X-original-commit: 08e428458aa545b3602c56b6866a447126cf8825
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-19 10:56:36 +00:00
Simon Lejeune da818a9aae [FIX] stock_dropshipping: double sequence
Due to a typo, dropshipping sequences were created twice. We created a
"stock.dropshipping" sequence if no "stock.dropshippping" sequence was
found.

closes odoo/odoo#47908

X-original-commit: 021268734a5857f47cda5991fbd28abdd41f512a
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-18 11:53:56 +00:00
Simon Lejeune d07066bd11 [FIX] stock: routes report: handle mtso
At the moment, when a rule has a supply method "Take from stock, if
unavailable, trigger another rule", it is displayed as a "take from
stock" rule

In order to differentiate the rule supply method, we should rather show,
thanks to a vertical bar, when a rule is in take from stock, and use
both a vertical bar and the three dots when it is in "take from stock,
if unavailable, trigger another rule"

task-2205748

closes odoo/odoo#47541

X-original-commit: e1c1093c3d5fb7be69e8d1d26bcac184b5dc07b2
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-12 17:15:06 +00:00
Simon Lejeune d944e67b46 [FIX] stock_account: _action_done performance
Validating a receipt of 90 stock moves having ~300k products in the
database goes from 7 minutes to 11 seconds thanks to the addition of
"active_test=False in the context before doing the searches on valuation
layers.

Most searches on "stock.valuation.layer" are done when validating a
move, but since this model contains an active field, the orm will
pathologically complete the searches expression by adding "id in active"
products. If the list is long, it slows down everything.

Since this field was only added to have a filter on the valuation
reports, it doesn't matter at all to ignore it in "_action_done".

It would probably have been cleaner to just remove the field but it
doesn't fit the stable policy. Nevertheless, we're going to remove the
field in master with task-2178269, as well as this patch.

opw-2209797

closes odoo/odoo#47523

X-original-commit: 466a8319547e11e2193dd8594b0e50e3c27d4b3e
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-12 15:36:03 +00:00
Simon Lejeune 53e89e5006 [FIX] product: expand group on categories only when needed
Issue: on main product's kanban, if you group by categories, all
categories (even the empty ones) appear. This is not desired.

We only wanted this group_expand logic when using the products stat
button on the product category form view.

closes odoo/odoo#46966

X-original-commit: e3f1254e5b28aa801f137835d871427786fb3428
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-05 12:25:06 +00:00
Simon Lejeune 9104424186 [FIX] stock: move line: create batch
related to 896e36edab

Fixes #41813

closes odoo/odoo#46114

X-original-commit: e75bc034f121fd3790ebe11bb1b579e000912d2a
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-02-24 13:58:10 +00:00
Simon Lejeune e9d3047ba2 [FIX] stock: write on warehouse name
fixes #19696

closes odoo/odoo#46093

X-original-commit: d4d012f693d3c177c782623bb1b460fa1a81d6eb
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-02-24 12:36:31 +00:00
Simon Lejeune 858c2e4da0 [FIX] stock, mrp: move with zero as initial demand
Set the following product configuration:

Storable finished product with a flexible BOM made of storable
components in manufacture + MTO:
Component choice 1 Quantity = 0
with BOM made of component 1, quantity 1 with purchase mto route
Component choice 2 Quantity = 0
with BOM made of component 2, quantity 1 with purchase mto route

Create a MO for finished product, set the "to consume" quantity of
"Component choice 1" to 1, and try to mark it as to do. The following
issue is raised: The quantity to produce must be positive!

This is because a procurement with 0 quantity will be solved in a MO
producing 0 quantity. We fix this issue by ignoring procurements with 0
quantities.

Also, this MO without initial demand is not considered assigned. We fix
this issue by considering 0 move as assigned.

task-2159374

closes odoo/odoo#45552

X-original-commit: dffb3a1f2762d6e1517eb9b7d225521f99d874d5
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-02-17 17:11:11 +00:00
Simon Lejeune 3b69775323 [FIX] stock: remove manual tracking of stored computed fields
since it is now implemented by 020e2a5e85

closes odoo/odoo#45309

X-original-commit: d8c916112aa943712bbb93f1aa1ac59da2aa9524
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-02-13 14:42:59 +00:00
Simon Lejeune e2b42f3718 [FIX] stock_landed_costs: flaky tests
We chose the vendors by searching random res.partner but sometimes
partners of another company are returned, making the _check_company
mechanism raise an error.

closes odoo/odoo#44815

X-original-commit: 1cfcf21efa888720f9c34b337532251db6fd0089
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-02-06 20:50:58 +00:00
Simon Lejeune 93b2377656 [FIX] stock_landed_costs: reconciliation with vendor bill
in anglo saxon accounting
- receipt products through an rfq
- when creating the vendor bill of the rfq, directly add a landed costs
  product
- post the vendor bill then create the landed cost, validate the landed
  cost
- the aml of the LC is not reconciled with the aml of the vendor bill
  for the lc product because the "You are trying to reconcile some
  entries that are already reconciled." error.

We fix this by filtering out the already reconciled aml.
Not that the flow is behaving as expected if the landed cost is created
in another vendor bill, such as the tests were doing. We thus add
another test.

opw-2184988

X-original-commit: 1e78527ac5295563e9610ad9ddd98834998285f3
2020-02-06 20:50:57 +00:00
Simon Lejeune de26f4a4e8 [FIX] stock_account: anglo saxon and corrections
Don't ignore correction layers when computing the anglo saxon price
unit. We use the `stock_valuation_layer_id` field on the layer to point
the correction layer to the corrected layer. When computing the average
price of the delivered things, ignore correction entry but take them
into account when choosing a corrected entry.

opw-2179900

closes odoo/odoo#44774

X-original-commit: 3831649b81c1271977730cdf46100f814687af61
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-02-06 17:15:18 +00:00
Simon Lejeune aca23d578e [REF] stock, stock_account: indices for fast move unlink
Stock moves records can be unlinked in some cases, for example when
confirming a move containing a kit, the original move is unlinked and
replaced by the moves of the components of the kit.

This commit adds two indices to accelerate the unlink of stock move
records. The fields were the indices are added are foreign key on stock
move, and postgres checks the foreign keys of the rows before deleting
them.

closes odoo/odoo#44426

X-original-commit: e34a176dd438fe0f4f1a384889bfdc196f2c4b4f
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-02-01 09:49:33 +00:00
Simon Lejeune 2b314aad5c [IMP] stock_picking_batch: display moves and move lines
* allow to directly edit the move lines of the batched transfers
* add a check availability button if any move is not assigned yet

task-2069646
2020-01-31 12:40:08 +00:00
Simon Lejeune 2105895bb6 [IMP] stock_picking_batch: add to batch wizard improvements
We check the selected pickings are compatible to be attached to an
existing batch transfer.

We add the possibility to create on the fly a batch picking to attach
the selected pickings.

task-2069646
2020-01-31 10:22:14 +00:00
Simon Lejeune d644e4d72d [REF] stock_picking_batch: report improvements
wording

task-2069646
2020-01-31 10:22:14 +00:00
Simon Lejeune be169f6a81 [REF] stock_picking_batch: stock picking to its own file
task-2069646
2020-01-31 10:22:14 +00:00
Simon Lejeune eaccf27482 [REF] stock: header in picking form
Only keep buttons in the header to be able to disable them with an xpath
without breaking every attrs elsewhere in the form.

Why? We want to disable these header buttons when opening a picking from
the bach transfer (by clicking on a line on a o2m list).

task-2069646
2020-01-31 10:22:14 +00:00
Simon Lejeune 8084f3658c [REF] stock: wording
This is not related to the batch picking task but was found while
testing it.

task-2069646
2020-01-31 10:22:14 +00:00
Simon Lejeune 1f6f76e7ef [REF] web: gantt documentation: delete attribute
Enteprrise pr 6836 will allow disabling the delete button on gantt
views. Document it is possible.

task-2088954

closes odoo/odoo#40716

Related: odoo/enterprise#6836
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-29 10:02:03 +00:00
Simon Lejeune 9d98c43581 [REF] purchase_stock: push the extra quantity
With a product configured as buy on order and a warehouse configured as
receipt in two steps, if the user increases the quantity on a po line
generated by a sale order before confirming it, the system will send all
the quantity to input but only the ordered quantity to customer. The
issue is that the "extra quantity" will stay in input.

We fix this issue by creating a new move with the extra quantity to the
input location so that push rules will send the extra quantity to stock
while the ordered quantity will be sent to the customer.

There was also an issue when incrementing the quantity on the po line
after confirmation if the po line was the result of a reordering rule:
only a move from supplier to the location of the reordering rule was
created.

This commit also introduces a change of semantic:
`created_purchase_line_id` is cleared after confirming the RFQ. This
allows to merge more in `_merge_moves`.

task-1981355

closes odoo/odoo#43545

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-28 14:51:36 +00:00
Simon Lejeune 17c542b902 [FIX] stock: _search_picking_for_assignation and immediate transfer
When a move is created through a push rule, the system will first try to
find a picking to put it into before creating a new one. It is possible
the move is placed into an immediate picking where the reservation
fields are hidden and the initial demand is updated according to the
qty_done with [0].

As this behaviour is unwanted, do not merge move into immediate
transfers (which should be short-lived anyway).

[0] 8303b1a69e

closes odoo/odoo#44086

X-original-commit: fa9efd28e6e113cd9993a29bca070ddee83630c0
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-01-28 11:14:16 +00:00
Simon Lejeune 9831f5603c [REF] stock_account: add a composite index on layers
closes odoo/odoo#43915

X-original-commit: 26fb669e0cca1c9efb8d9283755276551c608ce7
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-24 11:48:15 +00:00
Simon Lejeune 7ad5dd4d7d [FIX] stock_account: _run_fifo_vacuum
If the oldest problematic layer cannot be fixed, no need to try to fix
later one.

X-original-commit: f7ccf2b16803f05584fb094471b08f6836d892a1
2020-01-24 11:48:13 +00:00
Simon Lejeune b9334c53b8 [REF] stock: move line: some guidelines
- move all the constrains at the same place, make sure they are private
- move all the onchanges at the same place, make sure they are private
- move `_get_similar_move_lines` helper at the bottom of the file with
  the other helpers
2020-01-20 14:01:21 +00:00
Simon Lejeune 50cbaef2dd [REF] stock_landed_costs: domain on transfers
The previous domain was too naive: a receipt is not always valued
(inter-warehouse transfer) and even a receipt that should be valued
isn't always (receive goods you do not own, change your config from
manual to automated and then apply the lc on an old receipt, etc.)

Enforce a domain making sure the transfer is valued.

related opw-2165697
task-2169844

closes odoo/odoo#43410

X-original-commit: c6aa61b22a18c3f110baa7ed3c97e275b21e5329
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-16 12:07:42 +00:00
Simon Lejeune 387f199ee7 [FIX] stock_landed_costs: remaining_value and multiple lc
Steps to reproduce:
Create one product with FIFO and automatic inventory valuation.
Purchase product with 10 quantity and cost price 100 and mark shipment as done.
Add landed cost for done incoming shipment with 2 cost lines
E.g. 1. Freight Charges - 100
2. Duty and Charges - 50
So ideally after first outgoing shipment total cost should get updated in product is
(1000 + 100 + 50) / 10 which is 115

The issue is that we increment `remaining_value` on the wrong layer.

Fixes #41923

task-2167659

closes odoo/odoo#42871

X-original-commit: 8b89a5e4a85071055bc152b11cf150e62a5c5211
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-07 14:47:06 +00:00
Simon Lejeune 68be60fc82 [REV] stock: add hierarchical view for stock locations
This reverts commit d39a51259e93b84184379a1fc9b824dad94e5ea5.

This view was technically clean and useful to detect configuration
issues (wrong view_location_id for example) but was not liked by our big
boss because "a group by parent_id does the same thing".

task-2166904

closes odoo/odoo#42734

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-01-03 15:12:01 +00:00
Simon Lejeune 28a3430de1 [REF] stock_account, mrp_account: valuation layer and not admin user
missing bit from rev[0] and [1]

[0] 7ef11e3
[1] d6c8c34ef6539dad110f1e502eaee2c03d968797

closes odoo/odoo#42621

X-original-commit: 5096e724643ca77568ce2f09a40b138561f4c20f
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-02 15:48:56 +00:00
Simon Lejeune 989a78b3fc [REF] stock_account: valuation layer and not admin user
missing bit from rev[0]

[0] 7ef11e3c96

closes odoo/odoo#42517

X-original-commit: 8ff69abc9010bb2aa05dea5a5f2e1fa545e6179c
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-30 17:49:26 +00:00
Simon Lejeune b08585e071 [FIX] stock_account: negative stock and vacuum
Running the vacuum in avco indeed fixed the estimated value on the
delivery but it did not update the standard price afterwards, making it
possible to have an inconsistent standard price with the actual value in
stock, as described in [0] and in the task [1].

A test was added (and validated) in the layers test file and an two old
one were fixed. test_average_perpetual_2 displayed also a different
missing bit: the vacuum should run when the user unlock and increments a
receipt.

[0] https://github.com/odoo/odoo/pull/41669
[1] 2154638

closes odoo/odoo#42292

X-original-commit: 6e4c9b8219db0c94c29f5ee145998e6f1597bb55
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-30 09:01:17 +00:00
Simon Lejeune 4f0b6d6ce5 [FIX] stock: wrong security rule
rev[0] aimed to fix an intercompany reservation issue by allowing the
intercompany moves to be seen, however the new domain was too soft and
also allows the visibility of any moves going to a location without
company, for example now outgoing moves to customer from all companies
are visible.

We strengthen the domain to only allow intercompany moves, ie we add the
transit constraint in the domain.

We also fix the same issue for the move line model (see [1])

Now that this one is fixed, the next move is automatically reserved
during _action_done. This didn't work either, so we carefully sudo and
force_company on the destination move.

[0] 3c4bb080c3
[1] f9461c7096a65565a05136a4c6c42ddfa6881926
task-2157248

closes odoo/odoo#42270

X-original-commit: 9a237d1af79519665d0895a30c9ce55a1d835918
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-21 10:43:00 +00:00
Simon Lejeune efa1d7f303 [FIX] stock: date should be date_expected until done
date help: "Move date: scheduled date until move is done, then date of actual move processing")
As this behaviour is also wanted when the onchange mechanism do not work
(ie in a manufacturing order move raw and finished), we move it to write.

task-2154781
2019-12-20 10:11:50 +00:00
Simon Lejeune 80b55624c8 [FIX] uom: _check_category_reference_uniqueness
Edit the liters uom (default in its category) and change its category to
unit. You now have two references uom in the unit category. Try to set a
third one and now it fails.

This was because the constraint is implemented with an sql query but
since the new ORM the update in database are delayed. We force a
database update with flush so that the query gant get all the
informations it needs.

closes odoo/odoo#41621

X-original-commit: 68ced7972db64b22a4ff031bba0f78c06a88372d
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-10 09:02:53 +00:00
Simon Lejeune 782b5a347c [FIX] stock_account: value of return
When returning a delivery where the value was taken from different
receipt, the last receipt's unit cost was wrongly used when returning
the delivery.

Now we use the `unit_cost` of the delivery when returning it.

task-2150889

closes odoo/odoo#41564

X-original-commit: 468ab4f23c8212e1aba21197b3f83afe741b3d9e
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-09 10:20:06 +00:00
Simon Lejeune 6564c36c74 [REF] stock: immediate and backorder wizard multi
followup of rev [0]

If these wizards are called on multiple pickings, display the list of
the pickings that could be impacted and allow to select which one should
be impacted.

We also adapt the sanity checks at the start of `button_validte` in
order to specify the concerned pickings if needed. We do not enable the
multi behavior for batch at the moment, so it's only enabled for the
validate multi in the list view.

[0] 6ab4b0d496

task-2069646

closes odoo/odoo#41497

X-original-commit: ff276c6484b138982f185ec9c832f2dbf25baaef
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-06 14:49:38 +00:00
Simon Lejeune bc9fdfff88 [FIX] product: multi edit barcode field on template
Writing barcode on a template will only write it on the variants if the
variant count is 1. Make the field readonly on the view according to
this condition.

closes odoo/odoo#41489

X-original-commit: a67ad076f4c079f33602f01ed2b8cbf741aeffc5
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-06 10:14:40 +00:00
Simon Lejeune 0e4e21a1e7 [REF] stock: remove quantity_available_locations_domain context key
- we would have to set this domain on every actions directing to
products
-we can't set a proper depends_context since the new orm doesn't support
it

closes odoo/odoo#41322

Related: odoo/enterprise#7033
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-04 12:49:25 +00:00
Simon Lejeune 447cc7b88c [REF] stock: remove company_owned context key
This context key was used to get the valued quantities. We now have a
`quantity_svl` computed field that does this job. The test is removed,
it was showing that intercompany quants are visible thanks to a context
key but with the introduction of the on_hand filter, it is now useless
(just remove the filter)
2019-12-04 12:34:40 +00:00
Simon Lejeune 1ae66862d5 [REF] stock: products on hand action
Instead of hardcoding a domain in the action, we add a field that will
be used to apply the domain. The goal is to be able to define a static
domain in the xml so we'll be able to default on the filter while still
being able to remove it.

Let's consider this usecase:

     Physical
    |        \
   WH    Subcontracting
    |         |
  Stock    5 units
    |
 10 units

With the hardcoded domain, we have two problems
- the right part of the tree isn't visible
- the user can add a quant in subcontracting but it will disappear at
  the creation since it isn't part of the hardcoded domain.

The complicated part of the domain is the `_get_domain_locations` call.
It will use multiple context keys, the current company and get the
hierarchy of internal locations below warehouses to see what it should
include or not.

To be able to remove a domain, it should be declared in the xml and not
hardcoded in the action. Since the domain is complex, we can't express
it. So we add a computed field "on_hand" and its search method is
overiden to call `_get_domain_locations`.

task-2061825

closes odoo/odoo#40403

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-04 10:59:59 +00:00
Simon Lejeune 53658052ae [REF] stock: forecast report and quants not below a warehouse
On a quotation, the forecast report is opened with a default filter on
the warehouse of the quotation. If you remove this filter, quantities
not below warehouses (eg in subcontracting or in a repair location) are
displayed. From the product form, it's not the case, you never see these
quantities. We now add a "warehouse is set" filter that is enabled by
default (so you have the same value in the stat button forecast and in
opening the report) but you can remove it to see all quantities.

task-2061825
2019-12-04 10:40:00 +00:00
Simon Lejeune 4afba9ee68 [REF] stock: quant: add available quantity field
available_quantity is the quantity without the reservation.

task-2061825
2019-12-04 10:40:00 +00:00
Simon Lejeune 22b9343c9a [FIX] stock: multiple orderpoint
- the oderpoint_id field on the purchase order line wasn't used to not
  merge the po lines
- if the orderpoint_id field is set, use the orderpoint location to
  create the move
- if multiple stock moves with different source locations go through
  `_merge_moves`, they should obviously NOT be merged
- `virtual_available` computed field was not being invalidated when the
  context keys "warehouse" and "location" changed

task-2001462

closes odoo/odoo#40573

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-12-02 12:33:38 +00:00
Simon Lejeune df79800545 [REM] stock: forecast view not imported
rev[0] only removed the override by mrp. The new report was merged in
rev[1].

[0] dc35b88411
[1] b311d9ccba

closes odoo/odoo#40543

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-11-20 08:35:54 +00:00
Simon Lejeune 09f66f4885 [REM] stock: unused controller
This was a remnant of the old old barcode client action.
2019-11-20 08:35:31 +00:00
Simon Lejeune ea92c813fd [FIX] stock_landed_cots: bring bach additional_landed_cost in the view
This field was deemed redundant and thus removed from the view but we
forgot the use case where multiple valuation adjustment lines are
generated (eg applying a lc on multiple pickings) and the added value
by picking must be adapted manually (eg decrease one to increase the
other).

task-2125127

closes odoo/odoo#40454

X-original-commit: 3e6d6315adf1c33ec3fd5eb106defb0c80d7290b
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-11-18 16:42:15 +00:00
Simon Lejeune 94e91972d4 [FIX] sale_stock: hide effective_date when empty
task-2125070

closes odoo/odoo#40412

X-original-commit: 965ef8ea1b2dcf3415e3f002248c8fb68cbfdfb6
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-11-18 11:04:23 +00:00
Simon Lejeune 29d8fc091a [FIX] stock: picking: immediate and state
Issue: create an immediate transfer, add a move and a done quantity, the
picking is in waiting state instead of ready.

Due to rev[0], the moves added in an immediate transfer have an initial
demand. After auto-confirming them, their state were 'confirmed' and not
'assigned'.

Solution: we force the state to assigned

[0] 8303b1a69e

closes odoo/odoo#39492

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-11-13 15:40:40 +00:00
Simon Lejeune 4d653af6e9 [REF] stock: planned transfer: additional moves
Before this patch, move added in a planned transfer once it is ready are
directly marked as assigned and the reservation is disabled on them.

People found it hard to understand why the check availability button did
not appear, plus the push rules were not applied.

Now we chose to use the autoconfirm mechanism on the added move and we
don't reserve them, so the check availability button reappear.

task-2081844
2019-11-13 15:40:40 +00:00
Simon Lejeune eea62c09c9 [FIX] stock_account: standard price update upon delivery
Make sure to update the standard price with the computed unit cost of
the candidate and not its `unit_cost` field, as the computed could
contain an extra value from a landed cost.

closes odoo/odoo#40208

X-original-commit: 9234ea1e32609ee7b5c22b836c33eefa20220d37
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-11-13 14:38:02 +00:00
Simon Lejeune 9823170f51 [REF] *: adapt tests to picking button_validate multi 2019-10-25 08:10:40 +00:00
Simon Lejeune f1972c2130 [REF] stock_picking_batch: use picking button_validate multi 2019-10-25 08:10:40 +00:00
Simon Lejeune 6ab4b0d496 [REF] stock: make picking button_validate multi
So we have to adapt
- the sanity checks
- the immediate/backorder wizards
- split the call to _action_done with and without backorder

This is a preliminary work to remove all the override in
stock_picking_batch and to allow choosing the pickings to immediate or
backorder directly in the wizards.

Before this commit, both wizards were calling _action_done and one
another. We make them go back through `button_validate` so that it is
more sane to handle and allow future extensions to add pre-action done
wizards.

Also the first part of button_validate is some sanity check. We adapt
them to be multi (inside of a loop over self) without any other
changes.

Now the wizard can work on the records (immediate: write the done
quantities) or work with the context (backorder: picking ids to not
backorder in the context).

Also we adapt the stock sms weird wizard (a confirmation wizard but the
feature is auto installed? wth). Now there it isn't manually called in
the middle of button_validate but it uses the pre_action_done_hook.

task-2069646
2019-10-25 08:10:40 +00:00
Simon Lejeune 38711e9f9c [REF] repair: multi company
task-2081645

closes odoo/odoo#38294

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-10-15 08:49:24 +00:00
Simon Lejeune 2124f1b930 [FIX] stock_account: avco and unlock
Fixes #38313

closes odoo/odoo#38555

X-original-commit: 843c22fc14a138a6104c6ce8f26b928ef0337d18
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-10-11 22:36:32 +00:00
Simon Lejeune 2c22675ead [FIX] stock: remove move 'without package' properly
This revert the revert 61fa590e67 now that
400efc4d40 is merged.

closes odoo/odoo#38184

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-10-08 11:25:57 +00:00
Simon Lejeune 61fa590e67 [REV] stock: remove move 'without package' properly
This reverts commit 3431d7b1cd.
Due to recent changes in the orm, editing a draft move crashes. We
revert this commit while we find a proper fix.

closes odoo/odoo#37752

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-10-02 06:56:43 +00:00
Simon Lejeune fae07f3bd5 [REF] stock_account: filters on valuation layer
closes odoo/odoo#37701

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-10-01 12:28:52 +00:00
Simon Lejeune 12824cb432 [FIX] stock: width on buttons
closes odoo/odoo#37617

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-30 14:39:51 +00:00
Simon Lejeune 6e61595055 [FIX] stock_landed_costs: tests across two days
Two testcases failed when ran at 23h59 and 50 seconds because of a wrong
order on date.

closes odoo/odoo#37599

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-09-30 13:00:47 +00:00
Simon Lejeune ad31097d8e [FIX] stock, delivery: put in pack and discard
rev[0] writes the qty done on the move lines directly in put_in_pack,
meaning hitting discard in the delivery wizard left the move lines with
a changed qty_done. We fix that by editing the quantities in
_put_in_pack in the stock module and getting the right move lines in the
delivery modules: meaning, get the normal or suggested ones (a fix
missed by rev[1]) then with quantities or 0 quantities.

[0] e03c1a836f
[1] f6d88a2e8d

closes odoo/odoo#37563

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-30 11:58:38 +00:00
Simon Lejeune 971c376c5c [REV] mrp: Explicitely label by-products
This reverts commit 42834e4eb3.

finished_workorder_line_ids contains finished products and by products.
Naming the section by-products is not clear when the settings isn't
enabled.

closes odoo/odoo#37588

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-30 11:31:03 +00:00
Simon Lejeune 14a50ce62f [REF] mrp: better gantt view for workorder
Implement group_expand for workcenter_id so that all workcenters are
visible in the planning by workcenter gantt.

Implement some constraint on write because anything can be moved in the
gantt view.

When changing the workcenter of a workorder, make sure the leave is now
set on the new workcenter.

closes odoo/odoo#37386

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-25 09:08:47 +00:00
Simon Lejeune e75ea301f6 [FIX] mrp: workorder operations and kit
When a BoM was composed of a phantom BoM, there was mutliple bugs:
- if not routing was set on the phantom BoM, the components were never
  consumed
- if no operation was set on the BoM, its components were to be consumed
  on the last workorder of the BoM and of the phantom BoM.

closes odoo/odoo#37304

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-25 08:05:03 +00:00
Simon Lejeune 895fb09b74 [FIX] stock: put away on parent locations
oversight of bad6db2483

Closes #37289

closes odoo/odoo#37361

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-24 15:01:36 +00:00
Simon Lejeune fe1b52971f [REF] product: group_expand for categories
closes odoo/odoo#37308

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-23 15:11:49 +00:00
Simon Lejeune d1814891fe [REF] mrp_subcontracting: manage backorder
closes odoo/odoo#37046

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-18 07:15:32 +00:00
Simon Lejeune deeb17cef0 [REF] mrp: improve error message in run_manufacture 2019-09-18 07:14:53 +00:00
Simon Lejeune d5111aec9f [REF] sale, sale_stock: dates
Remove the "sale.group_sale_order_dates" group and settings, all the date
fields are always displayed but we put schedule_date and commitment_date
(for which the label was renamed "delivery date") on the same line (with
a design to make the schedule date looks like a suggestion for the
delivery date).

task 2057802

closes odoo/odoo#37174

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-20 07:02:22 +00:00
Simon Lejeune 2425c7b223 [FIX] mrp: set planned date when creating order through procurement
If it isn't set manually, it defaults to now and the result is not
consistent with planned date end. We make it an hour before totally
subjectively.

closes odoo/odoo#37173

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-19 15:03:21 +00:00
Simon Lejeune e0cf0dd792 [FIX] stock_landed_costs: account move view
The landed cost model is limited to the warehouse manager, so displaying
the view changes on account move did not make sense for all users plus
it broke the creation of invoices for account users.

closes odoo/odoo#36914

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-16 09:07:18 +00:00
Simon Lejeune bda5fa4372 [FIX] stock: assign serial icon
Using classes and inline style break the list view if the button has a
0 width

closes odoo/odoo#36443

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-11 12:39:51 +00:00
Simon Lejeune f35fa53c88 [REF] mrp: unbuild access rights
Give to a regular mrp user the same access rules than he has on
production orders.

closes odoo/odoo#36883

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-13 14:30:50 +00:00
Simon Lejeune e4cba4d037 [FIX] purchase_requisition: supplier info
When a blanket order is opened, a supplier info is created and should be
used in priority over a regular supplier info with the same values.

That's what rev [0] tried to do but there was some mistakes: the
`purchase_requisition_id` field added in the order is ignored since it
isn't stored and the test didn't failed because the created blanket has
a lower price unit than the regular supplier info, meaning it is used in
priority. Setting the same price unit (50) result in the new purchase
order line merged in the first one.

Do not re-implement the same order.
Adapt the test now that we know the order didn't work (see rev[1]). The
user has to manually set a higher priority to the supplier info
generated by the purchase requisition.

[0] e85838d358
[1] 2ac4f2ee0f

closes odoo/odoo#36840

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-13 10:09:40 +00:00
Simon Lejeune 3f0ed7d045 [FIX] product: _select_seller
With the new ORM, x2m records are not ordered by default.

The _select_sellers implementation requires to loop on the supplier info
records ordered by their _order. We fix that by sorting with a lambda
with the same order set on the model. Simply using .sorted() isn't
enough since it does a sort in sql, so newId records are completely
removed from the resulting recordset.

This is related to task 1947351 and PR 34049.

We move the tests into purchase_stock and actually implement the tests
proposed in the task.
2019-09-13 10:08:48 +00:00
Simon Lejeune f6d88a2e8d [FIX] stock: put in pack without showing the reservation
rev[0] added the possibility to put in pack without setting any done
quantity on move lines but when the reserved move lines are hidden
(thanks to rev[1]) it got confused on which move lines to work on.

[0] e03c1a836f
[1] ffd5d5a097

closes odoo/odoo#36832

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-13 09:37:32 +00:00
Simon Lejeune d6dcbce4fb [FIX] mrp: view mobile friendly
rev [0] was incomplete, the
possible_bom_product_template_attribute_value_ids field was not computed
in mobile because parent_product_tmpl_id was not sent to the server.

rev[1] broke the normal produce wizard

[0] 5d5644c721
[1] 916b49381b

closes odoo/odoo#36595

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-10 08:06:49 +00:00
Simon Lejeune 5ed25aadb6 [FIX] sale_stock: cannot see a dropship picking
since 1a33056557

closes odoo/odoo#36579

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-09 15:41:04 +00:00
Simon Lejeune 5d5644c721 [FIX] mrp: bom view mobile friendly
closes odoo/odoo#36577

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-09 15:17:06 +00:00
Simon Lejeune 916b49381b [REF] mrp: produce wizard mobile friendly 2019-09-09 15:17:03 +00:00
Simon Lejeune cc8994a4ef [REF] stock_account: consider consumable product for anglo saxon entries
closes odoo/odoo#36560

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-09 12:35:32 +00:00