Skip to content

[FIX] product_customerinfo_picking: support variant-level customer info - #2284

Closed
weinni2000 wants to merge 1 commit into
OCA:18.0from
weinni2000:18.0-fix-product-customerinfo-variant
Closed

[FIX] product_customerinfo_picking: support variant-level customer info#2284
weinni2000 wants to merge 1 commit into
OCA:18.0from
weinni2000:18.0-fix-product-customerinfo-variant

Conversation

@weinni2000

Copy link
Copy Markdown

Problem

The _compute_product_customer_code method on stock.move only looked up
customer info at the product template level (product_tmpl_id.customer_ids).
It ignored product.customerinfo records linked to a specific product variant
(variant_customer_ids), so the customer reference/name was never filled for
variant-specific entries.

Additionally, the guard condition checked product_tmpl_id.customer_ids while
the @api.depends tracked product_id.customer_ids, causing a mismatch.

Fix

  • Guard condition: check product_id.customer_ids (consistent with @api.depends)
  • Template-level lookup: add product_tmpl_id filter to avoid cross-template matches
  • Variant-level lookup: after the template-level result, look up
    variant_customer_ids filtered by partner and product variant; if found,
    override the template-level values so variant-specific info takes precedence

Test scenario

  1. Create a product with variants (e.g. colour A, colour B)
  2. Add a customer reference on the template level and a different one on a
    specific variant
  3. Create a delivery order for that variant
  4. Verify the stock move shows the variant-level customer reference,
    not the template-level one

🤖 Generated with Claude Code

- Check `product_id.customer_ids` instead of `product_tmpl_id.customer_ids`
  in the guard condition to correctly reflect variant-level records
- Add `product_tmpl_id` filter to template-level lookup to avoid
  cross-template false matches
- Look up `variant_customer_ids` after template-level and let it override,
  so variant-specific customerinfo takes precedence over template-level

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@weinni2000
weinni2000 force-pushed the 18.0-fix-product-customerinfo-variant branch from 0830d08 to 14da444 Compare March 19, 2026 14:17
@weinni2000

Copy link
Copy Markdown
Author

@it-fact4lifetimesupport:
Can you review it?

@JordiMForgeFlow

Copy link
Copy Markdown
Contributor

@weinni2000 I have opened PR #2413 where I actually use the search method from the base product_customerinfo module. This already considers the variants.

@weinni2000 weinni2000 closed this Jul 27, 2026
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.

2 participants