Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] stock_by_warehouse: Migration to 17.0 T#79454 #1637

Merged
merged 28 commits into from
Apr 4, 2024

Conversation

xmglord
Copy link
Contributor

@xmglord xmglord commented Mar 4, 2024

  • Simplify the way to define modifiers as states, required, readonly,
    invisible and column_invisible as part of [1].
  • Remove owl="1" from OWL templates, as it's not needed anymore as all
    of them are OWL now as part of [2].
  • Change qty_done to quantity and picked = True as part of [3].

[1] odoo/odoo#104741
[2] odoo/odoo#130467
[3] odoo/odoo#137864

@xmglord
Copy link
Contributor Author

xmglord commented Mar 4, 2024

@luisg123v please review.

@xmglord xmglord force-pushed the 17.0-mig_to_17.0-xmglord branch from 09692f3 to 982926f Compare March 4, 2024 21:05
@luisg123v luisg123v self-requested a review March 6, 2024 18:07
@luisg123v
Copy link
Contributor

Missing task ID on PR's title.

@luisg123v luisg123v changed the title [MIG] stock_by_warehouse: Migration to 17.0 [MIG] stock_by_warehouse: Migration to 17.0 T#79454 Mar 12, 2024
@luisg123v luisg123v force-pushed the 17.0-mig_to_17.0-xmglord branch from 982926f to 228e1d2 Compare March 12, 2024 01:35
Copy link
Contributor

@luisg123v luisg123v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is red.

hugho-ad and others added 23 commits March 14, 2024 00:42
…uxoo#1333)

amounts in order to allow js made correct comparations

Before:
"1,896.00" > 0 === false
"896.00" >0 === true

After:
1896.00 > 0 === true
896.00 >0 === true
We need avoid using compute fields as possible because of the following issue:
 - odoo/odoo#30578
warehouses_stock is a computed field used just one time but re-computed too many times:
 - Opening sale order (one time by each line)
 - Saving sale order
 - Choosing a product_id
And it computation is more and more slow when the database grows.
It is making a big overhead saving sale.order.

With this change we have the same behaviour using it just for onchange
product_id or forcing from a seudo-button (field boolean)
A real button is not used since that it requires save the record to work

Using the technical of fields with store=False and onchange methods

Check more details from Vauxoo#1358
…fix duplicated quantity from quants (Vauxoo#1364)

* [FIX] stock_by_warehouse: Using self._origin from top of methods

* [FIX] stock_by_warehouse: Fixing sum quants for serial product
NOTE: This code is so ugly, and I don't improvement this part.
The following is performed:
- Remove useless test that actually did nothing
- Remove data tags from views
- Move assets to a separated file
- Fix JS
- Remove encoding headers from Python files
- Split product template and product variant code into two files
- Fix typos on the README
A file in /stock_by_warehouse/models was named without the extension, so
cannot be used/imported.

The extension was just added.
Available quantities were being retrieved not only for the exact
location, but also for their child locations. That caused some product
to be double-counted when computing quantities.
This commit fixes the above.
Adding a new section for the widget `warehouse` that will depend on an
option called `by_location`, if is set to True it will allow the user
to find all the locations where the product (`product.product`) is
available, and the quantity that is in stock.
The widget it will allow the user to see the locations and its
quantity for each warehouse.
And updating the image for the widget by warehouse on the README file.
When there is no available location for a warehouse the set of
the most quantity location was giving an error, now if there is no
location available a zero will be set indicating it.
Separating the obtain of the locations and their available quantities by
warehouse, so the compute `_compute_get_stock_location` is less
complicated, also, this information can be used from other methods.
Because we are using `sudo()` we need to make the method called
`get_qty_per_location` private.
The following is performed:
- Remove decimal precision in float fields
- Remove all the decorators @api.multi
- Added @api.depends_context in non-stored computer methods, which
  use context in calls and its super method also uses it
When migration of this module was performed from 12.0 to 13.0 (Vauxoo#1460),
some sudo's were removed because we considered them no longer required.
However, they actually are, in case there are record rules defined for
the warehouse model. Even if the current user doesn't have enough access
to see some warehouses, they need to know if there's available stock
elsewhere.
- Scrollbar fixed on the stock_by_warehouse_sale widget creating and adding
  the class .stock-by-warehouse-widget to the scss file and the template.xml:
  When there was several warehouses for a product, the widget wasn't working
  correctly and was not showing the scrollbar to check the full list of the
  stock.
This just a commit to fix indentation on the code
The issue was that the action_confirm takes 2 units of product immediately before action_assign.
On v14.0 the products were taken from picking after action_assign. Using action_confirm and
action_assign consecutively mantains the original behaviour from the test. This explained behaviour
is due to stock.move changes where this model handles action_assign when action_confirm is
executed. Functionality is preserved, but the change in the unittest is necessary to follow new
behaviour.

References:
odoo/odoo@a838f2a,
https://github.com/odoo/odoo/blob/14.0/addons/stock/models/stock_move.py#L1169
https://github.com/odoo/odoo/blob/15.0/addons/stock/models/stock_move.py#L1239
rolandojduartem and others added 4 commits March 14, 2024 00:42
Minor changes are applied to the code to 16.0, but also, the widget
'warehouse' is migrated to OWL.
…products

This functionality is for storable products to show the information in
the warehouses, now this field is invisible for products which are not
storable products.
Resolved an issue where multiple locations displayed incorrect stock
information due to problematic contexts. By eliminating the cache, we
now ensure accurate computation of quantity Units for products.

Closes Vauxoo#1633
@xmglord xmglord force-pushed the 17.0-mig_to_17.0-xmglord branch 4 times, most recently from 318e3cc to 854340b Compare March 14, 2024 08:22
@xmglord
Copy link
Contributor Author

xmglord commented Mar 14, 2024

@luisg123v please review, comments applied and CI is green.

@luisg123v
Copy link
Contributor

FYI @xmglord you can click the "Re-request review" button.

@xmglord xmglord requested a review from luisg123v March 15, 2024 03:13
@xmglord xmglord force-pushed the 17.0-mig_to_17.0-xmglord branch 3 times, most recently from 7b732e2 to b367eb2 Compare April 1, 2024 20:32
@xmglord xmglord requested a review from luisg123v April 1, 2024 20:40
@xmglord xmglord force-pushed the 17.0-mig_to_17.0-xmglord branch from b367eb2 to 75f4978 Compare April 3, 2024 12:17
@xmglord xmglord requested a review from luisg123v April 3, 2024 12:26
@luisg123v luisg123v removed their request for review April 3, 2024 23:01
@xmglord xmglord force-pushed the 17.0-mig_to_17.0-xmglord branch from 75f4978 to e3bb94f Compare April 4, 2024 12:57
- Simplify the way to define modifiers as states, required, readonly,
  invisible and column_invisible as part of [1].
- Remove owl="1" from OWL templates, as it's not needed anymore as all
  of them are OWL now as part of [2].
- Change qty_done to quantity and picked = True as part of [3].
- Adapt use of read_group to _read_group as part of [4].

[1] odoo/odoo#104741
[2] odoo/odoo#130467
[3] odoo/odoo#137864
[4] odoo/odoo#110737
@xmglord xmglord force-pushed the 17.0-mig_to_17.0-xmglord branch from e3bb94f to 3a9ad7b Compare April 4, 2024 12:58
@xmglord xmglord requested a review from luisg123v April 4, 2024 12:58
Copy link
Contributor

@luisg123v luisg123v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@luisg123v luisg123v merged commit d445333 into Vauxoo:17.0 Apr 4, 2024
3 checks passed
@luisg123v luisg123v deleted the 17.0-mig_to_17.0-xmglord branch April 4, 2024 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.