Commit Graph
5835 Commits
Author SHA1 Message Date
svs-odoo 78562201db [REM] mrp: remove _decrease_reserved_quanity
As `_do_unreserve` was rewrited, the `_decrease_reserved_quanity` method
isn't useful since its purpose was to avoid to unlink all stock moves
and it is what `_do_unreserve` cares about.

See 2e41338f42e2ef9f2ac2b3e73b274c4af242b28a

closes odoo/odoo#42582

Related: odoo/enterprise#7488
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-31 12:40:09 +00:00
Hemali Bhimani f168703247 [IMP] *: updated import templates to match data model
purpose of this commit is to make import template compatible with v13

task-2146510
closes-#42279

closes odoo/odoo#44375

X-original-commit: 37aadf1227531838ada7dc3810cf463379736e96
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-01-31 12:04:45 +00:00
William Henrotin 7e21192b2b [FIX] mrp: show 'check_availability' button after reservation
Due to the setting `ready_to_produce` = `asap` on Bill of Material. The
Check Availability button could be hidden even if some stock moves are
still in confirmed state.

Task : 2121714

closes odoo/odoo#41631

Related: odoo/enterprise#7253
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-30 12:40:38 +00:00
William Henrotin f37ae92cd6 [IMP] mrp: Add new components in workorders
Purpose: adding new component in a specific workorder via the form view.
This behavior is only available if the Bill of Material is in flexible
consumption. Adding new component was already made possible in
e1f518bb83 but the ability to add new
workorder lines conditionnaly in the workorder form view was missing.

Task: 2121714
2020-01-30 12:40:38 +00:00
William Henrotin 4cfcc36d0e [MOV] mrp: check finished lot in mrp module
Consuming product tracked by lot (or serial number ) to produce product
also tracked must ensure the link between the two lots (consumed and produced)
is always set. This test is not done in community version while there is
one in the enterprise conterpart (mrp_workorder module). This commit
move this test to the mrp module to have it everywhere

Task : 2121714
2020-01-30 12:40:22 +00:00
William Henrotin c883ed1087 [IMP] mrp: Add or update components in confirmed state
This commit let the manufacturing user to add new components or update
the quantity to consume of existing ones in a manufacturing order even if
the state confirmed. The BoM should be in flexible consumption.

In case of reserved quantity, updating the quantity on a raw move will
unreserve it entirely. We apply the same logic than the stock.picking one

Task : 2121714
2020-01-30 09:47:22 +00:00
William Henrotin ec0d5b4882 [IMP] mrp: choose operation to consume new product
This commit adds the possibility to choose in which operation a new product
will be consumed. New product can be added to the production once the
manufacturing order is in state draft.
Before this commit, the new product was consumed
automatically in the last workorder.

Task: 2121714
2020-01-30 09:47:22 +00:00
William Henrotin 96b17a82cf [IMP] mrp: unit_factor as computed field
The next commits will allow changing the initial demand of
confirmed moves as well as adding move once the production
order is confirmed. In order to not duplicate again the unit
factor computation in multiple write and create, make the
field a stored computed.

Unit_factor is stored and only depends on product_uom_qty because
updating only quantity_done (after a partial production for
instance) should leave unit_factor unchanged for the futur
partial production.

Task: 2121714
2020-01-29 16:09:58 +00:00
Rémy Voet (ryv) 237afe8e50 [FIX] mrp: fix the unbuild button
We get a traceback when we try to unbuild a MO
due to a inexistant field call (scrap_qty) instead
of product_qty -> 8458cc1867.
Fix the issue.

closes odoo/odoo#44249

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-30 08:31:19 +00:00
Ankita Raval 1728cd0c4e [REF] mrp: disabled delete on workorder gantt and calendar
task-2088954
2020-01-29 09:58:08 +00:00
Arnold Moyaux 7466f2cae8 [FIX] mrp: allow to use variant in order to build another variant
Usecase for example A black T-shirt made  from a white T-shirt and
black color. This behavior was possible in 12.0 and 11.0 and was
removed by commit 77a8d92196

Close #40540

closes odoo/odoo#44084

X-original-commit: 575353e251a0cce3bbff759edaeb56b5718beb11
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-01-28 11:13:36 +00:00
jbm-odoo 00b2046460 [IMP] calendar: Adapt views and test for new color and filters
closes odoo/odoo#41573

Taskid: 2153249
Related: odoo/enterprise#7157
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-27 16:08:34 +00:00
Nicolas Martinelli d1a0601660 [FIX] mrp: display human readable lot
Display the readable value of lot name in the Production Order report.

opw-2178868

closes odoo/odoo#43990

X-original-commit: 7e82b77a80fe70da45676fd87a458ffe9948e48d
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-27 10:52:58 +00:00
Nicolas Martinelli cfc088de1e [FIX] mrp: default picking type from dashboard
- Create a picking type for operation 'Manufacturing Operation'
- From the dashboard, click on 'Production Order'

The picking type set on the MO is not correct.

This is because the current picking type is not used when choosing a
default value.

We set it in the context to do so.

opw-2171977

closes odoo/odoo#43898

X-original-commit: 3e2ee43fd0aa6a06d5d5ecd1ff669f4a09698330
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-24 09:54:06 +00:00
Rémy Voet (ryv)andAnkita Raval bd2bbb27fe [IMP] mrp: add unbuild button on MO
In this commit:
- On done MO's form, add an Unbuild button, it would open a
wizard with the form view of an unbuild, and some pre-filled fields
such as MO, product, BOM, quantity and total quantity finished which
can be edited.
- In the unbuild order, improve the on_change of mo_id:
if the selected product is tracked by serial number,
set quantity to 1 by default and readonly
- Also clean the testcase of unbuild order.

task-2144636

closes odoo/odoo#43719

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Co-authored-by: Ankita Raval <anr@odoo.com>
2020-01-24 10:47:52 +00:00
Rémy Voet (ryv)andAnkita Raval 8458cc1867 [IMP] stock, mrp, repair: improve the insufficient quantity wizards
Improve the inherited wizards of 'stock.warn.insufficient.qty' by adding
some piece of information about the quantity involved. Also
change titles to integrated the related product into.

task-2144636

Co-authored-by: Ankita Raval <anr@odoo.com>
2020-01-24 10:47:43 +00:00
Rémy Voet (ryv)andAnkita Raval 106c583a10 [IMP] stock, mrp: add actions to unreserve
Add action to unreserve on the stock.picking and
on the mrp.production tree views.

task-2144636

Co-authored-by: Ankita Raval <anr@odoo.com>
2020-01-24 09:16:12 +00:00
Rémy Voet (ryv) b0d22b5752 [IMP] purchase_mrp: link MO<->MO<->PO in case of MTO
In case of MTO (+buy) on products used in a MO,
add the link between the MO source and the PO generated.
Also add links between MO's when MTO+manufacturing.

task-1913392

closes odoo/odoo#43366

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-24 12:04:47 +00:00
Rémy Voet (ryv) eee5c6443b [FIX] mrp: truncate millisecond to check overlaps
In some flows, a planned_datetime_start/finished will contains
milliseconds. In these cases, we can detect overlaps/conflicts between
workorders but these conflicts can't be see in the web interface
(because datetime is truncate when it is display).
Then, change the conflicts computation to remove milliseconds
in search of conflicts.

task-2169447

closes odoo/odoo#43013

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-22 12:31:40 +00:00
Rémy Voet (ryv) 4246e5b5b0 [IMP] mrp: improve small details of WO views/model
- Now, the fields date_planned_start and date_planned_finished is
required in views, because it was strongly related to the leave date_to, date_from
which are required.
- Change the name_get in case of single WO in MO and replace the dot
by a dash.
- Improve the WO form view to be more responsive when it is open from the
gantt view.
- Change name of a Operation in the demo data

task-2169447
2020-01-22 12:31:40 +00:00
Rémy Voet (ryv) 0f679c66ba [IMP] mrp: change workorder plan behavior
- Before, the auto-planning of workorder autorize overlaps between then.
E.g. if a workorder (WO1) begin at Now + 30min with a duration of 60 minutes
and we try to plan a new workorder (WO2) Now, this one will be plan now
until Now + 120 min (30 min of WO2 + 60 min of WO1 + 30 min of WO2).
In our case we don't want this behavior by default,
because in real case, it is not efficient to work on job A during
30 min, after change to pass to a other job B, and rework on A after
the job B.
But in a other hand, we need to accept overlaps with no-working hours
intervals. Then, rewritte the _plan_workorders method to take
these features in account.

Also small fix about the planning has been done:
- Due to the strong link of date_planned(_...)  between the MO and WO,
the replan of the late first WO was wrong.
If the MO is planned before now, then don't take in account
date_planned_start and try to plan WO as soon as possible.
- Also, fix error handling when the WO is planned before the
previous one.

task-2169447
2020-01-22 12:31:40 +00:00
István Csányi 0665cebe73 [FIX] mrp: incorrect outgoing qty
- Create a new Product
- Add a BOM to this product
- Set the BOM to be a kit
- Add components to the BOM
- Create a PO for the components for a qty of 5
- Confirm the PO but don't transfer the products
- Check the phantom kits outgoing_qty and incoming_qty they will match

A Phantom Kit Products outgoing_qty and incoming_qty are identical

Closes #43447

closes odoo/odoo#43584

X-original-commit: 4b2e235be6cab947ce2e0b3b17b54530f984ce72
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-20 15:00:10 +00:00
Rémy Voet (ryv) d165a8ce13 [IMP] mrp: remove groups of post inventory button
Show the Post Inventory button to manufacturing users,
also if they are not in debug mode.

task-1887035

closes odoo/odoo#43294

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-20 14:01:21 +00:00
Rémy Voet (ryv) 53ebf7491e [REM] stock: remove dead-code
Remove dead code of the main stock module:
 - Unused actions
 - Unused private methods
 - Unused helper methods test
2020-01-20 08:57:36 +00:00
Nicolas Martinelli 4775192027 [FIX] mrp: UOM on unbuild order
Keep the same UOM than the MO.

opw-2169377

closes odoo/odoo#43407

X-original-commit: 942154b3140cb3fc92e8aeff0241149e701581a7
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-16 11:48:22 +00:00
Simran Gajsinghani 6b2bfdd8b9 [FIX] stock : Prevent drag and drop from Inventory dashboard
In this commit,
-The behaviour of drag and drop is blocked when grouping the
 operation type and warehouse on inventory dashboard.

closes odoo/odoo#43229

Task-id: 2167610
X-original-commit: 5e8bcd3a5bfff9a5dc740287605d4ff661a701f7
Related: odoo/enterprise#7689
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-13 15:59:25 +00:00
Arnold Moyaux 94fd0624af [IMP] mrp: procurement with service BoM
Previously when the BoM on a product do not have components but only
services. Then during scheduler a log was posted on the product explaining
that components are required.

However since this process is possible in another usecase it should be
possible with procurement. The only difference is that procurements
confirm records in order to propagate. In this case since there is
no components and services are not propagate with procurements, it's
not needed to confirm the MO.

closes odoo/odoo#43133

Task: 2170845
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-13 13:17:29 +00:00
jdoutreloux 52ed0be17e [IMP] uom : remove 'measure_type' field
This removes the measure_type field which has become unused and
causes issues when users try to add new uom categories.

Task-2043927

closes odoo/odoo#41056

Related: odoo/enterprise#6945
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-13 11:19:17 +00:00
Arnold Moyaux 56efb55057 [IMP] stock, mrp, purchase_stock: RR check forecasted stock
When the scheduler runs, each orderpoint will check the forecast stock
for an infinite time. As example, if we plan a receipt of 10 products in
4 months and need to deliver 5 products next month, procurement will not
be launched since we have a forecasted quantity of 5.

In order to improve it, the orderpoint will compute the total lead days
from rules, suppliers/production delays, security days,...
Those lead days will be added to today in order to know at which date
the forecast stock should be checked and trigger the replenish document
for today in order to be delivered at the correct date.

Task: 1849912
2020-01-09 16:09:12 +00:00
Arnold Moyaux bdc2280309 [REF] stock: perf orderpoint as batch
Currently orderpoint run one request at a time. However it's not
efficient since compute are some private methods could be executed
one time in batch instead of record by record.

The strategy in order to improve it is:
- Still cut the orderpoints in batch of 1000 (usefull when using a new
cursor with intermediate commit)
- For each batch of 1000, create a list of procurement values and run
them in batch (commit a2a6b099a4 for more info)
- Each time a procurement exception is raised, catch the failing
orderpoint and rollback to the state before run. Remove the failing
order point from the current set and run it again.
- run method try to catch a maximum  errors by continuing to process even it
finds error in order to stack them. It would avoid to run the same set
again and again each time an error is raised.

test_orderpoint_1 took 975s before this patch and 100s after.

Task: 1849912
2020-01-09 15:59:12 +00:00
Arnold Moyaux 2e747cedf4 [IMP] stock, purchase_stock, mrp: Procurement exception
Currently when a procurement fail it will raise a user error.
Some function as run in stock_rule catch the errors and merge
them in a single error.

Also since commit a2a6b099a4 procurements
are executed in batch and in some cases, we would like to have more
information about the error. For example in orderpoint we would like to
know which orderpoint is responssible for which error.

It would also be possible to return an object with the details but
procurements pass through a lot of different method that already have
their own return signature and a simple exception is easier to manage.

Task: 1849912
2020-01-09 12:17:39 +00:00
Nidhi Patel 6c39b5c90c [FIX] mrp: traceback on multiple MO deletion
_log_downside_manufactured_quantity is an api.one method since it would
log the production info on the generated acitivty.
Since commit b499c3308c, an unlink will trigger an _action_cancel on
unlinked MO.
So unlink multiple MO will call _log_downside_manufactured_quantity
with multiple records and traceback.

closes odoo/odoo#42892

Task-id: 2168386
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-01-08 09:25:37 +00:00
rso-odoo c14cc595f3 [FIX]mrp: change description if there is no workorder
task-2128553

closes odoo/odoo#42853

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-08 05:14:08 +00:00
Nicolas Martinelli 5c3451b404 [FIX] mrp: date comparison
Make sure `to_date` is not `False` before comparing.

opw-2165860

closes odoo/odoo#42855

X-original-commit: dbb478507791957e3329d68cfb68dd4f1fab4b70
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-07 13:36:14 +00:00
Rémy Voet (ryv) 9a5608aee7 [REM] mrp: remove unused fields of workorder
Remove color and capacity fields of mpr.workorder unused
and coming from commit : 2ddc35a530 .

closes odoo/odoo#42498

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-30 15:05:24 +00:00
Rémy Voet (ryv) 4c98c92bd0 [FIX] mrp: fix gantt unavailability
_get_unavailability_intervals didn't return the correct
dict (describe in the docstring). Then the override in
maintenance module was wrong.

task-2082261

closes odoo/odoo#42530

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-31 09:43:21 +00:00
Nicolas Martinelli 6956ebbce6 [FIX] mrp: unbuild with push rule
- Create products A & B
- Create a BOM: 1 unit of A to produce 1 unit of B
- Create a Route which applies on products with the following Rule:
  Action: Push To
  Operation Type: YourCompany: Internal Transfers
  Source Location: WH/Stock
  Destination Location: WH/Stock/Shelf 1
  Automatic Move: Automatic No Step Added
- Apply the route to A
- Create a MO for B, validate
- Create an Unbuild Order for the MO created, validate

The component (A) has a `stock.move` to WH/Stock/Shelf 1 but a
`stock.move.line` to WH/Stock.

This is because the `stock.move.line` is created when the quantity is
set in:

https://github.com/odoo/odoo/blob/98b1039705d5911946ed3b5180e4d114dc809ed4/addons/mrp/models/mrp_unbuild.py#L151

However, the `_run_push`, which only changes the `stock.move` location,
is called on `_action_confirm` during the call to `_action_done`:

https://github.com/odoo/odoo/blob/98b1039705d5911946ed3b5180e4d114dc809ed4/addons/mrp/models/mrp_unbuild.py#L152

The solution is to call `_action_confirm` before the creation of the
`stock.move.line`.

opw-2156132

closes odoo/odoo#42493

X-original-commit: ac0f43f704a988f11e4670e241380b76dc81f8fc
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-12-30 13:53:10 +00:00
Debauche Stéphane a73bed91a0 [IMP] stock/mrp: add a new alert system in the form view
Add two widgets in the `mrp.production` / `stock.picking` form view.
The widget is visible only if one of the stock move linked to the `mrp.production` / `stock.picking`
has the flag `delay_alert_date` set.

Task #1970595
2019-12-30 15:12:08 +00:00
Debauche Stéphane b7f46da90d [IMP] mrp: remove field date_start_wo
This field has been removed, and we now use `date_plan_start` instead.

Task #1970595
2019-12-30 14:27:19 +00:00
ryv-odoo c7b9602165 [IMP] mrp: add extra information about scheduling
Add scheduling information (icon) with popover to show info/warning/error
about the scheduling of workorder. Four extra pieces of information
is given (level change the color of the icon):
- Info level; If previous WO and pending state, show sheduling info of the previous WO
- Warning level; info if the WO is late
- Error level; if conflit with other WO (same workcenter in same time)
- Error level; if previous WO is planned after the current one

Also, add a button (in the popover) to replan correctly all WO of the MO of
the current WO (only if it is not in ready/progress and error(s) is detected).

It is done via a JSON data compute field ('json_popover') in the workorder and
the popover_widget of stock. It is allowing use to make computation in batch
and avoid to add lot of fields.

task-2082261

closes odoo/odoo#41950

Related: odoo/enterprise#7296
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-30 11:05:40 +00:00
ryv-odoo d50e2b0010 [IMP] mrp: add sequence of work order in the display name
In order to clarify the flow of work order in calendar and gantt view,
add the sequence number of WO by MO. This sequence is
compute during the call of the "name_get".

task-2082261
2019-12-30 08:19:40 +00:00
ryv-odoo 6c16892ded [IMP] mrp: show unavailabilities hours/days in the gantt view of work order
In order to improve readability of the gant view of
the work order, show the unavaibilities of work center
when it is grouped by.

task-2082261
2019-12-30 08:19:40 +00:00
ryv-odoo 88f573b7fe [IMP] mrp: adapt work order form manager view
Change the order of the page of notebook to be
more pertinent for the manager point of view.
Also move workcenter and production (_id) fields
from the miscellaneous page into the main form.

task-2082261
2019-12-30 08:19:40 +00:00
William Henrotin dd76e2df97 [FIX] mrp: remove dynamic domain on production 2019-12-27 10:00:43 +00:00
William Henrotin 945730ca35 [FIX] stock: remove dynamic domain on stock_move_line 2019-12-27 10:00:43 +00:00
William Henrotin 6c4447ef59 [FIX] stock: remove dynamic domain on stock_rule 2019-12-27 10:00:43 +00:00
Debauche Stéphane e4e838a019 [FIX] mrp: delay_alert and manufacturing order
When a manufacturing order was created through a stock rule, the `delay_alert`
feature was broken. Indeed, we should store on the order the `delay_alert` value
similar to what we do with the `propagate_date`, `propagate_date_minimum_delta`
and `propagate_cancel` fields.

We thus add the missing field and add the values in the multiple prepare methods.
We also the missing values for `propagate_date_minimum_delta` and `propagate_date`
in `_get_move_raw_values`.

task-2154781

closes odoo/odoo#42032

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-20 10:12:37 +00:00
Debauche Stéphane 0dd1958091 [FIX] mrp: propagate_date and planned orders with a routing
`propagate_date` enables the automatic rescheduling which could lead to hard to
 understand behavior if a manufacturing order is planned, i.e. if the work orders do
 have their leaves booked in the workcenter calendar. We thus disable the
 automatic rescheduling in this scenario.

task-2154781
2019-12-20 10:11:50 +00:00
Debauche Stéphane 8944674d6d [REF] mrp: date_planned_start and date_planned_finished
Before this patch, writing on the `date_expected` field on the raw moves did not
update the `date_planned_start` (but writing on `date_planned_start` did write on
the raw AND finished moves `date_expected`).

This proved to be wrong: having the same `date_expected` on both raw and finished
moves did not make sense (the manufacturing order is not instantaneous). It also
makes difficult to make the rescheduling work: the rescheduling is done on the stock
moves and thus updates `date_expected` on the raw moves. If this information is not
transmitted to the manufacturing order, we won't be able to continue the rescheduling
on the finished moves (the idea is to update the raw moves which will update the
date_planned_start which will update the date_planned_finished which will update the
finished moves)

To have a more sane system, the `date_planned_start` and `date_planned_finished` are
computed (with an inverse) on the raw and finished moves `date_expected` (similar to
what's done on the picking model). There's a tweak though: as `run_manufacture`
creates first the order with a `date_planned_finished` and then confirm it (which will only
create the finished move at this moment), there's no place to write `date_planned_finished`.
The compute thus defaults on `date_deadline` which is stored and the finished moves
will be created later on with this value.

We implement the same logic `_onchange_date_planned_start` in `write` so that it doesn't
only rely on the onchange mechanism and the rescheduling can work when changing the
`date_expected` on a child mo for example.

task-1970595
2019-12-20 10:11:50 +00:00
Pratima Gupta d255bdbfac [FIX] mrp: delivery moves not cancelled
Before this -
If we have follwing configuration -
Manufacturing -> Propagate Cancel -> True
Buy -> Propagate Cancel -> True

* BOM of a Car -
	1) Component 1 -> Iron (MTO & Buy)

Now create a SO of product Car and confirm it.
It will create a MO (Car) and then PO (Iron).
Now if PO is cancelled, it will cancel its
move_dest_ids and on change of it MO will be
cancelled but delivery move will remain ongoing.

When action cancel is called on a move raw, it will
check if the production order is also cancelled.
If the MO is cancel, in this case cancel also its
move finished.

Task-2117832

closes odoo/odoo#42209

X-original-commit: 9522e51a3b290c91f23658a4fb781003ff1fd8d2
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-12-19 16:45:55 +00:00