Commit Graph
11639 Commits
Author SHA1 Message Date
Louis (wil) 3f6f949fa5 [I18N] export sources
closes odoo/odoo#140002

Related: odoo/enterprise#49687
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-10-27 08:36:16 +00:00
Xavier Morel 04f75728fd [FIX] *: restore gettext and unlink lints
Unwittingly broken by the removal of `__implements__` in
a6d601dc4e, these lints don't run
correctly with the old pylint, allowing new errors to creep in since.

closes odoo/odoo#139605

X-original-commit: 99cec73f585c8759142a707b06934d9c23aa5478
Related: odoo/enterprise#49473
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-10-26 13:41:19 +00:00
mano-odoo 9c877da258 [FIX] stock: invisible field for warehouse in route
When the user clicks the checkbox to add a warehouse, the field next
to it is invisible, making it difficult to notice.

This commit highlights the field and adds a placeholder to make it
obvious.

task-3486780

closes odoo/odoo#139528

X-original-commit: a60c94203072fd2343f6ca3a33a2cc1813757bea
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2023-10-26 13:41:17 +00:00
Arnold Moyaux 28d238b578 [IMP] stock: product label layout base on move
Since we use it now on batch and operation rename the selection field

task-3201527

Sub-task: 10
Part-of: odoo/odoo#127409
2023-10-26 13:41:01 +00:00
svs-odoo bc01c7bcec [IMP] product,purchase,sale,*: product catalog
This commit makes two major things:

1. Move the product catalog from `sale` to `product`.
It moves the product catalog's code from `sale` to `product` module in
order to be able to use it in other modules.
A mixin, `product.catalog.mixin`, was created for to make other models
catalog compatible.

2. It enables the product's catalog in `purchase`.
In `purchase`, the catalog differs a little bit from `sale`:
- If Unit of Measure is enable, the UoM for each product will appear in
  the catalog;
- If the product purchase's UoM or the purchase order line's UoM is
  different than the default product's UoM, the former one will be
  displayed (in bold so the user can know it's the UoM to refer);
- When opening the product's catalog from a purchase order, the products
  will be filtered by the PO's vendor;
- Some data from the vendor list will be used if appliant: the minimum
  quantity and the price;
- If there is at least one product's packaging, a button will be
  displayed to increase the qty by the packaging's one. If a packaging
  is set on the purchase order line, this one will be used.

task-3373589

Part-of: odoo/odoo#135502
2023-10-26 07:22:56 +00:00
svs-odoo 500c837f55 [FIX] stock: clean product's views indentation
Part-of: odoo/odoo#135502
2023-10-26 07:22:56 +00:00
Arnold Moyaux 7dda6bb927 [REF] stock: quantity pocalypse
The rational is:
Currently we have 2 columns. One for reservation, the other
for quantity picked.

However in real time, either you follow the reservation and everything
goes well. Otherwise you pick something else. In the case where you
pick somewhere else than reserved, you would like to modify the
reservation to have something similar and free the quantity you
didn't pick and expect the system to not suggest the ones you took.

In other hand, we always want to have the reserve quantity similar to
the done.

On top, having two columns could be confusing for the end user.

The cons:
-The qty_done column could be use during the picking, to
remember if something has been pick or still to pick.
- For some flow (put in pack), it's easier to write a part of the quantity to pack
and still want to reserve the full amount of product.

We goes back and choose a ligther interface over complex feature.

Changes:
Qty done and reserved qty are merged into a single column.
A new checkbox on the move exists to mark it as picked or not
Since the reservation always follow the quantity, it's now possible
to have more reserved quantity than stock. However the system will
never propose it and the inventory showing reserved > quantity should
be a warning.
The system should never modify a move that has been picked. We don't
want to overide the user action.

Regression:
Not able to pick a single stock.move.line

closes odoo/odoo#137864

Related: odoo/enterprise#48709
Related: odoo/upgrade#5310
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-10-25 18:10:54 +00:00
Martin Trigaux aae9c99f02 [IMP] *: convert to the new simpler syntax
closes odoo/odoo#139316

Related: odoo/enterprise#49379
Related: odoo/documentation#6189
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-10-24 21:09:58 +00:00
Adrien Widart (awt) 0c68ddce1e [FIX] {sale_,}stock: cancel SM only if no done quantity
On a picking, it is not always easy to make the difference between a
waiting SM and a cancelled one.

To reproduce the issue:
1. Create two storable products P1, P2 with on hand qty > 1
2. Create and confirm a SO with 1 x P1 and 1 x P2
3. On the delivery, set the done quantities
4. Edit the SO: 0 x P1
5. Validate the delivery

Error: The SM of P1 is a bit confusing. Its demand is 0, which makes
sense because of step 4. However, its done quantity is 1 although
nothing moved according to the quants. Actually, the SM is cancelled
but nothing gives this information UI side, hence the confusion.

Step 4, we decrease the qty. It creates and runs a procurement of -1,
which creates a SM with a demand of -1. We then merge it with the SM
of the delivery and since its demand becomes 0, we cancel it:
https://github.com/odoo/odoo/blob/aebe6e616c4d62010aba67e7c4fbcc82f1385bea/addons/stock/models/stock_move.py#L1003-L1007

However, nothing displays this information client side. When the
picking is not done, the line will be red because the done quantity is
greater than the reservation (see `decoration-danger`):
https://github.com/odoo/odoo/blob/aebe6e616c4d62010aba67e7c4fbcc82f1385bea/addons/stock/views/stock_picking_views.xml#L254
When the picking is `done`, both lines will be grey (see
`decoration-muted` in above code). Therefore, the information is not
clear for the user, he could beleive that the SM has been processed.

Moreover, the user has completed the line with a done quantity. We
can't decide for him that this quantity no longer has any value. If
he really has moved the product, we have to consider it on Odoo side.
Else, he has to update the done quantity himself.

OPW-3478871

closes odoo/odoo#139495

X-original-commit: d5a1c6bfadc28503a6928580e854264e94074fa0
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
2023-10-24 15:23:18 +00:00
Adrien Dieudonne a2016359d0 [REF] web, *: avoid extend on h5 for kanban card title
´extends´ generates a lot of css rules.

So in this commit, we remove it by replacing it by the ´h5´ html tag.

closes odoo/odoo#139484

Related: odoo/enterprise#49408
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2023-10-24 13:55:30 +00:00
Tiffany Chang (tic) ab56ebe8e6 [IMP] stock: auto-print reception report
Add in feature to auto-print reception report at validation of picking.
Note that only pickings that have an allocation will be printed
otherwise the form will only have the picking name/barcode and nothing
else in it (i.e. not very useful).

Part of task: 3046178 - general auto-print goal

Part-of: odoo/odoo#126791
2023-10-24 12:38:06 +00:00
Tiffany Chang (tic) d43416c65d [IMP] stock: auto-print packages
Add in feature to allow auto-printing of packages at picking
validation

Part of task: 3046178 - general auto-print goal

Part-of: odoo/odoo#126791
2023-10-24 12:38:06 +00:00
Tiffany Chang (tic) f00f02d1ae [IMP] stock: auto-print return slips
Add in feature to allow auto-printing of return slip at picking
validation

Part of task: 3046178 - general auto-print goal

Part-of: odoo/odoo#126791
2023-10-24 12:38:06 +00:00
Tiffany Chang (tic) d0657dce18 [IMP] stock: auto-print product/lot labels
Add in feature to allow auto-printing of product and lot labels at
picking validation.

Note that the `product.label.layout` (wizard) has a default picking
quantity value for how many labels should be printed out for each
product that makes sense for the auto-print case, whereas the
`lot.label.layout` (wizard) allows the the user to choose whether or
not to print out 1 label per lot/SN or the qty done of each lot/SN, and
both are valid options for auto-printing. Therefore the selection choices
for `product_label_format` matches it's corresponding wizard's choices
exactly, whereas the `lot_label_format` combines the `print_format` +
`label_quantity` of its corresponding wizard. Hopefully no additional
print formats are created for the lot labels...

Part of task: 3046178 - general auto-print goal

Part-of: odoo/odoo#126791
2023-10-24 12:38:05 +00:00
Tiffany Chang (tic) 278fbea2c6 [FIX] product,stock: allow label printing w/o doc layout
The default behavior of report_action() is to check if the currently
selected company has their document layout configured. The product
labels do NOT depend on this layout at all though, so let's make it so
the configuration never pops up when product/lot labels are being
printed.

Discovered during task: 3046178

Part-of: odoo/odoo#126791
2023-10-24 12:38:05 +00:00
Tiffany Chang (tic) cee8608e69 [IMP] stock: auto-print reception report labels
Add in feature to allow auto-printing of reception report labels
at picking validation when there are lines assigned in the reception
report (i.e. any MTO linkages/move_dest_ids).

Note that a little fix hack was necessary for this feature (i.e.
override of ir.actions.report to ensure that the doc_ids/docs are
correctly set) since this report was originally designed to be called
ONLY from the JS + using the report link to pass the correct parameters,
which cannot be done in the same way via the standard
ir.actions.report.report_action method

Part of task: 3046178 - general auto-print goal

Part-of: odoo/odoo#126791
2023-10-24 12:38:05 +00:00
Tiffany Chang (tic) a736d3278b [IMP] stock{delivery,_picking_batch}: auto-print package label
Add in feature to allow auto-printing of package label when "Put in
Pack" button is pushed. Note there are 2 choices for package labels and
these choices are hardcoded in as selection options to avoid complexity
of finding all relevant reports (i.e. custom report labels won't be
auto-printable) and exclude the irrelevant reports.

Unfortunately since there are different flows for "Put in Pack", a
separate "_post_put_in_pack_hook" method is needed to manually be called
in some of these cases and additional future use cases will also require
it to be called if this feature is desired in that case.

Additionally clean up _put_in_pack() since it was only called by methods
with ensure_one(), but was semi-designed to handle multiple pickings
(but only returned 1 package in the end, which didn't make sense + had
other errors in it).

Part of task: 3046178 - At package creation (put in pack)

Part-of: odoo/odoo#126791
2023-10-24 12:38:05 +00:00
Tiffany Chang (tic) 4ebad302a4 [IMP] mrp,stock: allow auto-printing + chained (report) actions
This commit adds two linked features:
1- the ability to chain (report) actions
2- the ability to auto-print delivery report at picking validation

Because feature 2 results in the possibility of 2 actions to be returned
at picking validation (due to pre-existing auto-open reception report at
validation option), feature 1 is required to support it. It is expected
that chaining will primarily occur with report actions since chaining of
the other action types does not currently have an applicable use case.
Since this feature is only needed within stock for now, it is
encapsulated within a custom client_action for now that is a lot of copy
paste of action_service.js

This is the first commit to support a series of potential
auto-printable reports.

Part of task: 3046178 - Operation Type
ENT PR: odoo/enterprise#43362

Part-of: odoo/odoo#126791
2023-10-24 12:38:05 +00:00
Tiffany Chang (tic) 5f816d635a [FIX] stock: copy reservation_date in split moves
steps to reproduce:
- activate Settings > Reception Report
- Create new storable product
- Create + confirm planned delivery of 5 of the product
- Create + confirm planned receipt of 2 of the product
- Open reception report (Allocation button) in receipt
- Assign the 2 products to the delivery
- create +confirm a new delivery with 2 products
- create + confirm a new receipt with 2 products
- Open reception report in new receipt

Expected result:
The stock.move in the original delivery will be split into 2 moves, with
Demand qtys of 2 and 3 respectively. Opening the new receipt's reception
report will allow you to assign to the remaining 2 in the original
delivery

Actual result:
Only the new delivery is displayed rather than the old delivery

Issue was due to the `reservation_date` not being copied into the newly
split move even though we would expect it to be the same (instead it is
`False` since the default reservation method for operation types is
`at_confirm` and the new move does not have `action_confirm` called on
it, so the date is never set). Since we usually don't want this date to
be copied, we only manually do it in the reception report splits.

Part-of: odoo/odoo#126791
2023-10-24 12:38:05 +00:00
Xavier Morel 9ebbfdac73 [FIX] *: incorrect translations markings
Fixes a large number of cases where strings are translated then
formatted, instead of letting `_()` do the formatting internally,
which allows it to recover from incorrect translations (missing,
broken, or extra placeholders).

Also

- removes translation markers entirely when there's nothing to
  translate e.g. `_("%s - %s")` is not useful
- fixes a few messes which lead to only partial translatability
  (DRY is generally a bad idea when translations are involved, even
  more so when you don't make the variable part translatable)
- fixes a few nearby issues noticed at the same time
- replaces a few `"%s"` by `%r`, which should automatically quote
  strings relatively appropriately
- fixes translated strings which use `\` to escape a newline (in order
  to fill-paragraph): `\` escapes only the newline, if the
  continuation string is indented this results in a bunch of spaces
  ending in the string to translate, which is pretty garbage for the
  translator, using implicit concatenation works much better

Note: some of the updates revert f-string parameters to %, because
babel (2.9) apparently has trouble with f-strings and blows up trying
to extract them.

Not in scope:

Helping translators fix translatable strings e.g. any translation
string with more than one placeholder probably should use keyword
placeholders

- Provides more context / data to the translator to make sense of the
  sentence.
- Allows reordering the translated terms, which can be necessary
  depending on the sentence and language.

closes odoo/odoo#139314

Related: odoo/enterprise#49311
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-10-23 16:45:09 +00:00
Adrien Schoffeniels b598ea63f9 [IMP] stock: remove "configure_properties_field" action
Purpose:
-------
Commit [1] moved the properties field's "Add property" button inside
the cog menu of form views by default so that it's no more needed to
create actions for that purpose in each module using the properties
field.
In this commit, we forgot to remove it in the stock module (and we
currently have 2 "Add Properties" buttons in the cog menu).
We therefore remove it.

[1]: 24af3661b8cad2932c851a1cfc8e20d6e5422224

Task-3458627

Part-of: odoo/odoo#132578
2023-10-20 11:21:56 +00:00
Adrien Schoffeniels 31af631607 [IMP] *: add properties fields to various models
Purpose:
--------
This commit adds properties (and related properties definitions) on the
following models:
- hr.employee (hr.department)
- hr_recruitment.hr_applicant (hr_recruitment.hr_job)
- product.product (product.category)
- stock.picking (stock.picking_type)

These have been added to the related form, kanban and calendar views when
applicable.

Properties have also been added to kanban and calendar views of
- crm.lead
- event.event
- project.task
(Properties had already been added on these models and form views)

Task-3458627

Part-of: odoo/odoo#132578
2023-10-20 11:21:56 +00:00
Raphael Collet f6b7899a06 [IMP] core: use SQL wrapper in _read_group()
Part-of: odoo/odoo#138019
2023-10-20 09:35:18 +00:00
Pierre-Yves Dufays 725e7ffae3 [IMP] various: improve custom activity views
The following summary view of the record in the activity views have been
improved:
- project_task: task state added
- project_project: project manager added
- event_event: responsible and the dates (date_begin_located and
date_end_located) added
- account_move: total amount, customer and state added
- sale_order: total amount and the state added
- purchase_order: total amount and the state added
- crm_lead: customer and stage added
- hr_applicant (hr_recruitment): recruiter added
- survey_survey: responsible added
- maintenance.request: added equipment and responsible
- stock.picking: added scheduled_date
- repair.order: responsible, schedule_date and product_id added
- mrp.production: added responsible
- hr_leave (hr_holidays): status is added and default deadline modified see
below

Ensures that "Schedule activity" is in one line by adding a colspan.

hr_leave activity: When a time off approval activity is created as a
consequence of the creation of a hr.leave, the deadline of the activity is set
to the date_from of the hr.leave minus activity type delay_count (default 15)
except if it leads to a date anterior to today. In that case it is set to
today. That way, in the activity view, the time off approval activities are
more or less sorted by related hr.leave date_from and the cell date is an
indication of when the time off is planned.

Technical note: on most activity view, the activity record was not occupying
all the horizontal space. To solve that problem the css has been modified and
the max-width (200) that was imposed on the sub div has been removed. And as
it was impossible to impose a max-width for a flex div (which is the common
case for the activity record), the max width is imposed on each text that might
be too long using the class o_text_block. That class has been modified to
impose a max-width. That's why that class has been added in most view.
Alternativly, we could have modified the activity compiler to add that class
when the attribute full was set (not done because not sure of the consequence).

Task-3300854

Part-of: odoo/odoo#138135
2023-10-19 19:08:12 +00:00
Pierre-Yves Dufays 723b0ff5d5 [IMP] various: add activity view for different model
We add the activity view for:
- event.event
- maintenance.request
- mrp.production, mrp.unbuild
- repair.order
- stock.picking

Task-3300854

Part-of: odoo/odoo#138135
2023-10-19 19:08:12 +00:00
Adrien Widart (awt) 55f461060e [FIX] stock: display backorder wizard
To reproduce the issue:
1. Create a planned receipt with two lines:
   - 10 x P
   - 10 x P
2. Confirm and set the done quantities:
   - 12 x P
   - 8 x P
3. Validate

Error: The receipt is directly processed and a backorder is created.
In case a backorder could be created, we should first display the
wizard that asks for a user's confirmation

When checking for the backorder wizard, we compare, for each
**product**, the sum of the demands with the sum of the done
quantities. In the above use case, we will have `10 + 10 == 12 + 8`,
so we don't display the wizard.

However, while processing the SMs, this is different. For the second
SM, we will set its demand to 8, create a third SM with a demand
equal to 2 and create a new picking (the backorder) for this new SM.
This behaviour is legit, the backorder creation makes sense. This is
why this commit fixes the wizard display conditions.

OPW-3373255

closes odoo/odoo#138863

X-original-commit: 5affa219d8add6f256030b699f61ddf77a928c82
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
2023-10-17 06:25:12 +00:00
Brieuc-brd 538fdab99b [IMP] *: fine-tune app icons
The aim of this commit is to improve the impact and rendering of app
icons in bright and dark mode. It also reduces the size of svg files.

To achieve that, this commit updates the colors to flat colors. This
change will make the icons stand out and improve their readability.

task-3072562

X-original-commit: 667a19162b74fb6554a2389ba9c6e69de4ff5113
Part-of: odoo/odoo#138279
2023-10-16 09:21:17 +00:00
Adrien Widart (awt) e52d8f6648 [FIX] stock: update picking type sequences
Suppose a picking type in company C1 that uses a sequence in company
C2. If a user then tries to install mrp/pos, it will lead to a
Server Error because at some point, we write on the picking type:
https://github.com/odoo/odoo/blob/c02df957d9f04c911f330aaaadd80fe97a601509/addons/stock/models/stock_warehouse.py#L332
It will trigger the company checking and lead to the error
https://github.com/odoo/odoo/blob/a32c98beb5d57c3af481558c6db08767e9258959/odoo/models.py#L3548

When updating the picking types, we should also update the sequences
to ensure the data consistency.

OPW-3501199

closes odoo/odoo#138710

X-original-commit: 2ad97c6aeda86e4fed7573fb395b25adae935610
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
2023-10-16 07:58:47 +00:00
Victor Piryns (pivi) 8fd1b20d20 [PERF] stock: reduce memory usage of _get_orderpoint_action
Issue:
On databases with lots of products (400k+ `product.product`), the action
Inventory > Operations > Replenishment takes a lots of memory to
complete, leading to "Out of Memory" errors in some use cases.

Analysis:
When triggering the action, we need to recompute the
`virtual_available` of a lot of products (regular occurrence when a
DB for example has a lot of variants). The compute
`_compute_quantities` uses the ORM `filtered` method to filter out
`services` out of the `product.product` we have. This method is
memory hungry, as for each `_prefetch_ids` (capped at 1000, cf.
`PREFETCH_MAX`) it will store in cache the `product_tmpl_id.type`,
which stores all fields of the product_template + the type,
bloating the cache with *useless* data, as it's not used beyond this
filtering process.

Solution:
Disable the prefetcher, the bulk of the work is done in
`_compute_quantities_dict`, which makes a lot of `read_group` and
doesn't benefit much from fields already cached (this function
itself also disables the prefetcher internally at some point).
Also correcting the looping order in `_get_orderpoint_action` to
avoid multiple cache invalidation when those can be batched in 1 call.
The `PREFETCH_MAX` makes sure the compute is only executed with 1k
records at a time, so explicitly dividing `all_products_ids` into
batches of 5k is unnecessary.

Results:
- Memory usage of `_get_orderpoint_action`:

| Memory usage | Before  | After   |
|--------------|---------|---------|
| Total Memory | 1.8 GiB | 363 MiB |
| Allocations  | 10170   | 2804    |

(profiler data available on referenced ticket)

- Execution time of `_get_orderpoint_action`:

| `product.product` count | Before   | After    |
|-------------------------|----------|----------|
| 1k                      | 1.3s     | 1.1s     |
| 10k                     | 4.1s     | 3.8s     |
| 100k                    | 30s      | 25.9s    |
| 400k+                   | 2min 25s | 1min 39s |

As we can observe, we've reduced drastically the memory usage of the
function and also the number of allocations quite drastically. As a
side effect there is also a slight speed improvement at small
scale, and at large scale the gains are up to ~40%
faster.

Reference:
opw-3415087

closes odoo/odoo#138423

X-original-commit: 41442574159429ce29aa5c5adf0e1a0d8a7046dd
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
2023-10-12 06:59:08 +00:00
Michael (mcm) 7ebd785764 [IMP] *: rename quick_add into quick_create
This commit renames calendar's attribute quick_add to quick_create
to be more consistent with other views.

closes odoo/odoo#138042

Related: odoo/enterprise#48677
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-11 17:02:07 +00:00
William Henrotin 2bfe5e9722 [IMP] stock, barcode: search pickings from lot/serial number
Give the ability to filter pickings base on lot/serial number set on
stock move lines.

Part-of: odoo/odoo#136236
2023-10-10 12:34:59 +00:00
Xavier Bol (xbo) 6d195397e4 [IMP] stock,purchase_requisiton: remove some warning messages
This commit removes some warning messages displayed in some wizard and
removes the fields used to display or not those warning
messages.

task-3356114

closes odoo/odoo#124820

Related: odoo/upgrade#4899
Related: odoo/enterprise#42472
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-10-10 12:34:56 +00:00
Kartik ChavdaandKamlesh Pathekar e3bc974ea4 [IMP] base,** : make error message user friendly
Before this commit error messages in odoo are boring and
not much attractive to user. Those were like odoo is preventing
them from doing something user want to do.

In this commit, we have modified the message to be a more friendly
and humorous tone, making it less tedious and more enjoyable. It
aims to enhance the user experience and ensure that interactions
with any application are both pleasant and informative. As a result,
the messages have been clear, short, easy to understand and informative.

task-3356114

Part-of: odoo/odoo#124820
Co-authored-by: Kamlesh Pathekar <kpt@odoo.com>
2023-10-10 12:34:56 +00:00
Djamel Touati c8445d32ae [FIX] stock: print ZPL label with “product.product” price
Steps to reproduce the bug:
- Create a storable product “P1”:
    - set sales price: 10
    - Go to attributes & variants tab:
        - Color: red & blue
        - Size: S

- Go to Red attribute and add extra price: 5
- Go to the product variant “P1 red S”
- Print label:
    - ZPL with price

Problem:
The product.template price is printed instead of the product variant
because we use “list_price” instead of “lst_price”

opw-3537277

closes odoo/odoo#137786

X-original-commit: ea632652be5d4b1cbdf19f68c1a4db1ffc3cfb99
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-10-06 09:39:28 +00:00
Jorge Pinna Puissant ef424a9dc2 [REF] *: remove owl from linter's accepted global variables
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

closes odoo/odoo#137517

Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-05 10:21:53 +00:00
Arnold Moyaux b761a873f0 [FIX] stock: align widget inline for availability
On stock.move, the icon next to the reservation to open the forecast view is
not align with the text.

closes odoo/odoo#137560

Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
2023-10-04 20:52:44 +00:00
William Henrotin b9955b5088 [FIX] stock: prevent creating negative move line
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.

closes odoo/odoo#137407

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-10-04 19:40:23 +00:00
Saurabh Mishra 75a1e2a2d3 [FIX] stock: filter invalid input from domain
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

closes odoo/odoo#137367

X-original-commit: 92c232cca15517bd9a33a5100e7cdc42c3c25397
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2023-10-03 16:55:47 +00:00
Eteil Djoumatchoua(etdj) da18c86117 [FIX] stock: Enable searching on lot's product qunatity
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

closes odoo/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>
2023-10-02 14:12:52 +00:00
Djamel TouatiandWilliam Henrotin 3a4574d67f [FIX] stock: avoid error when editing quant with duplicated sn
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

closes odoo/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>
2023-10-02 14:12:51 +00:00
Triet Ngo d05372eb7b [IMP] purchase, sale, stock: add packaging in reports
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

closes odoo/odoo#96858

Signed-off-by: Steve Van Essche <svs@odoo.com>
2023-10-02 14:12:45 +00:00
Rémy Voet (ryv) a9dd388a11 [IMP] *: use private _read_group for efficiency/consistency.
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`.

closes odoo/odoo#136381

Related: odoo/enterprise#47826
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-09-29 14:48:13 +00:00
David (dafr) 1da26ab27d [FIX] stock,product_expiry: Add 'with_expiration' context to _get_available_quantity
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

closes odoo/odoo#137097

X-original-commit: b5463465fa877b9913eb9747869aae00c6b394ca
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: David Fesquet (dafr) <dafr@odoo.com>
2023-09-29 13:11:56 +00:00
Arnold Moyaux eff2c6edaa [FIX] stock: backorder base on initial demand
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.

closes odoo/odoo#136725

X-original-commit: ed291c4d47783c5912ffb40db7893c321ccdb1e2
Related: odoo/enterprise#47959
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-09-29 11:59:01 +00:00
Mahamadasif Ansari 3389bbafad [REM] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Ref-https://github.com/odoo/odoo/pull/130467

task-3508331

closes odoo/odoo#136920

Related: odoo/enterprise#48065
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-28 16:57:55 +00:00
snd 08015c2a15 [IMP] stock: move multiple quants at once
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

closes odoo/odoo#124501

Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2023-09-28 13:20:58 +00:00
Paweł Fertyk c31c6f5de5 [IMP] stock: append "copy" to duplicated resources
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.

closes odoo/odoo#122511

Task: 3290154
Related: odoo/upgrade#5138
Related: odoo/enterprise#42541
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-09-28 10:22:03 +00:00
Paweł Fertyk c4dc84ffca [IMP] stock: allow changing operation type in draft
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
2023-09-28 10:22:03 +00:00
Paweł Fertyk f283020298 [IMP] stock: move "Lot/Serial Number" before "From"
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
2023-09-28 10:22:02 +00:00
Paweł Fertyk f55c26948d [IMP] stock: add avatar widget for "Responsible" in picking form
Task: 3290154
Part-of: odoo/odoo#122511
2023-09-28 10:22:02 +00:00