Commit Graph
375 Commits
Author SHA1 Message Date
JF Aubert 13842ca9ae [IMP] mrp: Add multiple lots components warning to Mass Produce
Mass produce originally prohibited multiple lots components.
Later commit removed this limitation (among others).
This one displays a warning to make sure it is intentional.

task 2633369

closes odoo/odoo#77254

Related: odoo/enterprise#22797
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-12-22 17:55:49 +00:00
JF Aubert f11fcf6bb4 [REF] mrp: split productions
There is 2 major issues with the production of multiple serials number
- Performance issue
- Duplicated code with classic backorder mechanism

The performance issues exist since backorders were create one by one
and `stock.move` and `stock.move.line` are always recomputed. They
are not created in batch neither.

_generate_backorders is removed and replace by _split_productions. The
functionality are the same. Technicaly it does the maximum in batch,
first it creates all the `mrp.production` then all the `stock.move`
and finaly, it splits the existing `stock.move.line` among the new
`stock.move`
It means that the reservation is not recompute anymore during a
backorder process and will remain the same than the splitted production
order.

Performance metrics (10 components):

	|	2   |	10	100	 1000
before	|   0.47s   |  2.84s | 32.25s | 580.53s
-----------------------------------------------
after	|   0.13s   |  0.36s |  2.60s |  35.17s

task 2633369

Part-of: odoo/odoo#77254
2021-12-22 17:55:49 +00:00
William Henrotin 56e7bcf0cb [REF] *{stock,mrp}*: rename reserved fields
This commit rename product_uom_qty into reserved_uom_qty and product_qty
into reserved_qty on stock move line to stop mistake them with the stock
move quantities fields.

Task: 2648449
Part-of: odoo/odoo#80434
2021-12-07 16:20:06 +00:00
William Henrotin 6a23b9bcd6 [REF] *stock*: rename model stock.production.lot into stock.lot
Task: 2648449
Part-of: odoo/odoo#80434
2021-12-07 16:20:05 +00:00
yhu-odoo 8e599caf7a [FIX] mrp: trigger RR after change product qty
In 1e93c161ca454313436b65427542db961f6ddcdd we trigger RR when
confirming a MO. Same thing should be done if we changed the product qty
for a confirmed MO.

Task-2653116

closes odoo/odoo#79332

X-original-commit: 22eb5c38ff45f4e5cd5d2025d31960efa051ad6b
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-11-04 10:22:02 +00:00
Arnold Moyaux 174c3b7951 [IMP] mrp: Mass assignation of SN/Lot in MRP
Allow to produce several serial numbers at once.
Only when BoM do not contain any component tracked by unique serial number
and lot ones are from 1 lot.
Also allow to copy/paste serial numbers.
This applies to manufacturing orders.

Task: 2444742
Part-of: odoo/odoo#71732
2021-09-02 10:41:46 +00:00
brsy-odoo 281e1a57b3 [IMP] mrp: MO/WO UI Improvements
Improve the UI for the MO and the WO with some new features, better readability and usability

- The forecast for the MO in draft makes the preparation of a MO easier. The behavior of `forecast_availability` depend of the state of the move
- The sum of expected duration and real duration in the MO, make the MO visually clearer
- The field Scheduled Date is rounding up to the next hour for less manipulation
- The automatic reference in a BOM if there is already a BOM for this product allows making less manipulation. I'm using this variable `number_of_bom_of_this_product` with the result of the query inside so I didn't need to do the query twice and the query doesn't take the current bom.
- A rounded value is better for the OEE in WO summary
- Have a tag for a workcenter can be a good idea to add more information to it. I'm using a random value for the color of the tag, we are doing it frequently to have a random color on multiple think.
- Knowing the final product of a WO is clearer
- To notify the user when creating a product with a reference that are already existing is a good idea.
- Change some color in the MO view for better readability
- And more minor tweak (like to align some part in the view)

--- Links ---
The PR: https://github.com/odoo/odoo/pull/74540
The PR on enterprise: https://github.com/odoo/enterprise/pull/20006
Task related: 2442895

closes odoo/odoo#74540

Related: odoo/enterprise#20006
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-08-25 07:50:36 +00:00
Kevin Baptiste 86aa7b78aa [IMP] *: introduce data-hotkey on form and modal views
Define `data-hotkey` on most used action buttons.

For the modals, the following keys are dedicated for "special"
actions:
 - Alt+G: add
 - Alt+V: save
 - Alt+Z: cancel

closes odoo/odoo#73275

Taskid: 2588233
Related: odoo/enterprise#19464
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-07-15 08:39:49 +00:00
William Henrotin 10a07529b0 [FIX] mrp: change quantity wizard stop producing
Case :
  - production with workorder
  - 0 qty_producing
  - Change product quantity via the wizard
  - the qty_producing is set to the maximum

Task : 2278147
2020-08-10 09:40:24 +00:00
William Henrotin 963ad5eada [FIX] mrp: keep duration ratio
Updating the quantity to produce on a production order will recompute
the expected production duration. This can be counter productive on
prototyping production when no BoM are given. The default expected batch
duration is set to 60 minutes. Setting the actual production time then
updating the quantity to produce will naively change the duration to
60 x the new quantity.
This commit compute the duration pro rata in case of 'no BoM' production
and recompute everything in case of BoM production.

Task : 2278147
2020-08-10 09:40:24 +00:00
William Henrotin a6cd4d8c8c [IMP] mrp: immediate production
This commit introduce the immediate production mechanism. As it works on
stock.picking, marking a (some) production(s) as done without consuming
anything will pop a wizard allowing the user to transfer all the reserve
component quantities as done quantities.

Task : 2278147
2020-08-10 09:40:24 +00:00
William Henrotin 47e40e7f6a [FIX] mrp: usability fixes
- Default quantity on MO is 1.0
- Default quantity to consume on move is 1.0
- No open on the company_id from BoM form
- Optional=Hide for product, qty on BoM form
- Backorder button renamed to Validate
- Date deadline and origin to Miscellaneous tab
- Be able to remove stock_move when the MO is draft
- Some renaming in the menu and run scheduler under planning item

[FIX] mrp: fail to create stock.move after MO confirmation

Since the product_id on stock.move is readonly once it is set and the
MO is confirmed, it's not send to the server and the create crash
since product_id is NULL.

closes odoo/odoo#55270

Related: odoo/enterprise#12148
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-08-03 09:38:33 +00:00
yhu-odoo 0554ffb339 [FIX] mrp: Return to previous view and close MO
When launch a consumption warning wizard by clicking the "Mark as done
and close mo" button, always close the MO. And return to tree view if we
open the tablet view from a 'start' button, return to workorder kanban
if we open tablet from that.

Task 2278147

X-original-commit: 4d03cf5e8d29933d5f96099f8f662c9084b20197
2020-07-16 14:48:16 +00:00
William Henrotin ca2975383c [FIX] mrp: redirect to workorder list from consumption wizard
If the consumption wizard is triggered in a workorder (via 'Mark As Done
And Close MO'). We would like the confirm button redirect to the
workorder list view afterwards.

Task : 2278147

X-original-commit: 55e2a4d16d3a56b8f509d2d67a344c53d62474b6
2020-07-03 11:22:16 +00:00
Martin Trigaux 80e97e98ce [IMP] *: use named placeholders in translated message
When more than one parameter is present in a message, it helps the
translation to use named placeholder. This way, the order can be
changed. It also helps the comprehension of the message.
2020-06-18 13:03:34 +02: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
Arnold Moyaux ed7012e8fd [REF] mrp: workorders for enterprise
Removed abstract workorder

Removed the integration of expiry wizard in tablet view since it should
be moved in enterprise in the tablet view implementation (not possible
to set consumed lot on workorders on community anymore)

Refactor _set_quantity_done to use ORM command in order to not return a
dict with vals to_create/to_write

task-2241471
2020-06-15 16:59:41 +02:00
yhu-odoo 5311f01e65 [REF] mrp: update MO according to "To Comsume"
Previously, when we upate the "Quantity to Produce" on a MO, we update
the components to consume according to the BOM we use. After this
commit, we now update the components according their current number set
on the MO.

For example, if we have a MO to use x component A to produce y product
B. When we update the number y to z, the number of A we want to consume
will be updated from x to x / y * z, regardless of the setting on the
BOM. If multiple components are used, all components will be updated
according to this rule.

Task: 2241471
2020-06-15 16:59:41 +02:00
Rémy Voet (ryv) 5011ec520c [REF] mrp: review consumption allowing
Now, by default, a Bill of Material have a flexible
consumption instead of strict consumption. Also
add new consumption choice: a flexible consumption
but with a warning when the bom isn't respected.
Also, now, the strict (a new warning option) consumption
is checked only when we try to mark as done the MO.

task-2241471
2020-06-15 16:59:41 +02:00
William Henrotin 0e2765f5fd [REF] mrp: no more produce wizard
Use a view similar as the pickings one.

task-2241471
2020-06-15 16:59:41 +02:00
Rémy Voet (ryv) 53252608d7 [REF] mrp: backorder mechanism
Allow to "backorder" a production, meaning create another manufacturing
order with the quantity remaining to produce. We also use the
reservation of the first order on the next ones by using
`post_inventory` on the first one and moving the newly created stock
moves to the backorder.

We introduce a wizard similar to the one in stock.
Backorders have a sub-sequence.
Backorders are linked together through the procurement group.
We allow creating a backorder even if workorders are running by closing
them, the backorder will call `button_plan` and create its own.

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
Nicolas Martinelli 1b70a132d3 [FIX] mrp: wo state when changing qty
- Create a product P
- Create a BOM:
  Use 1 unit of C
  Routing with 2 Operations
  Start Next Operation: 'Once all products are processed'
- Create a MO for 10 units
- Process the first WO
- Scrap 2 components, produce 8 units in the first WO
- In the MO, change the quantity to produce to 8

The first WO is done, the second WO is still waiting for the previous
one to finish.

We change the state of the next WO.

opw-2244166

closes odoo/odoo#50690

X-original-commit: 8a723f0f104e64d336764431ea15eb3166cc52b7
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-05-05 15:35:48 +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
Pratima Gupta 55b8207b34 [FIX] mrp: set default company for stock production lot
Before this, unable to quick create production lot from
produce wizard in components, as default company was not
set correctly.

Fixes-2234784

closes odoo/odoo#49455

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-04-13 09:16:25 +00:00
Goffin Simon 2683b1f073 [FIX] mrp: Impossible to create a lot from MO
Steps to reproduce the bug:

- Let consider a user U from a single company C (Multi companies = False)
- Let's consider a BOM B for a finished product FP with product P1 as component and product P2 as byproduct
- Let's consider that P2 is tracked by lot
- Log as U and create a MO for FP
- Produce the MO

Bug:

A widard was opened but it was impossible to create a lot for P2

opw:2216028

closes odoo/odoo#48556

X-original-commit: 30ebdee091362b8c857bdcad2bdf44bd698572c4
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-03-30 07:07:09 +00:00
William Henrotin 0d73734325 [FIX] mrp: set new initial demand on byproduct
Commit a4c0994 uses variable `qty` as input parameter but override it
at each loop iteration. The original value of `qty` is lost after the
the first pass and so give wrong results for all next iterations.

This commit uses another name to never lose the given value.

closes odoo/odoo#46587

X-original-commit: e1c30bceba6d47d8e087e540f995a02086fa6283
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2020-02-28 14:51:10 +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
Kevin Baptiste 6cbe824871 [REV] web: reverts update to fontawesome 5.11.2
This reverts commit ff1c35513a.

closes odoo/odoo#41480

X-original-commit: 116057b26e71db4692280463669f3e80d813ddcc
Related: odoo/enterprise#7110
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-12-09 10:33:36 +00:00
Kevin Baptiste ff1c35513a [IMP] web: update to fontawesome 4.7.0 to 5.11.2
FontAwesome 5 introduced new names for some icons as described on
https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#name-changes

This commit replaces the old names to the new ones.

closes odoo/odoo#35826

Taskid: 2050241
Related: odoo/enterprise#5180
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-28 10:05:12 +00:00
William Henrotin e1f518bb83 [IMP] mrp: add components in workorders
This commit extend the flexible consumption. On the workorder form view.
It's now possible to add directly new workorder line with any product
(even one not in any BoM line). For those new wo line. A confirmed stock
move is create in the record_production step.

Task : 2082448
2019-11-22 12:39:51 +00:00
William Henrotin 644663eb4a [FIX] mrp: rework of workorder planning
This commit redo the way workorders are planned on their workcenter
calendar. The resource_calendar_leaves introduced in 0679d0d is now linked
to the effetives dates (date_start and date_finished).
The planned dates copy their information onto effective date at the
workorder plannification or any modification before the actual production
(state = draft, pending or ready)

This way, the gantt view and calendar view display either the plannifaction
slot if the production isn't started yet and the effective production
time if it's done. The plannification is also impacted by validating
a production sooner than expected or cancelling it. In the first case,
the date_finished is set at 'now' and in the second case, all the dates
are emptied. The futur workorders will be planned on the newly recover
time slot.

This commit also fix the button_start() method that always rewrite the
date_start even if the production had already been started.

Task : 2082442

closes odoo/odoo#34038

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-10-16 07:34:15 +00:00
William Henrotin e8a3fb9a0b [IMP] mrp: block usage of duplicate serial number
With this commit, the manufacturer will now be noticed earlier in
the process if he produced/consumed a serial number already produced/consumed in a
previous production. Before this commit, an error was triggered as
well but only at the very last step of the production.
This leaded to two issues :
 - The user had to unlock-edit-lock to update the wrong serial number
 - On large production, it was difficult to figure out which was/were
   the product(s) to fix.

The search on previous production is done each time the produce wizard is closed
or once the production is done on a workorder

Task 2002133
2019-10-16 07:34:15 +00:00
William Henrotin bb017e64d4 [FIX] mrp: add new line by the bottom in produce wizard
Any new line (components or by products) in the produce wizard
will be now added from the bottom of the One2many widget.

closes odoo/odoo#37514

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-09-27 13:03:05 +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 916b49381b [REF] mrp: produce wizard mobile friendly 2019-09-09 15:17:03 +00:00
Simon Lejeune 96406dc2a9 [REF] mrp: multi company
Ensure proper domains are applied and enforced on relation fields thanks
to the `check_company` attributes.

Make sure unbuild have proper sequence for each companies.

The produce wizard and workorders company is the one of the production.
The BoM line company_id is the one of its bom_id.
Added some tests.

task-1985992
2019-09-03 15:05:03 +00:00
Raphael Collet 8918bbbb5e [IMP] fields: do not trigger recomputations on transient models from regular models
This is a performance optimization: modifying a regular record will not
trigger some recomputation on a transient record.  Most transient
records are simply waiting to be garbage-collected, so there is no need
to keep their fields up-to-date.

closes odoo/odoo#35909

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-08-22 10:05:52 +00:00
Arnold Moyaux a3aeabd44d [FIX] mrp: do not base default on active_id
Since active_id do not works allows to use a context
key that will not be modified magically.
2019-08-19 15:03:59 +00:00
Arnold Moyaux 44507c039e [FIX] mrp: change production quantity is wrong on finished moves
Usecase to reproduce:
- BoM -> 1 component for 1 final product
- Create a MO with a quanity of 5
- Update the quantity to 6

-> The move finished has an initial demand of 4
2019-08-19 14:14:13 +00:00
Christophe Simonis 140ee6b8f0 [MERGE] forward port branch saas-12.4 up to 98a55917a6 2019-08-14 16:48:10 +02:00
Hetashree Chauhan cdc8bf4bb1 [IMP] mrp, maintenance: back to basics
Modify tree view for MRP Production
Modify form view and tree view for Unbuild orders
Add group by for Bill of Materials
By default show line shart when opening MRP Production report
Modify view for Work Orders
Modify view for Work Centers
Modify view for Routings
Modify view for Maintenance Request
Modify view for Bill of Materials

task-2042304
closes - https://github.com/odoo/odoo/pull/35482
2019-08-14 12:13:27 +00:00
Christophe Simonis b792ba7d9a [MERGE] forward port branch saas-12.3 up to 752b2553c6 2019-08-08 11:52:13 +02:00
Christophe Simonis 7d04dc1c7c [MERGE] forward port branch saas-12.2 up to 9e74730a26 2019-08-06 18:48:24 +02:00
Christophe Simonis 0fadd586fa [MERGE] forward port branch 12.0 up to ff9ddfdacc 2019-08-06 15:57:57 +02:00
Martin Trigaux beba36416f [MERGE] Forward port of saas-12.3 to saas-12.4 up to 40421be73c 2019-07-16 16:36:40 +02:00
Martin Trigaux 40421be73c [MERGE] Forward port of saas-12.2 to saas-12.3 up to cf8e74a1a7
closes odoo/odoo#34907

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-16 11:44:38 +00:00
Martin Trigaux cf8e74a1a7 [MERGE] Forward port of 12.0 to saas-12.2 up to 1bd434da34
closes odoo/odoo#34901

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-16 09:14:17 +00:00
Arnold Moyaux ccbd6712f6 [FIX] mrp: MO change the quantity to 0
Usecase to reproduce:
- Create a MO for 5 final units
- Reserve all the components
- Produce 3 units
- Post Inventory (debug mode)
- Edit/Unlock
- Edit a line to consume to an arbitrary amount of quantity
- Change the product qty and set it to 3.

At this point, the reserved quantity and the quantity to consume
still the same than intialy even if the final quantity was updated.

- Mark as done

Then a move is marked as done withtout quantity done and still have
reserved quantity.

It happens because the _update_raw_move function do nothing if the
new quantity to consume is equals to 0.

The arguments returns in _update_raw_move still exists for override
but are not used by the chang_prod_qty method. It's not possible to
cancel the move and then find its parents in order to log the activity.

opw-2023653

closes odoo/odoo#34471

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-07-15 11:52:47 +00:00
Nans Lefebvre f97b766013 [FIX] mrp: update MO quantity when there are more than one move per line
The production.move_raw_ids usually contains only one move per bom_line_id;
it might not always be the case, as ccbd6712f6 used move[0] to get a singleton.
The following calls to _get_document_iterate_key, _log_activity_get_documents,
also require move to be a singleton, so we use replace move by move[0].

opw 2042099

closes odoo/odoo#35206

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-07-26 08:28:17 +00:00