Before this commit, owl was in the linter's accepted global variables.
This allowed direct access to owl global object.
For instance, to use xml from owl, you could do :
`const { xml } = owl;`
or you could use it directly:
`owl.xml`
Now, owl is not accepted on linter's global variables anymore, so to
import xml, now you need to use a proper import:
`import { xml } from "@odoo/owl";`
task-id 3498859
closesodoo/odoo#137517
Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
On stock.move, the icon next to the reservation to open the forecast view is
not align with the text.
closesodoo/odoo#137560
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
Choosing a negative quant to create a new move line in the detailled
operation should not take the negative quantity.
This commit set 0 instead.
closesodoo/odoo#137407
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
When the user tries to find the 'qty_available' of a product but gives
a string value instead of a float value in domain then the user will face error.
Steps to produce:
- Install `stocks`.
- Create a record rule for model `product.template`. In the domain of record
rule keep [('qty_available', '<', '10')] as a domain,
you can give any integral value in the domain but that value should be
enterred as strings (with quotes).
- Inventory > Products > Products
Error: `TypeError: '<' not supported between instances of 'str' and 'float' `
After applying our commit, if the domain is Invalid then the user will face
`UserError`. There is a function named `_search_product_quantity` which
initially checks if the domain is valid or not :
https://github.com/odoo/odoo/blob/5f1ad0c1e4c1e8ed41337ccd4c12e70c9c760c85/addons/stock/models/product.py#L342-L350
It will filter out all the invalid domain and clear search methods.
So now whenever `_search_qty_available` is called first the validity of domain
and operands of the expression will be checked.
sentry-4399815131
closesodoo/odoo#137367
X-original-commit: 92c232cca15517bd9a33a5100e7cdc42c3c25397
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
Steps:
- In ``stock.production.lot`` list view, use the filter 'Expiration Alerts'
Issue:
Every lots with ``product_expiration_alert`` set to True are returned but also the ones
with ``product_qty`` set to 0.0.
Reason:
The ``StockProductionLot.product_expiration_alert`` represents lots with expiration before or equal to the current date
but don't consider the quantity of product on hand.
Solution:
After discussing with Thomas (THD), and Tiffany (TIC) the solution is to add a new custom search function on the compute
field ``product_qty`` that will be used with the 'Expiration Alerts' filter to solve the problem.
opw-3474622
closesodoo/odoo#137251
X-original-commit: 09f1a45ccbb8b463e7d9326a25c2b0b18173b133
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
Signed-off-by: Eteil Junior Djoumatchoua (etdj) <etdj@odoo.com>
The error is caused by this commit: https://github.com/odoo/odoo/commit/e21c17fae8a29c8ee04883b27d761b8ce13cf5b7
Steps to reproduce the bug:
- Enable Storage location in inventory setting
- Create a storable product “P1”:
- Tracked: SN
- Create a purchase order with 1 unit of P1
- Receive product:
- location: WH/stock/shelf 1
- SN: S1
- Valide the delivery
- Go to the product form
- update the quantity:
- new quant:
- Location: WH/stock/shelf 2
- SN: use the same as shelf 1 (S1)
- You will receive a warning informing you that S1 is already used in
another location (this is expected), but the quant is still created
with this SN.
- Now try to clear the quant or refresh the page.
Problem:
You will always get a user error: "Quant's editing is restricted, you
can't do this operation." This occurs because the field "sn_duplicated"
is computed, and the write function is called to set it as True.
However, since this field is not included in the allowed fields,
the user error will always be triggered.
opw-3511463
closesodoo/odoo#137206
X-original-commit: 3a7b781dc1fad41ca0120c48f7587edb6d7adafe
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
Co-authored-by: William Henrotin (whe) <whe@odoo.com>
Several reports don't include product packing info on them. This is
useful for customers to see that what they bought matches what they
expected and for pickers who need to know which product packaging they
should be selecting from stock. Reports this was added to are:
- Sales orders,
- purchase orders (including RFQs),
- picking operations,
- delivery slips.
Note that we purposely exclude backordered moves since they weren't
deemed to be necessary at the time this feature was created.
Also includes light refactoring to remove repeated code for conversion
of product qty to packaging qty and to make it easier to do this
conversion in the future (i.e. can pass product.packaging without
original record that it was assigned to)
Task id 2927379
closesodoo/odoo#96858
Signed-off-by: Steve Van Essche <svs@odoo.com>
Since https://github.com/odoo/odoo/pull/110737, it is better to use
`_read_group` instead of `read_group` in the backend. In fact, the
public method is less efficient (it computes display_name of relational
groupby, extra order, ...) and more verbose.
This commit replaces these new uses of `read_group` with `_read_group`.
closesodoo/odoo#136381
Related: odoo/enterprise#47826
Signed-off-by: Raphael Collet <rco@odoo.com>
This commit fix 3 issues with the reservation with use_expiration_date set on the product:
1) -- Discrepancy of available_quantity --
StockMove._update_reserved_quantity() works along StockMove._get_available_quantity()
If the with_expiration context is added to one and not the other, the available_quantity sent to the 'update' method will not be correct.
2) -- Can't reserve on imperishable quants --
On the Quant, if expiration_date is False, the reservation will not be possible.
Changed the domain from `expiration_date >= date` to `expiration is False or expiration_date >= date`
---
# How to Reproduce
- Create a product P, tracked by lot, with use_expiration_date = True
- Set quantity on hand to 10 (without lot)
- Create a Sale Order for 1 unit of P: Confirm
- On the Delivery, 'Check Availability' (if not done automatically)
=> The Transfer is marked as Ready (aka: at least 1 unit reserved), but nothing is reserved.
=> If you Unreserve, the product availability is shown as Available, and if your Reserve again, it is shown as 'Not Available'
OPW-3434996
closesodoo/odoo#137097
X-original-commit: b5463465fa877b9913eb9747869aae00c6b394ca
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: David Fesquet (dafr) <dafr@odoo.com>
This reverts commit 656d8ace87.
The rational was: "If people don't have inventory, they will need a
backorder anyway and it's logical to not display the popup even
if the picking type has 'ask' for create backorder".
Also for the barcode application in OE we only show the reserved lines and
you could have the message if the picking was not fully reserve. Even if
you completed all the lines. So we could have a single flow for backend
and frontend.
But it's difficult for poeple to understand that the backorder is
base on the reservation and not on the initial demand. So we do a
step back. On top of it, people usualy won't mix flow. So they
could totaly use the "always create a BO" option on picking type
when they use the barcode and "ask" when they use the backend.
closesodoo/odoo#136725
X-original-commit: ed291c4d47783c5912ffb40db7893c321ccdb1e2
Related: odoo/enterprise#47959
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Add a new button Relocate on the stock.quant views.
This button appears when selecting 1+ quants and allows to create a stock.move to another location.
This button also allows to change the package of the quant(s) selected.
LIMITS:
- if a quant has reserved quantities, it will unreserved along with the related smls
- if a package is not fully moved to a new location, the quants selected will be unpacked
- no intercompany moves are allowed
- only available for stock manager roles
Addendum: there are 2 functions with almost identical names:
- action_set_inventory_quantity_to_zero
- action_set_inventory_quantity_zero
renaming action_set_inventory_quantity_to_zero to action_clear_inventory_quantity to make them easier to differentiate
task 3346212
closesodoo/odoo#124501
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
Also, "Short Name" for duplicated warehouses was set to "COPY", because
of the 5 char limit which doesn't allow appending " (copy)" to the
original value.
closesodoo/odoo#122511
Task: 3290154
Related: odoo/upgrade#5138
Related: odoo/enterprise#42541
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Rationale: if our users want to do a pick-pack-ship manually, they were
unable to duplicate pickings by just changing the operation type.
Task: 3290154
Related task: 3010731
Part-of: odoo/odoo#122511
The reason is to make it consistent with other places where we display locations,
where lot/serial number is placed next to the source location. Initial requirement
was to move lot/serial number in between "From" and "To", but PO decided to move
it before "From", as it should be more convenient for users.
Task: 3290154
Part-of: odoo/odoo#122511
Product's display_name can be too long and might not fit in small
labels. A decision was made to split it into default_code and actual
product name, and display both in separate lines.
Unfortunately, the logic of joining those 2 strings is embedded in the
model, so it had to be duplicated in the label.
Task: 3290154
Part-of: odoo/odoo#122511
Steps to reproduce the bug:
- Create a storable “P1”:
- tracking= serial
- save
- Change the type of product to service
Problem:
some fields for tracked products are not hidden, because the product
tracking is not updated.
Solution:
Convert _onchange_type into compute methods.
The tracking is updated even if the change type is applied from the
"product.product" form.
opw-3499976
closesodoo/odoo#136738
X-original-commit: 22fe0ee4764705e55e81f62e07d29fc9bd8296e1
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
Opening the stock move form view in a picking will display the
technical name of `move_ids_without_package`. This commit change it to
be more accurate.
closesodoo/odoo#136067
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
The field `move_line_nosuggest_ids` was missing on the stock move form
view. Depending on the `show_reserved` setting on the picking type, we
should show either `move_line_ids` or `move_line_nosuggest_ids`.
Displaying the wrong field will trigger the wrong computes
Part-of: odoo/odoo#136067
`removeprefix` string function has been introduce in Python 3.9 but we
still support Python 3.7
This commit replaces it by an hand crafted one
Part-of: odoo/odoo#136067
Commit 4da8c6ebca change the way the
detailled operation of a stock move is openned. This has been done only
for the picking. This commit adapts the
MrpProductionComponentsX2ManyField widget to act also as the stock move
widget used in the stock pickings.
Part-of: odoo/odoo#136067
The 'pick from' display name would give a name to the dummy quant only
in case of existing stock move line. It's an issue in case of delivery
with the use_create_lot setting as we could generate serial number on
the fly and thus showing a quant on virtual move line
Part-of: odoo/odoo#136067
This commit creates the stock move line in readonly to be able to focus
out the move_line_ids one2many widget without having to confirm the
values of all the move line with a <Enter> key
Part-of: odoo/odoo#136067
The 'like'/'ilike' operators automatically add the wildcard character
(`%`) at the beginning and at the end of the value. This commit fixes
the incorrect usage.
closesodoo/odoo#136007
Related: odoo/enterprise#47886
Signed-off-by: Raphael Collet <rco@odoo.com>
Since the new model (PR: odoo/odoo#114024), updating a record no longer
triggers a deep render and therefore no longer triggers the onWillUpdateProps
for Field components.
The goal of this commit is to adapt the usage of onWillUpdateProps
in Field composents in order to fix the bugs introduced by the RelationalModel
closesodoo/odoo#135842
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In this viewtiverse, the heroes remove the context dependencies for
`get_views`, from the views and python fields (such as domain). To reduce
inconsistencies and the number of rpc.
Current issues:
* There may be inconsistencies in views at the JavaScript level. Some
overrides modify the behavior of get_views or domains on fields via
context keys, therefore by changing the action, the rendering may be
different. However, these views are cached. However, the cache key
(Javascript) does not reflect the entire context, and requires additional
post-processing from the server.
* Multiple rpc for the same rendering. get_views being dependent on the
context, as soon as it changes, a new rpc is performed. In most cases,
when JavaScript needs the same view, there is no change depending on the
context, the rpc is useless.
* Inconsistency when rendering subviews, some views could be different
depending on the context, this context can be modified in the view itself
via the context attributes. However, the JavaScript client does not redo
an rpc for each change of these sub-contexts. Therefore the result may be
inconsistent.
Solution:
Limit as much as possible the number of context keys provided when calling
get_views, and use the context provided as a cache key. The authorized
keys are 'lang' and '*_view_ref'. For the cache key, options are added in
the get_views method.
Instead of using the context, it is inserted into python expressions.
This will be evaluated by JavaScript and thus avoids inconsistencies.
task-3414108
task-3414068
closesodoo/odoo#135145
Related: odoo/enterprise#47584
Signed-off-by: Raphael Collet <rco@odoo.com>
Choosing a quant to populate a new stock move line set the quantity done
and the reserve quantity to ensure it stay available to this particular
stock move and not empty by another picking
closesodoo/odoo#124409
Task: 3256447
Related: odoo/upgrade#5139
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Only immediate transfers should have the ability to reset the state to
draft. Also rewording it as "Plan" as the goal of this button is to left
the stock move to be done later and impact the forecast
Task: 3256447
Part-of: odoo/odoo#124409
In order to reduce the amount of RPCs in the detailed operation view.
The two wizards to populate the stock move line one2many with lot/serial
number to create are replaced with twos Owl dialogs.
only one RPCs is done to generate the stock move lines values from
either a serial number + a count or a list of lots name
Task : 3256447
Part-of: odoo/odoo#124409
The move without package as computed field bring some issue with the "no
save detailed operation" feature. Creating a stock move and directly add
some move lines without saving do not call
`set_move_ids_without_package`
Task: 3256447
Part-of: odoo/odoo#124409
This commit replaces the opening of the stock moves detailed operation
wizard by the one2Many record preview. This means creating a move in a
picking is still done via a new line but the edition is done via the
`fa-list` button that open the record in the web client. The goal is to
reduce the RPCs call as much as possible. The stock move lines data are
stored in the stock move record until the picking save.
Additionally, this commit change a bit the immediate transfers flows.
The stock move show only initial demand (`product_uom_qty`) but the
column wording is still "Done". In the detailed operation view, the
stock move line `qty_done` is displayed as "Reserved".
At picking validation, the user is expected to enter the same quantity
in `product_uom_qty` and `quantity_done`. If `product_uom_qty` is equals
to 0, the done quantity is used as actual transfer quantity. If
`product_uom_qty` is different than 0 but small than the done quantity,
an error is raised.
Task: 3256447
Part-of: odoo/odoo#124409
Commit 167c51b1f9 makes `use_create_lots`
and 'use_exisitng_lots` computed fields in MRP module but did not mark
them as `readonly=False`. Thus, they were readonly by default for any
picking types.
Also, make sure new reception picking type have their `use_create_lots`
set to True and delivery picking type their `use_existing_lots` set to
True.
closesodoo/odoo#135900
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
On the backorders, the consumed quantities are incorrect.
To reproduce the issue:
1. Create two products:
- C01: consumable
- P01: storable
2. Create a BoM
- Product: P01
- Type: Subcontracting
- Subcontractor: S
- Components: 1 x C01
3. Create and confirm a planned receipt:
- From: S
- 10 x P01
4. Set the done quantity (directly on the tree view) to 1
5. Validate + Backorder
6. On this first backorder, set the qty to 2
7. Validate + Backorder
8. Validate the second backorder
9. Inventory > Reporting > Moves History, filter on C01
Error: There are three SMs, and here are the done quantities: 1, 9
and 7. The second one is incorrect, it should be 2 (see step 6).
Since [1] the done quantity is always editable on the picking's
operations, but the feature is not implemented in subcontracting,
therefore the communication between the MO and the picking does not
work well. For instance, step 4: save the done quantity and open the
MO: nothing changed on it, its producing qty is still zero. Another
example: step 4, instead of setting the done quantity directly on
the picking, open the wizard (the MO), record 3 produced products and
close the wizard. The done quantity of the stock move is 3 but the
user can still edit it. However, if he tries to update the line,
nothing will change on MO side.
On top of these "little" bugs, it may lead to a more important one
as shown in the above use case. Step 5: at some point, we split the
MO to generate a backorder for 9 x P01:
https://github.com/odoo/odoo/blob/c47e4ac7cb5fdd690f40ab2e0f8d022ba565145e/addons/mrp_subcontracting/models/stock_picking.py#L72-L76
And, as shown, the flag `set_consumed_qty` is set to `True`. As
explained in the method description:
https://github.com/odoo/odoo/blob/a2574b45aef1ff6ff3a221b996d0bb0dda2a8c74/addons/mrp/models/mrp_production.py#L1602-L1603
So, because of this flag, the method will create a SML for C01 on
the backorder, with its done quantity set to the reserved one: 9.
However, back to the first block code: `move.move_line_ids` only
contains the SML created at step 4 (i.e., the SML of the inital
SM, with a done quantity equal to 1). As a result, in the for loop,
we only define the producing quantity of the initial MO.
This is a first issue: step 6, suppose the user rather opens the
detailed operations of the line: it displays the new MO, the
producing qty is 0 but the consumed quantity of the component is 9.
This is not perfect, but let's ignore this and continue with the
above steps. The user sets the done quantity to 2 and validates with
backorder. It runs the productions split again, we use the done
quantity as producing one on the MO, but we don't edit the consumed
quantities, hence the error.
For all these reasons, the safer solution is probably to prevent the
feature 'qty done always editable' in case of subcontracting.
[1] cacc677a08066bc23e1c89df36027599d05f2a08
OPW-3441197
closesodoo/odoo#135862
X-original-commit: 049f63fbc1ab09cf75824e5c22508ea091e5c4dd
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
Legacy code still use 'onchange' on the 'stock.picking.type' field code
to compute the different xxx_location_id.
As it is no more viable, this commit replace all these onchange by
compute methods.
These changes also has a side effect as some already existing compute
methods now get a set of 'stock.picking.type' in input, such that these
methods are also updated to handle this case.
closesodoo/odoo#134650
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
The properties button has been moved to the contextual action menu.
The kanban view now shows partner locations and internal location directly under a view location
task 3444583
closesodoo/odoo#130509
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
When stock is uninstalled, the sequences used in the warehouses for the
picking types are kept. However, since [1], picking types cannot be
duplicated anymore. When the module is re-installed, the picking types
are created with the same name, which is not allowed by [1].
[1]: https://github.com/odoo/odoo/commit/9034602a028fb22fbd139cf41a2f5c71d9d8d032
opw-3484352
closesodoo/odoo#135036
X-original-commit: 7b0f38fea8bc9a541972d29f289e6175ee15919b
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Walravens Mathieu (wama) <wama@odoo.com>
- Menu stock move renamed into 'moves analysis'
- the `moves analysis` menu presents an open default pivot view with
predefined filters and group by that facilitate the visualization of
stock variations based on quantity
- Add some default filters too in the moves history pivot view
closesodoo/odoo#126981
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
When getting the available quantity of a product, it is possible to
specify the warehouse and/or the location in the context. However,
it does not correctly work. For instance, if we provide the stock
location ID (8) and the warehouse ID (1): we first use the view
location of the warehouse, and we then get the intersection between
this view location and the provided locations: nothing. In such case,
we should keep the stock location. Few other examples are given in
the test.
OPW-3450169
closesodoo/odoo#134910
X-original-commit: 8b53464dc51fb14cb37801a1d978185729c8e339
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
Co-authored-by: Simon Schmid <simon.schmid@braintec.com>
To reproduce the issue:
1. In Settings, enable:
- Storage Locations
- Package
2. Create a product P
- Type: Storable
- Tracked by SN
3. Process a receipt with 1 x P, serial S
4. Return P in a package
5. Process a new receipt with 1 x P, still S as SN
Error: An error is displayed "The serial number has already been
assigned [...]". This is incorrect, the user should be able to
receive that SN.
After step 3, there exists a quant Q1: -1 x P at Supplier Location
with S. Then, after step 4, a new quant Q2 is created: 1 x P at
Supplier Location with S and the package. Because the field
`package_id` is not the same on Q1 and Q2, both quants are not merged.
As a result, step 5, we will update Q1 and have -2 x P at Supplier
Location with S. This will trigger the constraint, hence the error
message.
OPW-3390615
closesodoo/odoo#134902
X-original-commit: 0459e42ac452996831b0443bce088b84735975f0
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
There is code to block the UOM changing if there are done moves.
Because it searches in non-sudo mode, it does NOT currently
stop you changing the UOM if the product has moves in a different
company.
closesodoo/odoo#134900
X-original-commit: 426744646c25e8c2b17e3a50de186bd91b5e645f
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
Before this commit, formatters like `formatMonetary` and `formatFloat`
weren't loaded in the assets front-end.
This commit introduces `formatAmount` ( `formatMonetary` calls
`formatAmount` but makes some prior processing to deduce the currency
from the field) and makes `formatAmount` and `formatFloat` accessible
from any front-end application.
Note: The currencies were added in the front-end session info because
they are needed in `formatAmount`.
closesodoo/odoo#133824
Related: odoo/enterprise#46658
Signed-off-by: Valentin Chevalier <vcr@odoo.com>
When we haven't provided a custom action, the tour step runs the default
action. In the final step of the tour, when there is no `run` or
`isCheck` provided, It shows warnings of 'ignoring action (auto) of last
step' as it can lead to a race condition.
This commit resolves the warnings: `ignoring action (auto) of last step`
task-3429500
closesodoo/odoo#129239
Related: odoo/enterprise#46683
Signed-off-by: Romain Derie (rde) <rde@odoo.com>