-
-
Notifications
You must be signed in to change notification settings - Fork 671
[16.0][IMP] pos_product_quick_info: The following improvements have been made: #1440
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
base: 16.0
Are you sure you want to change the base?
Conversation
atgalvez08
commented
Sep 29, 2025
- The sales description is displayed in the information pop-up.
- The locations within the warehouse where the product is available are displayed.
- Variants with the same attribute are grouped together to prevent duplicate attribute errors.
| class ProductProduct(models.Model): | ||
| _inherit = 'product.product' | ||
|
|
||
| display_quick_product_info = fields.Boolean(default=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this field is not used
pos_product_quick_info/static/src/xml/Popups/ProductInfoPopup.xml
Outdated
Show resolved
Hide resolved
- The sales description is displayed in the information pop-up. - The locations within the warehouse where the product is available are displayed. - Variants with the same attribute are grouped together to prevent duplicate attribute errors.
7a17645 to
da54977
Compare
rrebollo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review: Great work! The code looks good to me (LGTM). Thank you for your contribution! I've provided a few suggestions for your consideration—feel free to address them as you see fit.
| quants = quant_obj.read_group( | ||
| domain=[ | ||
| ('product_id', '=', product.id), | ||
| ('location_id', 'in', location_ids), | ||
| ], | ||
| fields=['quantity', 'location_id'], | ||
| groupby=['location_id'], | ||
| ) | ||
|
|
||
| # Future incoming and outgoing movements | ||
| incoming_moves = move_obj.read_group( | ||
| domain=[ | ||
| ('product_id', '=', product.id), | ||
| ('location_dest_id', 'in', location_ids), | ||
| ('state', 'in', ['confirmed', 'waiting', 'assigned']), | ||
| ], | ||
| fields=['product_uom_qty', 'location_dest_id'], | ||
| groupby=['location_dest_id'], | ||
| ) | ||
|
|
||
| outgoing_moves = move_obj.read_group( | ||
| domain=[ | ||
| ('product_id', '=', product.id), | ||
| ('location_id', 'in', location_ids), | ||
| ('state', 'in', ['confirmed', 'waiting', 'assigned']), | ||
| ], | ||
| fields=['product_uom_qty', 'location_id'], | ||
| groupby=['location_id'], | ||
| ) | ||
|
|
||
| # Index quantities by location | ||
| available_by_location = { | ||
| q['location_id'][0]: q['quantity'] for q in quants | ||
| } | ||
| incoming_by_location = { | ||
| m['location_dest_id'][0]: m['product_uom_qty'] for m in incoming_moves | ||
| } | ||
| outgoing_by_location = { | ||
| m['location_id'][0]: m['product_uom_qty'] for m in outgoing_moves | ||
| } | ||
|
|
||
| # Build list of locations | ||
| location_list = [] | ||
| for loc in internal_locations: | ||
| loc_id = loc.id | ||
| available = available_by_location.get(loc_id, 0.0) | ||
| incoming = incoming_by_location.get(loc_id, 0.0) | ||
| outgoing = outgoing_by_location.get(loc_id, 0.0) | ||
| forecasted = available + incoming - outgoing | ||
|
|
||
| # SOnly show relevant locations (if any exist) | ||
| if available or incoming or outgoing: | ||
| location_list.append({ | ||
| 'name': loc.display_name, | ||
| 'available_quantity': available, | ||
| 'forecasted_quantity': forecasted, | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, I suggest exploring some built-in resources related to the stock by location request. For example:
https://github.com/odoo/odoo/blob/85073d10a9f4b5a74d31adcba815651d6f217dbf/addons/stock/models/product.py#L136
|
I’m not sure why, but the only check that ran for this PR was Runboat. I haven’t seen anything like this before. |
christian-ramos-tecnativa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@atgalvez08 you can rebase to try triggering the tests