Skip to content

[19.0][ADD] ai_sale_product_matcher: find best-matched PIM products from requirement docs/images using AI - #106

Open
volkantasci wants to merge 7 commits into
OCA:19.0from
volkantasci:19.0-add-ai-sale-product-matcher
Open

volkantasci wants to merge 7 commits into
OCA:19.0from
volkantasci:19.0-add-ai-sale-product-matcher

Conversation

@volkantasci

Copy link
Copy Markdown

Adds ai_sale_product_matcher — find best-matched PIM products from requirement docs/images using a vision LLM.

What it does

Upload a spec sheet, email screenshot or type requirements (e.g. "120 bar soğuk sulu, monofaze, 2.3kW, deterjan tanklı") — the module extracts a canonical requirements JSON using the same ai_connection openai_compatible vision pipeline as ai_document_extraction (only prompts differ), then scores all product.template records against the PIM attribute catalog (katalog-sablonu.json → 232 keys) with type-aware matching (range, tolerance, fuzzy, directional en az/en fazla) and weighted groups. Top 10 matches are shown on the Sale Order with match % and can be added as order lines.

Sales integration: sale.order → Find Products with AI wizard (file + text → Extract → editable JSON → Find Matches → Add to Order). Extraction runs via queue_job + bus so UI never blocks.

Key features:

  • Vision LLM extraction (PDF/image with pdf2image/Pillow preprocessing, multi-page support, live PIM key set in prompt, English prompts sector-independent)
  • Type-aware product matching (exact/range/tolerance + missing-neutral scoring, Brand/Category optional filter)
  • Ranked results (matched count first, then weighted % — ideal product is top)
  • Async via queue_job + bus (non-blocking wizard)
  • Full queue_job/bus/ai_connection deps, ACL, i18n (TR), tests

Technical notes

  • Depends on sale, product, bus, queue_job, ai_connection, ai_tool (same stack as ai_document_extraction).
  • Uses ai_connection OpenAI-compatible client; prompts filtered to non-null keys to avoid truncation/401.
  • Tests mock LLM at service boundary (test_product_matcher, test_requirement_extractor).
  • Follows OCA 19.0 scaffolding (readme fragments, ir.model.access.csv, AGPL-3).

cc @OCA/ai-maintainers

@oca-cla-bot

oca-cla-bot Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@volkantasci

Copy link
Copy Markdown
Author

All pre-commit checks are now green (prettier, eslint, ruff, ruff-format, pylint-odoo mandatory, OCA po/module checks):

  • XML views, JS and readme formatted with the repo's prettier config
  • JS asset renamed to sale_order_ai_matcher.esm.js so eslint parses it as a module
  • Repo-wide .ruff.toml per-file ignores removed: long lines wrapped, _validate_requirements split into per-type coercion helpers (behavior verified identical), swallowed exceptions now logged, redundant field strings dropped
  • Removed a machine-specific fallback path from catalog_schema.py
  • .pot regenerated from Odoo 19 and tr.po deduplicated/msgmerged; requirements.txt added

Module tests run locally (Odoo 19, scratch DB with ai_connection, ai_tool, queue_job installed): 12/12 pass, 0 failures.

The tests workflow remains red only because odoo-addon-ai_connection==19.0.* / odoo-addon-ai_tool==19.0.* are not on the wheelhouse yet — they will be published when #100 merges, after which I will rebase this PR.

@volkantasci

Copy link
Copy Markdown
Author

Note: the base dependency PR #100 was restructured per the OCA migration guidelines into #110 (ai_tool) and #111 (ai_connection). The tests/runboat failures here remain blocked on those wheels being published, after which I will rebase.

@volkantasci

Copy link
Copy Markdown
Author

Update on the dependency chain: ai_tool was migrated to 19.0 and merged via #101 (its 19.0 wheel is already published). The remaining dependency is the ai_connection migration, now open as #111 (fully green: pre-commit, Odoo/OCB tests, codecov, runboat). Once #111 merges I will rebase this PR.

@etobella

This comment was marked as off-topic.

@volkantasci
volkantasci force-pushed the 19.0-add-ai-sale-product-matcher branch from 4dcb263 to d2b08d0 Compare October 6, 2026 20:51
@volkantasci

Copy link
Copy Markdown
Author

Rebased onto the latest 19.0 (commit d2b08d0, now includes the repo template updates) — pre-commit and the static checks are green.

The Odoo/OCB test jobs still fail for the same reason, at dependency installation:

ERROR: Could not find a version that satisfies the requirement odoo-addon-ai_connection==19.0.*

ai_connection 19.0 is not on PyPI yet — it gets resolved once #111 is merged, and I'll re-run the tests right after. @etobella

@volkantasci
volkantasci force-pushed the 19.0-add-ai-sale-product-matcher branch 2 times, most recently from 489b575 to 375530e Compare October 26, 2026 12:58
@OCA-git-bot OCA-git-bot added the mod:ai_connection Module ai_connection label Oct 26, 2026
@volkantasci
volkantasci force-pushed the 19.0-add-ai-sale-product-matcher branch 5 times, most recently from afc6b15 to a6000c0 Compare October 26, 2026 13:56
@volkantasci
volkantasci force-pushed the 19.0-add-ai-sale-product-matcher branch from a6000c0 to 1528ce1 Compare October 26, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:ai_connection Module ai_connection mod:ai_sale_product_matcher Module ai_sale_product_matcher series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants