Commit Graph
340 Commits
Author SHA1 Message Date
Simon Genin (ges) feef532b41 [REF] web, stock: refactor report client code
This commit converts the report code to the new framework.

Since the module stock still has code that extends the old
"ReportClientAction", the old report code is put inside this module.
It can be then naturally removed once the module is fully converted.

closes odoo/odoo#97390

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-02 20:10:53 +02:00
JF Aubert ec0b100532 [REF] stock: convert inventory_report_list to wowl
closes odoo/odoo#98436

Task: 2885757
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-08-31 12:37:28 +02:00
Tiffany Chang (tic) f05e3eabbe [IMP] stock{_account}: add (product) stock report
Adds a new reporting view for [storable] product.product to allow for
easier analysis by product (rather than by quant which is location
specific).

This includes:
- adding 3 new fields for products:
  - avg_cost = total svl value / total qty
  - total_value = avg_cost / on hand
  - company_currency_id = self.env.company.currency_id (i.e. the
    currently selected company) for which currency symbol to display in
    the view
  - IMPORTANT NOTE:
    - these variables (and some of the existing ones) do NOT support
      multi-company aggregations due these values being used to calcuate
      future svls which should be company specific. Larger refactoring
      would be needed to ensure correct calc in both cases. Larger issue
      occurs in stock.report which uses these variables in combination
      with variables that do take into account multi-company records.
- A customized `SearchPanel` so that a warehouse context can be applied
  to the view, rather than a filter. (viewable only when more than 1
  warehouse)

"stock report" part of b2b task: 2882539

Part-of: odoo/odoo#97109
2022-08-29 23:46:36 +02:00
Tiffany Chang (tic) 9649000b89 [IMP] {purchase_, sale_}stock{_account}: improve forecast report UX
Minor UX updates to forecast report:

- add missing space (between # and unit + before |) also removed
  superfluous uoms (only need it at the end now that an equation is
  displayed)
- move On Hand Value to under product link (+ variants if they exist)
  and make it a link to the valuation report of the product(s) in
  question
- add link from Quantity on Hand to the locations (i.e. inventory/quants)
  report for the relevant product(s). Note that product template was
  added to Search in order to support default searching due to
  forecasting report structure
- redo the top right forecast values to be On Hand + Incoming - Outgoing
  = Forecasted so we provide more explicit and transparent values.
  Additionally, these values are made to not display decimal digits if
  all of those digits are 0.  Note that forecasted values in table are
  untouched (i.e. Forecasted Inventory = Forecasted is unchanged and
  Forecasted with Pending still shows in table)

Also did some t-esc => t-out replacement and other small cleanup since
templates were already being edited.

"forecasted report" part of b2b task: 2882539

Part-of: odoo/odoo#97109
2022-08-29 23:46:35 +02:00
Tiffany Chang (tic) 06a2d3baaf [IMP] stock{_account}: update UX of valuation report
Note this is specific to the view shown when clicking on
"Reporting > Valuation", but this uses the same 'stock.quantity.history'
wizard and related custom js as "Configuration > Locations > Current Stock"

Minor UX updates to valuation report:
- don't default groupby product
- add filters incoming and outgoing (same logic as stock.move filters)
- replace "Inventory at Date" with "Valuation at Date" where appropriate
  (but leave location current stock view untouched)
- create separate view for the valuation report so remaining qty/value
  are displayed, but all other svl viewing actions (including the
  "Valuation at Date") will remain showing the original qty/value to
  support deeper analysis
- don't sum unit_cost when groupby is applied in list view since the
  value won't make sense
- add "reference" to svl which is = to stock.move.reference

"valuation" part of b2b task: 2882539

Part-of: odoo/odoo#97109
2022-08-29 23:46:35 +02:00
Tiffany Chang (tic) 9978bcb366 [IMP] stock{_account}: inventory => locations report update
Inventory report has been updated to have:
- better applicability: report renamed to "Locations" and is only
  visible w/Locations, Consignment, or debug mode active
- improved UX: list view rearranged, buttons added, grouping removed,
  sums added to bottom of list
- improved quant "Value": instead of the accounting value, this is now
  the average unit cost (i.e. sum(valuation layer values)/sum(valuation
  layer quantities) per product x on hand qty (of quant).
- single click load for products
- search based on Warehouse option (including storing
  location.warehouse_id to avoid overly complex search function)
- always show "Location" column in this view even if multi-locations is
  not active

"inventory report" part of b2b task: 2882539

Upgrade PR: odoo/upgrade#3819

Part-of: odoo/odoo#97109
2022-08-29 23:46:34 +02:00
Hubert Van de Walle (huvw) 96c2716674 [FIX] stock: history back on the forecast report
Steps to reproduce:

  - Go to stock > Replenishment
  - Click on a forecast report widget
  - Go back using the browser arrows
  -> The page is redirected to another forecast report and the
  breadcrumbs are cleared

Cause of the issue:

  The forecast report action uses the `window.history.pushState` to
  add the active model in the url.
  When going back, the new url is the same one but without the active
  model.
  We can get the correct behavior by doing `window.history.go(-2)` in
  the console.

Solution:

  Use `history.replaceState` instead

opw-2917725

closes odoo/odoo#96487

X-original-commit: b39dc5488bacb704aaa60f1a502bf005d57f3276
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-07-21 01:53:47 +02:00
Romeo Fragomeli 1fcd098af5 [REF] *: BS5: migration
Automated change made by a lot of RegEx to change all think that is
possible to automate.

https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli 23facbfb76 [REF] *: BS5: migrate popovers/Tooltip
* data('bs.popover') is not a jQuery data anymore
  -> fetch data from the instance instead.

* use the new class name 'popover-arrow' instead of 'arrow'

* website_forum: offset is not a number anymore
  -> Convert to string instead.

* BS5 event listener: 'focus' -> 'focusin'

* use `mouseover` event to show and `mouseout` to hide.

* disable at some point the animation to avoid remaining listener
  in the DOM.

Ref:
https://getbootstrap.com/docs/5.1/migration/#popovers

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:17 +02:00
Romeo FragomeliandStefano Rigano 41eebf822b [REF] *: BS5: handle contrast color
The logic not identical in BS4 -> BS5
The color contrast system in BS5 relies on WCAG 2.0 contrast algo.
So color-yiq is converted to color-contrast.
Note that there are some "texts/buttons/other visuals" elements
which will not have the same contrast as before.

$yiq-text-dark and $yiq-text-light are respectively replaced with
$color-contrast-dark and $color-contrast-light.

Note that we had to use '$min-contrast-ratio: 2.2' for .o_tag_color_X badge.

Task ID: 2766483

Part-of: odoo/odoo#95450
Co-authored-by: Stefano Rigano <sri@odoo.com>
2022-07-07 13:30:17 +02:00
Adrien Widart 019f96559f [FIX] stock: prevent edit mode when resolving WO conflicts
To reproduce the issue:
(Install mrp)
1. Create a conflict between two work orders
2. Open one MO > Work Orders, click on the danger symbol

Error: The form has switched into edit mode

In case of a 2many field, if one of the inner fields has the class
`o_widget`, the quick edit feature is disabled for that inner field:
https://github.com/odoo/odoo/blob/7ad3c62b60965139fab06227cb4e941720fed8c2/addons/web/static/src/legacy/js/fields/relational_fields.js#L1121-L1125
This class is automatically added on JS-side, during the rendering
thanks to `_renderWidget`:
https://github.com/odoo/odoo/blob/80acf449bcaf5ff3d2ba81d84efc0498bc78c533/addons/web/static/src/legacy/js/views/basic/basic_renderer.js#L842
However, in the above case, because this is a widget defined explicitly
on the field:
https://github.com/odoo/odoo/blob/5682015958d03f4a65969afe3fce9b9b05e5b505/addons/mrp/views/mrp_workorder_views.xml#L101
It leads to `_renderFieldWidget` which does not automatically add the
class `o_widget`
https://github.com/odoo/odoo/blob/80acf449bcaf5ff3d2ba81d84efc0498bc78c533/addons/web/static/src/legacy/js/views/basic/basic_renderer.js#L726

OPW-2887413

X-original-commit: b7225f415a545e7fd204a7ab4d1114ac680aeea1
Part-of: odoo/odoo#95087
2022-07-01 17:48:23 +02:00
Aaron Bohy 4f984568e1 [REF] *: adapt code to new kanban view
This commit makes various adapations in addons with respect to
the introduction of the owl kanban view. Mainly, some selectors
in scss and in tests needed to be adapted. Moreover, in some tests
that we haven't adapted yet, we must ensure that legacy form and
list views are still used (useLegacyViews).

It also contains some adaptations in kanban templates, e.g. the
replacement of moment by luxon, the removal of underscore...

Part-of: odoo/odoo#92475
2022-06-30 09:29:45 +02:00
Touati Djamel (otd) c7ba64ebbf [FIX] stock: allow “apply all” with grouped list
Steps to reproduce the bug:
- Go to inventory > reporting > inventory report
- Add any “group by”, for example: ‘product’
- Click on the “Apply All”  button

Problem:
A Missing record error is triggered.

When we click on the button, the `active_ids` key is added in the
context, but it does not represent the ids of the `stock.quant`
but rather the ids of the grouped records, "product" in our case:
https://github.com/odoo/odoo/blob/bec3c58df303df6ac508bdfbb9b317d5019b858a/addons/stock/static/src/js/inventory_singleton_list_controller.js#L127

Then, They are added in the context of the wizard with the key:
`default_quant_ids`: https://github.com/odoo/odoo/blob/262b49d85a95bc445e954741224305ebaa7f545b/addons/stock/wizard/stock_inventory_adjustment_name.xml#L27-L28

So when we get the `stock.quant` records, we do a search with the ids
of the products instead of the `stock.quant`
https://github.com/odoo/odoo/blob/8f12dbc00fdc96732fd2ec9104ed6bf057327ef4/addons/stock/wizard/stock_inventory_adjustment_name.py#L14

Therefore, if there is no `stock.quant` with the same id
as the products, an error will be thrown

opw-2879590

closes odoo/odoo#93870

X-original-commit: 8ec3d1484ddcb1dbca14df850dfe1490309c461e
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-06-20 15:31:43 +02:00
Adrien Widart f308906b68 [FIX] stock: display graph on forecasted report
In some cases, an unexpected line "Undefined" is displayed on the graph
of the Forecasted Report

To reproduce the issue:
1. Create a storable product P
2. Process a receipt R01 with 1 x P
3. Process a delivery D01 with 1 x P
4. Create and confirm a planned receipt R02:
    - Scheduled date: In 7 days
    - Operations: 1 x P
5. On the form of P, open the On Hand page
6. Back to the form of P, open Forecasted page

Error: An unexpected line "Undefined" is displayed on the graph and is
always equal to zero

Suppose the user does the same as above without the step 5: there won't
be any unexpected line on the graph. Here are the explanations: after
step 3, a quant for P exists and its quantity is zero. So, suppose the
user doesn't open the "On Hand page" and directly opens the Forecasted
Report. Considering its definition:
https://github.com/odoo/odoo/blob/a9dc406b52a3702f6901f686503e8d841f81724e/addons/stock/report/report_stock_quantity.py#L41
Four things happen (we only consider the state `forecast`):
- The SM of R01 is propagated from `today minus 3 months` to `yesterday`
- Same for SM of D01
- The quant is propagated from `today minus 3 months` to `today plus 3
months`
- The SM of R02 is propagated from `in 7 days` to `today plus 3 months`

-> Thanks to the quant, there are some data between `yesterday` and `in
7 days`

Let's now consider the step 5. Opening the page leads to:
https://github.com/odoo/odoo/blob/b22a23435a0cc42b7084ded21dbd4ef3a4a2113e/addons/stock/models/stock_quant.py#L621-L630
where, in `_quant_tasks`, we unlink the zero quants:
https://github.com/odoo/odoo/blob/b22a23435a0cc42b7084ded21dbd4ef3a4a2113e/addons/stock/models/stock_quant.py#L562-L565
Therefore, in the `report.stock.quantity`, we are creating a hole
between `yesterday` and `in 7 days`. When performing the RPC
`read_group` to get the graph data, a key-context is defined
(`fill_temporal`). Thanks to this, the hole is filled by the server but
the generated data do not mean anything:
https://github.com/odoo/odoo/blob/80ec56bd246869567c3bbc746be1ebce52970a63/odoo/models.py#L2005-L2007
i.e., the value of `empty_item` is:
```py
{'id': False, 'date_count': 0, 'product_qty': False, 'product_id':
False}
```
Later on, on JS-side, when processing the `read_group` result:
https://github.com/odoo/odoo/blob/ee84815f2b57ed7ba096d3390aa8c6509e3f7845/addons/web/static/src/js/views/graph/graph_model.js#L235-L241
We are grouping by date and by product. As explained above, some data
have an undefined `product_id` so, in such case, `labels` will contain a
date and an `undefined` value. This explains why we have two lines on
the graph:
- one for the product P
- one for the data generated by the server to fill the hole in the dates
range

OPW-2800818

closes odoo/odoo#93248

X-original-commit: 0530fffe2343463500273b9b03470847276e64bc
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-06-14 11:41:26 +02:00
William Henrotin 63d068e94d [FIX] stock,mrp: render control panel components
Since 362f6b6d5b, the control panel of an
action can be rendered only the first time the dom is mounted. Any
further remount won't rerenders do anything. The bom report needs to add
some buttons and a searchView. Previously, those widgets was mounted in
the set_html _after_ the first mount of the controlPanel. This report is
an extend of the stock traceability which also adds some buttons. In
this case the buttons are rendered correctly because they are added
_before_ the first controlPanel mount.

This commit makes the extra widgets to be rendered in the control panel
generated in a new specific method overridable in the bom report file

closes odoo/odoo#93245

X-original-commit: 39306370a3a7c5767a29bba216ffe61ab8c69544
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-06-10 09:28:09 +02:00
Ahmed Khalaf (ahkh) db810d14be [IMP] stock: stock quant import template
Task: 2764771
Part-of: odoo/odoo#91640
2022-06-03 12:02:08 +02:00
Adrien Widart aba89a0e89 [FIX] stock: print traceability report
On a traceability report, if a user clicks on a lot and prints the new
report, an erorr will be displayed

To reproduce the issue:
(Need mrp)
1. Create two storable and tracked-by-lot products P_compo, P_finished
2. Update quantity of P_compo:
    - 1 x P_compo with lot L_compo
3. Create a bill of materials
    - Product: P_finished
    - Components
        - 1 x P_compo
4. Produce 1 x P_finished (lot L_finished)
5. Inventory > Products > Lots/Serial Numbers, open L_finished
6. Click on Traceability, unfold the line and click on L_compo
7. Print the report

Error: an Odoo Server Error is displayed (RPC_ERROR)

Since [1], the route has changed

[1] e2f59a6dd1

OPW-2773967

closes odoo/odoo#91453

X-original-commit: c0aefc788059499a745fc1787a253b3367dce8d5
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-05-16 13:57:16 +02:00
Denis Ledoux ae19152a21 [FIX] stock: replace fields_view_get by get_views
Following odoo/odoo#87522,
the use of `fields_view_get` is deprecated.
All calls to it should be replaced by a call to `get_views`.

The fact it has not been in the above pull request is an oversight.

closes odoo/odoo#90750

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-05-06 17:06:59 +02:00
mafo-odoo 3a6bd727bb [FIX] stock: add translation in dynamic button contain change
Steps to reproduce the issue:

1)Inventory > Configuration > Settings > Activate "Reception Report"
> Activate "Show reception report"
2)Choose a non english language
3)Sales > Choose SO > Delivery > Allocation
4)Click on the Assign/Unassign equivalent in the new language

Current behavior:
The word in the Assign/Unassign button is in english

Expected behavior:
The word in the Assign/Unassign button is in the new language

Explanation:
When clicked the button starts a function in js that changes the
button text context without translating the new text. We also modify
the text in javascript and the problem is solved.

Issue 2:
The button had fixed size specific to the english language, if a longer
translation in another language was used it was cut leading to make it
unuderstanble in some languages (e.g. german).

opw-2827247

closes odoo/odoo#90705

X-original-commit: 260f433f5600e568db59c82a9c2fc807c1204b5f
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Fockedey Martin (mafo) <mafo@odoo.com>
2022-05-06 08:42:10 +02:00
Fabio Barbero 71bcd3bca7 [IMP] digest, *: update digest pictures
Purpose
=======
Update pictures with higher quality, up-to-date equivalent.

Task-2372195

X-original-commit: 476ca7e5abfbe25f7375a426a249da6fb41098cf
Part-of: odoo/odoo#87343
2022-03-29 00:08:59 +02:00
Jorge Pinna Puissant cac3ba62e5 [IMP] test_lint, *: add caughtErrors option to no-unused-vars
All named arguments on the catch block must be used. If for some motive
the named argument on the catch block is not used, its name must begin
with '_'.

closes odoo/odoo#85569

Related: odoo/enterprise#24867
Related: odoo/design-themes#552
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-03-02 13:05:42 +00:00
Jorge Pinna Puissant bc20eb4790 [IMP] test_lint, *: enable no-unused-vars rule
Part-of: odoo/odoo#85569
2022-03-02 13:05:42 +00:00
Fabien Pinckaers 10a5796d4b [IMP] speed up load_menus() by using SVG icons instead of png
Reduces load_menus answer size by 32% (between 20kb and 200kb savings
for the initial loading of the backend, depending on the number of apps
installed). Support for SVG icons in the web client for menus/apps.

Reduced PNG icons for apps list (8 bits PNG instead of 24 as our icons
don't need more colors as they are flat designs)

closes odoo/odoo#84280

Related: odoo/enterprise#24200
Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-02-12 08:55:18 +00:00
+2 318cdcc0b8 [REF] *: adapt code to owl 2
Owl 2 changelog: https://github.com/odoo/owl/blob/a9f29c4caad4f32d06be1ec4780572825781cd9b/CHANGELOG.md

Part-of: odoo/odoo#80156
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
2022-02-10 07:46:13 +00:00
Arnold Moyaux 9ec17ac219 [FIX] stock: Lazy column in multi company
Usecase:
- Install mrp with demo data
- Log in chicago company
- Go to manufacturing list view
-> Access error is raise due to multicompany rule

It happens because the state.res_ids contains all the mrp.production
even in SF company. So it try to read records in the wrong company
and raise the error.

Instead of doing a read, we change that and do a search_read like in the
classic process using the state.domain. So it filter the wrong records
before reading them

X-original-commit: 2077ee3b9312fc511d8fd5d328b5c4e329d9b784
Part-of: odoo/odoo#83430
2022-02-02 16:40:49 +00:00
Touati Djamel (otd) 6578eae4d0 [FIX] stock: add margin to inventory_at_date button
Steps to reproduce:
- go to inventory report
- remove the "Product > Location" Group by filter.

Problem:
The buttons “Inventory at Date” and “Create” are like merged together because there is no margin right

opw-2721995

closes odoo/odoo#83453

X-original-commit: a33e04df672658c8306a1052b1db79f233f8c54c
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-01-31 10:07:30 +00:00
Tiffany Chang (tic) 4bb27c2313 [FIX] stock: correct unassigning moves in reception report
Fixes a couple of things;

1. Backorder use case when unassigning a move in reception report.
To reproduce:

- Create a Delivery w/ Demand = 8 of a stored product not in stock
- Create a Receipt w/ Demand = 10 of the product
- Assign 8 of product to delivery (don't forget to activate Reception
  Report in settings
- Mark 4 of product as done > mark as done > create a backorder
- Open reception report in backorder (shows 6 instead of 4, this is a
  known limitation of reception report) + unassign + close report
- Reopen report + assign 4
- Finish the backorder

Expected result: Delivery has 2 moves totaling a demand and reserved
  amount of 8
Actual result: Delivery has 2 moves where 1 is fully reserved but the
  other isn't and cannot be reserved (even though product in stock).

Issue was due to move split during unassign not taking into account that
the amount being unassigned could be greater than the amount still
assigned (due to backorder amount > demand qty since it doesn't know how
much was done in the original receipt). This would lead to the move
linked to the original receipt's move expecting a greater quantity from
the original move (and therefore not reserving any more quantities.)

2. Trying to unassign from an already done move. (i.e. backordered move
from above unassigned after the delivery is already done) isn't allowed,
so in case of unassigning from a done move, we don't do a split.

3. In case of failure of unassigning, fail gracefully (i.e. don't switch
button status since this is misleading).

Discovered during task: 2662730

closes odoo/odoo#83338

X-original-commit: 3c0c780032ed07da7ec14bdad8df2ff48fc5f4ef
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-01-26 08:48:55 +00:00
Arnold Moyaux 2d1f56381a [FIX] stock(_account): traceback with stock user on forecast report
2 issues:
- When going to the report forecast the value of the stock is computed.
However the stock user should not be able to access the valuations
- Since an access error is return the graph view is not instanciate and
the javascript code try to amend an empty result to the DOM. It results
with a traceback on top of 403 page

closes odoo/odoo#82074

X-original-commit: dbc6b1999ad478d0fdb5774624fd50ca4018be22
Related: odoo/enterprise#23185
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-01-03 10:52:45 +00:00
Nicolas Pierre bec3c58df3 [IMP] stock: Inventory Adjustments improvements
Improvements of the Inventory Adjustements page, among which:
 - Add a new 'Apply All' button (without the need to select a record)
 - Show the date at which the last count was done
 - Add warning icon next to duplicated SN
 - Allows to change the lot_id when empty and no quantities are set

closes odoo/odoo#78361

Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-12-17 10:10:45 +00:00
William Henrotin 6a23b9bcd6 [REF] *stock*: rename model stock.production.lot into stock.lot
Task: 2648449
Part-of: odoo/odoo#80434
2021-12-07 16:20:05 +00:00
Vishal Thacker a317d12d50 [IMP] stock: do not open reserve/unreserve action in new breadcrumb
Before this commit: when reserve/unreserve button were clicked, it was
opening action in new breadcrumb while it should not open new breadcrumb
instead it should display in self.

After this commit: reserve/unreserve button will open action and replace
current action and will not open new breadcrumb everytime we click.

task-2581265

Part-of: odoo/odoo#74695
2021-11-26 15:10:25 +00:00
Martin Trigaux a8e50921af [FIX] *: correct typos and English errors
closes odoo/odoo#80181

X-original-commit: efd178daee689192d4e930a075475587038b3e0d
Related: odoo/enterprise#22439
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-11-22 14:48:04 +00:00
Achraf (abz) 612b705975 [FIX] stock: Don't try to load reports from unselected companies
If we have two companies A and B with B selected and we try to access the Forecast Report via a product, company A's warehouse is automatically selected, which of course creates a security error.

This fix modifies the ´get_warehouses´ method in order to return only the warehouses whose company is selected.

opw-2688135

closes odoo/odoo#80021

X-original-commit: 088e97aa3214578de99abbd47bd6aeccff244855
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
2021-11-18 15:11:26 +00:00
stefanorigano (SRI) d063d99e15 [REF] product, *: update demo-data images
task#2667024

Part-of: odoo/odoo#79651
2021-11-16 13:03:03 +00:00
Tiffany Chang (tic) 9a67190e3e [IMP] stock: improve buttons for reception report
When reception report is viewed in a mobile screen, the "Print Label(s)"
buttons do not fit well, therefore we use a print icon instead of text
when in a mobile view. To ensure it looks good, we also update the
buttons to have equal width/height where applicable.

Part of Task: 2632884

X-original-commit: fadc2dddf12521b0f81096b6225d67951584b714
Part-of: odoo/odoo#79408
2021-11-05 13:48:50 +00:00
Tiffany Chang (tic) 1c97b75c97 [IMP] mrp,stock: always show product in reception report labels
Previously the reception report > "print labels" would only print the
picking name (or SO if provided) + delivery address (if provided) when
not for a MO. Label has been updated to include the product name.

During this update a few other related improvements were made:
- make the label based on stock.move (so extending is no longer
  needed in MRP)
- formatting of label is improved so now address will be truncated
  instead of wrapping (and potentially losing lines at end of address)
- line padding is reduced so we can fit more lines in the label
- "Print Labels" button at source level will now be enabled when its
  corresponding "Assign All" button is pushed (previously only the
  "Print Label"s of each moves' line was enabled.

Part of Task: 2632884

X-original-commit: 9774c1ab1d68cf095b64a82b56f100d747fc8a56
Part-of: odoo/odoo#79408
2021-11-05 13:48:50 +00:00
b63ee52552 [FIX] *: remove scss 'extend' from dropdown components
This commit removes all the 'extend' initially introduced to avoid code
repetition and ensure visual consistency across Bootstrap and Owl dropdowns.

Despite achieving the desired results, using 'extend' in this context
was seriously impacting the bundle generation time, probably due to an
underestimated amount of Apps' legacy-code applied on these elements.

In order to achieve the same results, the chosen strategy is to add
Bootstrap default classes directly into Owl dropdowns.
Also, it moves code related to bootstrap dropdown in 'webclient.scss',
leaving 'core/dropdown/dropdown.scss' for Owl code only.

Due to the discrepancies between Bootstrap and Owl html
structure, the '.dropdown-item' class could not have been added
directly to Owl's '.o_dropdown_item' itself, without refactoring
the Dropdown component structure.

// ==== Bootstrap 4.6 default Structure ================================
<div class="dropdown-menu">
  <button class="dropdown-item" type="button">Action</button>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== OWL default Structure before this commit =======================
<ul class="o_dropdown_menu">
  <li class="o_dropdown_item">
     <span>Action</span>
  </li>
  <li class="o_dropdown_item">
     <a href="#">Another action</a>
  </li>
</ul>

// ==== OWL Structure after this commit ================================
<div class="o-dropdown--menu dropdown-menu">
  <span class="dropdown-item">Action</span>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== web.assets_backend.css Bundle Generation Comparison ============
With all modules installed (enterprise edition over runbot):
Before this commit, bundle took ~2.5s and ~4s to generate and weighted ~322kB (~2.5MB uncompressed)
After this commit, it takes between ~1.2s and ~1.6s and weights ~257kB (~1.6MB uncompressed)

closes odoo/odoo#77649

X-original-commit: 84715436d87bb05b421bc9ccaacda67d07571690
Related: odoo/enterprise#21370
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Stefano Rigano <sri@odoo.com>
Co-authored-by: François Georis <fge@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2021-10-04 07:57:00 +00:00
Rémy Voet (ryv) 9779efa93e [FIX] stock: fix lazy list views
- Avoid traceback when click on priority widget
- Also, fetch directly the lazy column if the web client read one record
(happen when we modify a single record).

closes odoo/odoo#77402

X-original-commit: eb26406cff7a0c61768c287a0525c2b6bc123f9e
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-09-29 13:39:56 +00:00
Rémy Voet (ryv) ac14fd4819 [IMP] stock,mrp: add lazy column in tree view
It allows to read some fields (slow computation) after the render
of the list without blocking the UI.

task-2579011

Part-of: odoo/odoo#77092
2021-09-24 14:00:23 +00:00
Lucas Perais (lpe) 56dda82a5f [REF] web, *: legacy: lazy loading of legacy reporting views
Since commit 0134495ba5 the reporting
views pivot, graph, cohort are written in full new framework.

Some applications still need the legacy ones, so this commit just implements
the lazy loading of those views.

In stock, report_stock_forecasted has been adapted in order to avoid having
a GraphView override: we now modify the canvas' height in pure JS.

*: board, stock

closes odoo/odoo#76931

Related: odoo/enterprise#21054
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-22 12:22:46 +00:00
Arnold Moyaux 0e2c4becf2 [FIX] stock: avoid breaking global scss for thead
commit bc1a6faa51fef60bb64ea09f4e43f1120f9855bd add a rule to fix
tracability report but on a global level. However we won't this behavior
everywhere in odoo or at least if it's the case it shouldn't be specify
there

closes odoo/odoo#76713

X-original-commit: f96c78f701831ed7aa1798765e3e5f81d1a689c1
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-09-20 10:53:56 +00:00
Nasreddin Boulif (bon) 6d20d54479 [FIX] stock: Display only one table header in traceability report
Steps to reproduce:

  - Install Manufacturing module
  - Go to Manufacturing -> Operations -> Manufacturing Orders
  - Create a new one and add at least 10 product components
  - Move it to Done stage
  - Click on stat button Traceability
  - Unfold the components
  - Print report

Issue:

  Table header on 2nd page overlap table content.

Cause:

  Wkhtmltopdf does not handle well table on multiple pages.
  More info here: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2367

Solution:

  Do not duplicate table header on next pages.

opw-2634492

closes odoo/odoo#76535

X-original-commit: 8cc791e2de0f708ff7d69574cc8a8a40ef61c02b
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-09-14 23:38:52 +00:00
242b1caa65 [IMP] web,*: new GraphView component
*hr_timesheet,project,stock

Part-of: odoo/odoo#73311
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: Stefano Rigano <sri@odoo.com>
2021-09-07 10:04:38 +00:00
Tiffany Chang (tic) 53cc41016f [IMP] mrp, product, {purchase_, sale_}stock{_picking_batch}: add reception report
New reception report added for non-outgoing transfers. This is intended
to support easier stock allocations by allowing dynamic MTO
assignment/unassignment, e.g. if we have an incoming transfer with
products we want to assign to an existing outgoing transfer, then we can
use the report to create a MTO link to the specific outgoing moves. To
support this assignment flow, the report also allows printing of labels
to place on the product so stock workers know which transfer/MO the
product has been assigned to.

Expected use case is when a product is purchased to fulfil a sale.
Demo data has been added so reception report can be immediately
seen/used for this flow.

Implementation Notes:
- Report has been made flexible to work with batch transfers.
- Only done moves can be assigned to moves that already have quants
  reserved (prevents undesired behavior + this makes sense logically)
- Confirmed (+ Done and everything inbetween) moves can be assigned to
  any confirmed moves that are not already assigned.
- Report does not affect quant reservation/unreservation at all. It
  works only with linking moves (i.e. move_orig_id/move_dest_id) so
  move/transfer linkage traceability is stored within db (i.e. this
  isn't possible with quants)

Limitations: To keep code simple for now, this assignment flow will
  break in certain cases:
1. Done amount of an assigned move is less than the Demand amount
   (linked move will not autoreserve correctly when assigned move is
   validated, same issue already occurs in multi-step transfer).
2. If a linked move is unreserved after its assigned move is
   validated, then another move can reserve its quants and its
   assignment link will not be accurate.
3. Already reserved SNs + assign move, may lead to mismatching SNs
   between report and what's actually reserved.
4. Changing a linked move's Demand amount after a move is assigned to
   it.
5. Potential moves to assign to are only checked for being in same
   warehouse, not in a matching source location to destination location.
   User is expected to make this match on their own.

Task: 2500844
ENT PR: odoo/enterprise#18268
Upgrade PR: odoo/upgrade#2731

closes odoo/odoo#70669

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-08-17 11:42:23 +00:00
Martin Trigaux c6be07e893 [FIX] stock: lazy loading of translation
The term was untranslated
Export missing stock terms

Forward-port of fb0383f8c1d4ef5817cf67

closes odoo/odoo#75155

X-original-commit: 4a0d1dfd2b48ecad107a687093ac34a3b0d67d60
Related: odoo/enterprise#20247
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-08-16 13:11:30 +00:00
Quentin Wolfs e2f59a6dd1 [IMP] stock: traceability report origin
Add reference of the traceability report's origin (production.lot,
manufacturing order, picking, ...) to the end of the
report.
Change the layout a bit so the data isn't squashed by
the border.

Task-2467686

closes odoo/odoo#74120

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-08-16 08:14:09 +00:00
Xavier Morel 5ff6faa67f [FIX] mrp, stock, purchase_stock: d-t-raw-ify leadDaysPopOver
And convert the `t-esc` in the template to `t-out` while at it.

So this was a bit of a bummer initially, the PopoverWidgetField gets a
pile of JSON as its value (so from the server), and that pile contains
a template name (optionally) and... the template context,
basically. For leadDaysPopOver the issue was some of that context is
supposed to be rendered HTML to straight inject into the template,
marking that as HTML-safe would be a bit of an issue (having the JSON
specify which parts of the value it returns are HTML-safe being a bit
of a conflict of interest).

However turns out the thing is way over-complicated and
over-engineered: `lead_days_description` necessarily has a very
regular structure owing to being injected as a set of table rows, so
the various overrides to `_get_lead_days` just make their own lives
complicated by formatting the values they want to return into table
rows matching the format of an unrelated template.

Instead we can change the signature of `_get_lead_days` so the
"description" is a list of values to inject in the table (list of
pairs, each pair matching the corresponding columns of the table). The
template can then take care of formatting those values into table rows
the usual way, removing the need for any injection of raw content.

This also makes for better / clearer translation strings.
2021-07-20 05:41:35 +00:00
Arnold Moyaux 6eaa4a2ae3 [IMP] (purchase_)stock: suppliers information in replenishment
Infobox to help the user with the replenishment. Allow those actions:
- See the different supplier with their lead time, price and quantity
- Be able to select a supplier and set it on the orderpoint
⁻ See the last delivery by mmonth for the product
- Last purchase date for each supplier

Technicaly it use a wizard and a fields char with JSON used by
a widget to display a static template. Also it creates directly
the wizard in backend instead of just let the view manage the new
object since we need a button on a one2many and if the records do
not have an id, it's not possilbe to use it.

closes odoo/odoo#72039

Task: 2519761
Related: odoo/upgrade#2596
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-06-29 07:41:12 +00:00
stefanorigano (SRI) 1fb2cd9af7 [FIX] web, *: drop o_dropdown_toggler_btnclasses
Drop `o_dropdown_toggler_btn` class in favor of `o_dropdown_toggler`.
o_dropdown_toggler_btn was initially introduced in ~13.3, but it's now
obsolete.
2021-06-18 21:31:32 +02:00
Aaron Bohy a5091fee99 [REF] *: rework webclient test helpers
This commit splits the 'getActionManagerTestConfig' helper into 2:
'setupWebClientServiceRegistry' and 'getActionManagerServerData'.

The first one is now automatically called by the 'createWebClient'
helper, as it properly setups the service registry with all services
required by the WebClient component.

The second one generates a few data (menus, actions, views...) that
can be used in tests. That helper is mainly useful for action tests
(formerly ActionManager tests) in web. With this refactoring, they
are no longer generated for each test in the whole codebase that
spawns a webclient, as before this commit.

closes odoo-dev/odoo#906

Related: odoo-dev/enterprise#161
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:30 +02:00