Skip to content

Conversation

@atgalvez08
Copy link

  • 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.

@atgalvez08 atgalvez08 changed the title [IMP] pos_product_quick_info: The following improvements have been made: [16.0][IMP] pos_product_quick_info: The following improvements have been made: Sep 29, 2025
class ProductProduct(models.Model):
_inherit = 'product.product'

display_quick_product_info = fields.Boolean(default=True)

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

- 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.
@atgalvez08 atgalvez08 force-pushed the 16.0-IMP-pos_product_quick_info branch from 7a17645 to da54977 Compare October 1, 2025 14:19
@atgalvez08 atgalvez08 marked this pull request as ready for review October 16, 2025 10:57
Copy link

@rrebollo rrebollo left a 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.

Comment on lines +61 to +117
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,
})

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

@rrebollo
Copy link

I’m not sure why, but the only check that ran for this PR was Runboat. I haven’t seen anything like this before.

Copy link

@christian-ramos-tecnativa christian-ramos-tecnativa left a 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

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.

3 participants