This commit bring together sanity check functions called during
production order validation in a separated method. Other modules will
override it to add other sanity checks.
Task : 2278147
X-original-commit: e11f8da6674e9a21ab61d0aa67ef1797752273e2
Duplicate a BoM with operations and some BoM line consume in specific
operation. The operations are well duplicated but the 'consume in
operation' field still point to the original BoM's operations.
This commit search for the operation to replace based on the name and
the workcenter_id.
Task : 2278147
X-original-commit: 4c6d445dfd561a236b1b171ccbcc2ff2b6236640
Consuming all the components for only a part of the finished product
will ask the manufacturing user to create a backorder. Confirm it will
fail as there are no component left to consume to produce the
remaining quantity of finished product. This commit only confirm
backorders that still have some quantities to consume.
Task : 2278147
X-original-commit: 51c9281d715e27143955c7b9b51f60b22e672f52
This commit extends the delivery slip so that products added as a kit
component to a stock.picking are grouped together by kit (or non-kit)
when at least 1 kit exists. Kit grouping occurs for products from a kit
without a package assigned. Non-kit section appears only when no
packages are assigned.
Implementation notes:
- Sub-kits (i.e. kits within kits) of kits are purposely not included
- Duplicate product names with different BOMs will be merged into one
since there is no straightforward way to distinguish them within
current db structure
- There are some cases where this doesn't work as expected and may lead
to components being grouped together under the same kit even if they
are from different kits (e.g. kit1 has bolts and so does kit2 => on
slip bolts will only show under kit1 section). Two cases where this
happens is when kits are added before 'Operation Type' is specified
and 'Operation Type = Manufacturing'
This completes subsection 1 of overall Improve delivery slip task.
Task: 2039720
- Create a product P with 2 variants A & B (e.g. 2 colors)
- Create the following BOM
Component 1
Component 2a, applies to variant A
Component 2b, applies to variant B
- Create a MO
- Set the product to variant A
=> 2 components are added: 1 and 2a
- Change the product to variant B
The component 2b is added but 2a is not removed.
The issue is coming from the result of the onchange, when comparing the
2 snapshots. The result contains the following commands:
- [(5,)]: clear the lines
- [(1, ...): ]: update component 1
- [(4, ...)]: keep component 2a
- [(0, ...)]: add component 2b
In case we are changing the product, we clear the lines.
opw-2270990
closesodoo/odoo#53689
X-original-commit: 89d9e759ae0cc31ad1fc398d41fa7a638056309e
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
- Create 3 products A, B1, B2
- Create a BOM for A:
Manufacture, 1 unit of B1
- Create another BOM or A:
Kit, 1 unit of B2
- Create a MO for A
- Click on 'Produce'
B2 appears as a 'By-product'. Upon saving, an error occurs because of a
rounding set to zero.
The issues is coming from the generation of the `move_finished_ids`.
Since the product A has a BOM kit, the latter is exploded and added as
'By-product'.
We should not try to find phantom BOM for this specific use case. A
solution is to not explote the move produced.
opw-2251423
closesodoo/odoo#53526
X-original-commit: 226ccc2f64d00a19e0ae8851c45051106aa49adc
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
- Create 3 products:
A: kg, no tracking
B: kg, tracked by lot
AB: kg, no tracking
- Create a BOM for AB:
1 kg of A
30 g of B
- Create a MO for 1 kg of AB, validate and close the MO
- Unbuild the MO
A stock move for 0.03 g of B is created instead of 30 g.
This happens because we wrongly compare the quantity in the UoM of the
stock move with a normalied quantity.
opw-2278727
closesodoo/odoo#53390
X-original-commit: 6790e89f97d6bbbaab4e071af52cce9ccee98821
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Support two new syntaxes with `_()` method:
_("This is so %s") % 2019
_("Text with %s placeholders", 42)
_("Text with %(num)s placeholders %(symbol)s", num=42, symbol="🧀")
The main benefit is to have a fallback on the source string if formating the
translated string fails (e.g. "Foo %s" translated "Foo s%").
This PR converted most (but not all) calls to _ using placeholders to use the
new syntax. Hopefully, the remaining ones will be converted in the future and
avoid technical debt.
Use named placeholders when needed. If more than one placeholder is present in a
string, using named placeholder can be beneficial to reorder the placehodler
position (for languages like Japanese that do not use the same phrase
construction). On some sentences, it also brings clarity on the meaning of the
placeholders.
closesodoo/odoo#52155
Task-id: 1853119
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
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.
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))
Old syntax is still compatible but starts the migration to the new
syntax that catches error.
This commit makes it so products can be replenished without any other
module. This is achieved by adding a "pull" rule to the default receipt
route generated when a warehouse is created. "Pull" rule is added to 1-,
2-, and 3-step receipt routes. Previous to this commit, an additional
module (e.g. purchase, mrp, etc.) was needed for a pull rule to trigger
with the existing receipt route rules. Replenishments can be triggered
via "Replenish" button in product form, recording rules (auto trigger),
and replenishment (manual trigger).
Additionally, this commit makes it so when other modules (mrp, purchase)
that handle replenishment are installed, this additional "pull" rule is
removed from the default receipt route to prevent undesired behavior
(e.g. MTO manufacturing components magically being received from no
where). Unfortunately this means 2 undesirable situations:
1. If a user adds adds/changes rules to the receipt route and then installs
mrp or purchase then their additions/changes will be removed.
2. If a user removes either (when only 1 installed) or both of these
modules then stock module will again not be able to replenish as the
pull rule will not be re-added to the receipt route.
It is expected that these 2 cases do not need to be handled in most
cases or can be handled by advanced users.
Stock tests have also been updated to accomodate this new pull rule.
Specification 4 of overall inventory onboarding improvement task.
Task: 2220129
Related Enterprise PR: odoo/enterprise#10719
Usecase to reproduce:
- Create 2 table(MTO)
- Produce 1 and use BO button
Traceback due to a reference to enterprise field.
closesodoo/odoo#53077
X-original-commit: 2fffc12f8e3cdccba4b1c9820f997f4b10dac330
Related: odoo/enterprise#11191
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
- Create flexible BOM for product P
- Create a MO for 5 units
- Produce 3 units
- Post the inventory
- Cancel the MO
The MO remains 'In Progress'.
In case of a flexible BOM, the quantity produced is compared to the
quantity to produce to know whether the MO should be done. In this
specific case, however, the MO should be closed.
It's not possible to rely on the move states in this case, so we
force the MO state.
opw-2270279
closesodoo/odoo#53010
X-original-commit: c99fe9dc5b5054d8d92b7283ad9f27f150de410b
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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
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
- The Scheduled Date can't be change if the MO have some planned WO.
(WO defines the scheduled date of the MO)
- Now the Scheduled Date 'date_planned_start' is set by default
with the deadline date if there is or now if there isn't (same than before).
- For MO, 'plan_date_finished' is now invisible. But keep the field
because it is used to set the date_expected of finished moves.
- Change the plan behaviour: Plan depending of the scheduled date if
this one is bigger than now, else try to plan as soon as possible.
task-2241471
Instead using production name + name of WO as name in the
leave record, use the display name of WO to reprensent uniquely
the leave (even this record is not really reprensent in views).
task-2241471
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
This commit updates 4 features related to a MO being locked/unlocked.
1. Manufacturing orders are by default unlocked. A new configuration
setting has been added so users can set the default to be locked.
This setting only applies to new manufacturing orders after the setting
has been changed.
2. A MO now shows the same button options regardless if it is
locked/unlocked ('scrap', 'cancel', 'unreserve')
3. Workers can always change "Consumed Quantities"/"Produced" when
clicking on a component/finished product line unless state=Done and MO
is_locked. This includes adding new components/finished products.
4. Workers can now change "To Consume" quantity when clicking on a
component line, unlocked, and not in states 'Done' or 'Cancel'.
This is part of specification 6-Lock/Unlock of overall Editing in MO
form and backorders task.
Task: 2241471
Currently the related on the property use the company in the context and
not on the current object. It implies that a raw move created on the MO
form view will have the wrong destination location and trigger the
check company error.
Use a compute instead of related.
task-2241471
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
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
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
Cause
When kit BOM line quantity is equal to zero in a sale order, it raise error
because trying to divide bom_line_data['qty'] / bom_line_data['original_qty']
when computing kit quantities.
Solution
As BoMs allow components with 0 qty, a.k.a. optionnal components,
we simply skip those to avoid a division by zero.
Cherry-pick of #38890
opw-2262540
closesodoo/odoo#52362
X-original-commit: ab780a9d65e43f58a5745a5b92a25fb234827eb7
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
The field note of mrp.routing.workcenter was not very usefull, and not
appear in the workorder related to this operation. Sometime, we need to
have a small description of the work to do for a opeartion in the WO,
instead of a complet pdf or google slide.
-> Convert the note field as a description of the job to do and add a
"text" worksheet_type to select it, in the mrp.routing.workcenter and
add the related field in the WO. Update the view of accordingly.
-> (migration): The 'note' content remain the same, then migration is
not needed. If the user change the worksheet_type into text, the
"note" will be the previous "description".
task-2196687
With a database that contains a lot of production with kits or
BoM with a lot of bom.line. The database could become slow.
Index on stock.move <-> mrp.production could improve it.
closesodoo/odoo#51870
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
- Create 2 companies C1 & C2
- Creae a product P
- In C1, set the routes as MTO + Buy, add a supplier
- In C2, add a BOM in kit for P
- Go back to C1 with C2 as an allowed company
- Create a SO for 1 unit of P, confirm
The PO for P is not created.
It occurs because the BOM of C2 is retrieved when running the
procurement, while it shouldn't be.
opw-2260945
closesodoo/odoo#51779
X-original-commit: 96b0dcf9e51f5a924e2cbf618c2ee5462cc1f03f
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id
Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
We need a hook to be able to personalize the procurement values
which will be used on procurement group creation when creating MO
closesodoo/odoo#51016
X-original-commit: 9a100e99ad401e5ca6bf45bf8371388c47ec7849
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
1. Install MRP
2. Launch an Odoo shell on the database
3. Type the command
`print(env["mrp.bom.line"].browse(1).child_line_ids)`
Traceback will occur with exception
odoo.exceptions.CacheMiss: ('mrp.bom.line(1,).child_line_ids', None)
This occur due to the empty value that the computation of the field
yields, which is not saved in cache.
Fix by adding a default value.
opw-2226951
closesodoo/odoo#50950
X-original-commit: fc885499a3c75d8d564569ec4cea41a8a64f3164
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
- Create products P1 & P2
- Create a BOM for P1
Operation O1
- Create a BOM for P2
Use 1 unit of P1
Operation O2
- Open the 'Structure & Cost' report for P2
The BOM of P1 is not taken into account in the report.
This happens because a 'Sub BoM' must have the same Operation than the
parent (or no operation set).
There is no real functional reason for this, so we remove the
limitation.
opw-2246370
closesodoo/odoo#50743
X-original-commit: 5d3e88aa919a69ad54076637e72b880552e2a0be
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
- Create a product P
- Create a BOM for P
Use 1 unit of C
Produce 1 unit of byproduct B
- Create a putaway strategy for C
From: Stock
To: Shelf 1
- Create a MO for P, perform until the end
The product C is sent to Stock instead of Shelf 1.
When the stock move line is created, the putaway strategy is simply not
applied.
opw-2242987
closesodoo/odoo#50687
X-original-commit: 49ffdfb6ecbdf11ee1dc85ef494df515f249466e
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Set the padding on the write for date. Modify the text to be consistent
with the manual and automatic orderpoint. Explains the min, max
and quantity to order mechanism.
closesodoo/odoo#48536
Task: 2161378
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Allow to set a BoM or a vendor on an orderpoint. In this case it's
passed to the values and will be processed by _run_buy and
_run_manufacture to use them.
Task: 2161378
Set a default route on orderpoint created by the replenishment report.
First it select the first route on the product if it exists (it's
uselss since it's a preferred route on the report but it's used for
clarity). If the product has no route then it tries to guess it
with vendor pricelist or BoM on the product.
Task: 2161378
New report to easily order missing products in each warehouse.
Orderpoint have a new type: 'manual'. Manual orderpoint are not
trigger by the scheduler but the user could create replenishment
from the report directly. The report use the forecast report in
order to detect missing quantity for today (it does not search
depending the lead time for each product warehouse due to lake
of performance). It compares missing quantity with incoming RFQ
and other ongoing orderpoint. If it still missing a new entry
for replenihsment is created (it's also automaticaly deleted if
the replenihsment has been done another way).
Task: 2161378
- Create a product P using one component C
- The BOM is flexible
- Create a MO for 10 units
- Product 9 units, but use all components
- Post the inventory
The MO is considered as done, while it should remain in progress.
This happens because the MO state is computed based on the move raw
state. In this case, it should compare the quantity produced and the
quantity to produce.
The material availability is set to `False`.
opw-2220855
closesodoo/odoo#49247closesodoo/odoo#49526
X-original-commit: dd7ef482a1c41f271b133fbfcc3d389d16677da1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
When unbuilding a manufacturing order, there are fields in the default
unbuild form that do not make sense to show (i.e. they already
correspond to the manufacturing order that is triggering the unbuild).
Therefore we make a simplified version of this form that is better
suited for a button generated window.
This change includes removing the resetting of 'location_id' and
'location_dest_id' when they correspond to the 'company_id' by onchange
function since this would overwrite any 'default_location_id' and
'location_dest_id' values when calling the view + this seemed like it
would be annoying if someone clicks on the same 'company_id' within the
dropdown and their location values changed.
closesodoo/odoo#49514
Task: 2234872
X-original-commit: d23341a5b4cb82f4a96b55464dec32dc28ce4351
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Before this commit, check availability button was becoming
hidden, even if move is partially available on MO.
Fixed it.
Fixes-2234494
closesodoo/odoo#49381
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Followup of
https://github.com/odoo/odoo/commit/58df6c86e06304b2c5f020e0fb93988e9e388fe0.
By default, the create, when not specified as `api.model`, supports
creation in batch (thus the batching opportunity isn't lost here).
BUT, if a create override isn't specified as `api.model` or
`api.model_create_multi`, it won't be accessible in rpc calls (because
the ORM thinks a record in self is needed).
It doesn't look like somebody can create stock move lines from the web
client itself, but it doesn't cost anything to follow the global api
(and it's clearer to clearly specify the create as create_multi).
closesodoo/odoo#48964
X-original-commit: a4fd8f8062046bcea97d9f7cfe300e19020cdecd
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
For the `mrp.routing.workcenter`, removes the help from the `worksheet`
field to set it into the view.
This way, the tooltip doesn't appear each time the user cursor is placed
in front of the pdf in the workorder tablet view (`mpr_workorder`).
task-2225362
closesodoo/odoo#48903
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Go to inventory>product variants (list view), search for
'FURN_78236'.
Set quantity on hand (qty_available) 50
Now, back in list view, adjust your search to FURN_7
QTY on hand for FURN_78236 is 0.
This occur because during the computation of qty_available, the bom
kits (FURN_78236) are calculated first, but the qty_available depends
on the bom lines products, which are calculated only at the end.
Since qty_available became protected by the global environment, it
cannot be recomputed recursively and it is not in cache, thus is 0.
Making the simple products compute first in the _compute_quantity fix
the issue
opw-2226417
closesodoo/odoo#48924
X-original-commit: f41c650f162021bb6c76736c7dcbe4eee059cec1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>