Commit Graph
716 Commits
Author SHA1 Message Date
Simon Lejeune deeb17cef0 [REF] mrp: improve error message in run_manufacture 2019-09-18 07:14:53 +00:00
svs-odoo 5d75d07bad [FIX] mrp: product quantities by company
Before this commit, the product/product template computed mrp quantity
fields wasn't computed by active company but for all companies.
So, set `compute_sudo` on false for the different computed mrp quantity
fields of products and product templates to avoid to search with sudo
active and to search by company.
2019-09-13 12:25:25 +00:00
Christophe Simonis 5a273e74f0 [MERGE] forward port branch saas-12.4 up to fe59754c52
closes odoo/odoo#36721

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-13 13:32:51 +00:00
Christophe Simonis 51354fadb0 [MERGE] forward port branch saas-12.3 up to 50e571acf7
closes odoo/odoo#36491

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-11 09:39:33 +00:00
Christophe Simonis 9bf0b04adb [MERGE] forward port branch 12.0 up to 82a8cdd6f2 2019-09-06 17:52:48 +02:00
Goffin Simon b4a1b87fb6 [FIX] mrp: domain on field final_lot_id in mrp.production.work.order.form
Steps to reproduce the bug:

Let's consider two storable products P1 and P2 where P1 is tracked by serial number
- Create a BOM B  for P1 where P2 is a component
- Create a serial numberv SN for P1 with no quantity
- Create a MO M1 for P1 and click on button "Produce"
- In the view MRP Product Produce, SN is selectable in the field lot_id
- Now change B and set a routing on it
- Create a new MO M2 for P1 and click on produce
- At least one WO has been created, click on the first one

Bug:

- SN is not selectable in the field final_lot_id

The domain set on the field final_lot_id:

"['|', '&', ('product_id', '=', product_id), ('product_id.tracking', '!=', 'serial'), ('use_next_on_work_order_id', '=', id)]"

didn't allow to chose SN.

With this fix, it's now possible to chose SN on the first WO created for M2

opw:2059745

closes odoo/odoo#36425

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-09-05 09:35:39 +00:00
Nicolas Martinelli a3f2c82789 [FIX] stock, mrp: merge SFP for 2 different MO
The condition needs to be fined-tuned, so revert for now.

This reverts commit 40487aca5c.

closes odoo/odoo#36470

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-09-05 12:29:43 +00:00
Christophe Simonis 7a548569c6 [MERGE] forward port branch 12.0 up to 638eac9bae 2019-09-04 19:32:26 +02:00
Christophe Simonis 4528f75cb0 [MERGE] forward port branch 12.0 up to 82c0e9b620 2019-09-03 12:41:08 +02:00
Goffin Simon a9bb669487 [FIX] mrp: Kit in manufacturing
Steps to reproduce the bug:

- Create a MO with a product with a normal bom B
- Save the MO
- Change the type of B to phantom
- Try to produce the MO

Bug:

It was impossible to cancel or confirm the MO.
It's not allowed to produce a MO with phantom bom.

opw:2061958

closes odoo/odoo#36329

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-09-03 07:38:18 +00:00
Arnold Moyaux 5f7648bb9a [FIX] mrp: failing test multi mrp step
It's due to MRP refactoring that confirm raw moves before finished
moves. It implies that in _assign picking, SFP with final product
will search a picking but the stock.move do not have a created_production_id
and it will be merged inside the intermediate SFP (it works before
because it was the intermediate SFP that was merged in the finished SFP).

_key_assign_picking is also added if multiple moves are confirmed w/
and w/h created_production_id, we won't merge them in the same picking.

closes odoo/odoo#36335

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-02 13:00:00 +00:00
Christophe Simonis 545e6d2034 [MERGE] forward port branch 12.0 up to 52f6e38cea 2019-08-30 17:20:28 +02:00
Nans Lefebvre 75460e697a [FIX] mrp: block partial post inventory of MO with workorders and tracking
Enable work orders, routings, and track components by lot numbers or serial.
Create an MO for a certain X quantity of finished products and plan work orders.
Only complete a partial amount Y of the overall X amount.
Specify the lots for the consumed tracked materials equal to the Y amount.
Then, return to the MO and click "Post Inventory".
An error is raised because the lot is missing.
This is because when processing workorders temporary lines
are created without lot/serial for tracked component products.

This is a limitation that require a task to be removed;
in the meantime we remove the button, in true bugfix fashion.

opw 2049806

closes odoo/odoo#35731

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-08-26 07:24:28 +00:00
Arnold MoyauxandAndrea Grazioso 40487aca5c [FIX] stock, mrp: merge SFP for 2 different MO
usecase to reproduce:
- Set the warehouse with manufacturing 3 steps
- Create a BoM with a Components that use a Sub BoM
- Set Both product MTO + Manufacture
- Create a MO

You have only 2 picking for the first MO with the SFP
that contains both the finished product and the intermediate
component. However they are created and moved at two different times
since you could not create the finished product withtout the
component, so there is no meaning to put them both in the same picking.

It happens because the _assign_picking will merge moves with the same
procurement group. In our case, it's the wanted behavior to have the
2 differents SFP linked to the same MO. So the solution would be to
add a condition to _assign_picking and don't merge moves if they come
from different MO, at this point the field created_production_id would
fit. However this solution is not robust if a customer creates a
new rule that add a 4th steps to the production process.

opw-2055688

closes odoo/odoo#35915

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>


Co-authored-by: Andrea Grazioso (agr-odoo) <agr@odoo.com>
2019-08-27 11:32:54 +00:00
Simon Lejeune ea92e0b333 [REM] mrp_subcontracting
There was a first version of mrp_subcontracting at rev [1] and now
there's a second verion at rev [2]. As the second version sensibly
changed the flows and models AND we don't have the time to backport the
changes AND saas-12.3 will be released on the saas, we chose to remove
the module in saas-12.3 to not have to support both version once v13 is
released.

[1] d91db5bde6
[2] 9b6a5398df

closes odoo/odoo#35898

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-08-21 08:49:41 +00:00
Christophe Simonis f26de445e5 [MERGE] forward port branch saas-12.3 up to 6f55fd65da 2019-08-20 12:17:04 +02:00
Christophe Simonis 168e54d488 [MERGE] forward port branch 12.0 up to 32039b2ab4 2019-08-19 18:57:08 +02:00
Christophe Simonis b792ba7d9a [MERGE] forward port branch saas-12.3 up to 752b2553c6 2019-08-08 11:52:13 +02:00
Arnold Moyaux 13d6f64a73 [FIX] mrp: same method name
Conflict between:
commit ed64250503
commit 16e7a4b4c7
2019-09-03 15:05:04 +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
jbm-odoo cf7c9bd9b7 [FIX] mrp: Avoid creating new line when changing qty to produce
When we change quantity to produce in mrp, all component lines are
removed and new line with the updated amount to product are created.
The problem appears when we change the quantity to produce and directly
click on a component line, because we open the line that will be
deleted. So if we change the quantity for this component manually,
this suppressed line will be added with the new value. And the computed
line will be also be added. So the line for one component will be
present twice (one with computed value and one with manual entry value).

To avoid this problem, when we change the quantity to produce, we update
information of each line (instead of deleting and creating new one).
So if we click on a component line just after changing the quantity,
we open the updated line (and not de deleted one).
2019-08-28 13:51:40 +00:00
Jigar Patel ed64250503 [FIX] mrp: update expected duration when finished planned date is change
task-1939533

closes odoo/odoo#35016

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-08-28 08:30:42 +00:00
Jigar Patel 90df41f0da [IMP] mrp: improve the usability of workorder Gantt view
- display WO in red which has a late planned start date.
- hide the WO which are in done or cancel state.
- show progress of WO.

task-1939533
2019-08-28 08:30:42 +00:00
Sébastien Theys 22a11a6f4d [REF] product, *: save product.template.attribute.value on variants
* account, hr_expense, mrp, sale, sale_product_configurator, stock_account,
  website_sale, website_sale_comparison

Before this commit, the `product.attribute.value` were stored on the variants.
This required filtering of attribute lines to find the appropriate matching
`product.template.attribute.value` that were used in most of the business code,
such as when computing the `price_extra`.

This also prevented to have multiple attribute lines for the same attribute,
which is needed to handle use cases such as grape varieties for wine products.
This will be done in the following commit.

After this commit, the combination of `product.template.attribute.value` will be
directly stored on the product variant.

Other changes
=============

Add `combination_indices` on product, which allows to quickly find a variant
matching a combination (1 simple indexed equality query as opposed to 1 query
with as many joins as there are attribute lines), and to add an easy
SQL constraint to ensure active combination uniqueness.

Add active field on `product.template.attribute.line` and
`product.template.attribute.value`, with the same behavior as variants:

They become archived if they can't be unlinked. This allows to keep the database
consistent, such as archived variants correctly keeping all their values, sales
order lines keeping their custom and no_variant. This is done with the help of
`ondelete=restrict` on the corresponding m2m fields, and the `unlink` methods
falling back to archiving when `unlink` is restricted.

Part of task-1912579

PR: #32946
2019-08-26 13:01:13 +00:00
William Henrotin 2137e45bb5 [IMP] stock, mrp: do not compute quantities on service product
This commit avoid searching into quants and stock.moves, the quantities
(available, forecasted, ...), for service product in order to speedup the search
on big recordset

closes odoo/odoo#35920

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-08-21 12:22:53 +00:00
William Henrotin 60f2262df7 [IMP] mrp: compute quantities speedup
The computation of kit quantities was not efficient. A loop on each product
of the recordset to consider performed. Each time a product was seen as 'not a kit',
a new computation on the complete recordset was done. This leads to a N^2 complexity

This commit only compute stock quantities for non kit product in one batch
2019-08-21 12:16:27 +00: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
Hetal Dhanak 9412695d08 [FIX] mrp: cast datetime from web interface
Updating a datetime field in a form view will fill the 'values' dict
with a string.
This commit casts the dates in mrp.production and mrp.workorder that are given to
their respective stock move into actual datetime object. This prevent any
converting error later in the process

Task : 2055912

closes odoo/odoo#35825

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-08-21 13:45:23 +00:00
svs-odoo 9ff7758c79 [FIX] mrp: can't open workorders from mrp overview
How to reproduce:
- Install mrp & mrp_workorder;
- Open Manufacturing and plan a workorder;
- Go on the Work Centers Overview;
- Click on "WORK ORDERS" button -> You got a "Something went wrong !".

closes odoo/odoo#35900

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-08-21 11:17:09 +00:00
Christophe Simonis 3faea8fbf8 [MERGE] forward port branch saas-12.4 up to f26de445e5 2019-08-21 10:10:11 +02:00
Raphael Collet 9920f20e4c [IMP] models: ORM speedup
This branch is the combination of several optimizations in the ORM:

* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;

* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;

* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);

* make method `modified` take advantage of inverse fields to inverse
dependencies;

* filter records by evaluating a domain on records in Python;

* a computed field with `readonly=False` behaves like a normal field
with an onchange method;

* computed fields are computed in superuser mode by default.

Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.

closes odoo/odoo#35659

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-20 12:43:59 +00:00
Arnold Moyaux 4d5ec8ff12 [IMP] stock, mrp: remove MTO route magical behavior
When a move is created from a location A to a location B and not
via a rule but it wants to apply the rule logic in order to know
if a move is MTS or MTO then _adjust_procure_method is called.

It will check if a rule between A and B for the selected product/
category/warehouse and if it exists it will apply the rule procure
method to the move. If not it will check if the route MTO is ticked,
and will set the move as MTO even if no rule exist. It could be
miss understanding by the user that have moves MTO without matching
rule. It would be easier to have a single proccess with rule.
2019-08-19 15:03:59 +00:00
lbs-odoo 9a0fedfc65 [IMP] various: improve searchviews UX
Improve searchviews UX in all the modules

TaskID: 2029731

closes odoo/odoo#35700

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-08-16 13:35:21 +00:00
Arnaud Baes 062ad598bf [IMP] stock: default sequence for picking types 2019-08-14 12:27:04 +00:00
Arnaud Baes fcce6a2f82 [REF] stock, mrp: codes on picking type 2019-08-14 12:27:04 +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
William Henrotin 275dcfa412 [FIX] mrp: successively plan/unplan the same mo
Introduces by #0679d0d54269ffe0664845e8e0bd1238110fd514 when you plan a
workorder, the corresponding workcenter will reserve a leave to avoid to
plan an another workorder in the same time slot.
But before this commit, when you unplan your workorder, the leave wasn't
unlinked, so the time slot stay reserved.
Now when a workorder is unlinked, its leave is too.

closes odoo/odoo#35003

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-08-14 08:44:52 +00:00
svs-odooandWhenrow 2a2c27fa45 [IMP] mrp, sale_mrp: planned date on MO
The purpose of this commit is to simplify the `mrp.production` model in
reducing the number of date field.

The following fields was kept:
    - `date_planned_start`: the planned date for the beginning of the MO
    - `date_planned_finished`: the planned date for the ending of the MO
    - `date_start_wo`: the preferred date to start a Work Order in case
      the MO will plan one.
    - `date_deadline`: is only indicative and is automatically set when
      the manufacturing order is needed for a sale order.
    - `date_start` and `date_finished`: no changes.

Task #1935229

Co-authored-by: Whenrow <whe@odoo.com>
2019-08-14 08:44:52 +00:00
svs-odoo 629e8da14f [REF] mrp: remove duplication in mrp product
The method `action_view_mos` was written two times just for a difference
in the action's context.
2019-08-14 08:44:52 +00:00
William Henrotin fff2a30afb [IMP] sale_stock,sale_mrp: available quantities on sales order
Selling a product you don't have in stock anymore triggers a message
without pertinent information about available quantity.

This commit adds a little widget on sale order line to inform the salesman
there are not enough quantity available. Clicking on it will reveal:
* The estimated delivery date
* The actual quantity on hand
* The quantity forcasted at the estimated delivery date

For kit product, the quantities are the maximum occurence of kit available
regarding components quantities.

Task 2003485

closes odoo/odoo#34336

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-08-13 07:54:38 +00:00
William Henrotin bbd8d31cdd [IMP] stock: introducing free quantity on products
The stock module adds 4 quantities on products:
  Quantity on hand
  Incoming quantity
  Outgoing quantity
  and Forecast Quantity

Forecast Quantity is equals to Quantity on hand + Incoming quantity -
Outgoing quantity. Those two last ones are computed from the open stock
moves wainting to be validated but the reservation is not taken into account.
This commit introduces a fifth quantity 'free_qty' that acts like the forecast
one but only with reserved quantities.
2019-08-13 07:54:38 +00:00
mreficent 355a5dfc36 [IMP] *: fix typos in comments
closes odoo/odoo#35404

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-07 10:28:33 +00:00
Christophe Simonis 886eca0131 [IMP] *: remove usage of oldname attribute
This attribute is misleading as it is insufficient to correctly upgrade
the database. It only renames the column in the database, but other
operations are needed, like updating the corresponding `ir.model.fields`
record (and its xmlid). The default values and the translations are also
lost during the upgrade.

Moreover, this feature was misused. It was:
 - left on fields during multiple versions.
 - used on reports (SQL views). This would be ok if the feature was
   complete, but, as is, it was useless.
 - kept unchanged after a second renaming of the field (which can happen
   versions later the first rename).
 - used, even when the meaning of the field changed. i.e. the field
   `archived` has been renamed to the classic `active`, but the value
   in the database should be switched.
2019-08-05 09:36:41 +00:00
Simon Lejeune 0033659ff4 [FIX] mrp: workorder grouped by date
Read_group only work on stored field. We still can't make these fields
stored related because of what's explained on the comment: the write
aren't  batched and a constraint is raised. See rev 0679d0d542

task-2036914

closes odoo/odoo#35268

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-08-05 18:25:38 +00:00
Nicolas Vannieuwerburgh 81c2d343b5 [FIX] mrp: mrp_production.delivery_count more robust
when no group_id on mrp_production, set the delivery_count to 0

closes odoo/odoo#35372

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-08-01 09:48:10 +00:00
Goffin Simon 1aaf1da72c [FIX] mrp: Impossible to close MO
In some cases, when changing in the inventory setting from tracking lots and
serial numbers to not tracking, an issue could occur when trying to close the
MO with processed work orders and lots.

opw:2040752

closes odoo/odoo#35250

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-07-29 09:04:11 +00: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