[16.0][IMP] pos_product_quick_info: The following improvements have been made: - #1440
[16.0][IMP] pos_product_quick_info: The following improvements have been made:#1440atgalvez08 wants to merge 1 commit into
Conversation
7a17645 to
da54977
Compare
rrebollo
left a comment
There was a problem hiding this comment.
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.
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.
@atgalvez08 you can rebase to try triggering the tests
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
3f47a6b to
cd2194a
Compare
christian-ramos-tecnativa
left a comment
There was a problem hiding this comment.
There is a pos_product_quick_info.zip file in the PR changes, can you remove it?
cd2194a to
69ce53c
Compare
Done, .zip file deleted |
69ce53c to
b90d477
Compare
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
b90d477 to
a182289
Compare
- 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.
a182289 to
1bfbca5
Compare

@BinhexTeam