Skip to main content
iVentureTeam

pol_product_many2one

The product field on a purchase order line. Pick a product with one variant and it fills in; pick one with several and a grid opens.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
August 27, 2026Updated August 28, 20264 min read
Technical namepol_product_many2one
Field typesmany2one
Viewsform, list
Modulepurchase_product_matrix, the Purchase app
Used in coreThe product field on purchase order lines
VersionsOdoo 20.0, Odoo 19.0
No-code setupNo. It is set in view XML and depends on module-specific data
Alternativesmany2one, many2one_barcode, sol_product_many2one, sol_product_many2one

What the purchase line product does

Buying a product that comes in sizes and colors is a different task from buying one that does not. On a purchase order, entering twelve variants as twelve lines is slow and error prone, and a grid is the obvious answer.

This widget decides which of the two situations you are in. On selecting a product it asks the server whether that product resolves to a single variant. If it does, the line is filled and you carry on.

If it does not, the grid configurator opens instead, quantities are entered per variant, and the lines are generated from the grid.

What this means for your team

Purchasing teams that deal in apparel, hardware or anything else with a size and color axis lose real time to variant entry, and the errors it produces surface later as receiving discrepancies. A matrix is one of the highest-return configurations in Odoo Purchase for those businesses.

The thing to check is that the variant structure actually matches how you buy. A matrix on the wrong two attributes is worse than no matrix, because it makes the wrong entry the fastest one.

Supported options in Odoo 19

The widget declares no options of its own and inherits the many-to-one field's descriptor, so its options continue to work. Its behavior is the variant check described below. Read from the purchase line product source, Odoo 19.0.

OptionTypeWhat it does
no_createbooleanInherited from the many-to-one field. Removes both creation paths from the dropdown.(default: false)
no_openbooleanInherited. Stops the internal link opening the product.(default: false)
the single variant callserver methodDecides whether the line is filled directly or the grid configurator opens.(since Odoo 19.0)

The variant count comes from the server. The widget calls a method to resolve the single variant rather than counting anything in the browser, which is what makes it correct when variants are restricted by attribute rules.

Working examples

The usual usage

<field name="product_template_id"
       widget="pol_product_many2one"/>

The field is the template; the widget resolves it to a variant or opens the grid.

What the server is asked

get_single_product_variant()
# returns a variant id when there is exactly one
# otherwise the grid configurator opens

The browser never counts variants itself.

Without the matrix

<field name="product_id" widget="many2one"/>

One variant per line, entered by hand.

Asking the server how many variants there are

The interesting part is where the decision is made. Selecting a product triggers a server call asking whether that template resolves to a single variant, and the answer drives everything after.

Doing that server side rather than counting variants in the browser is what makes it correct in the awkward cases. Attribute exclusion rules can reduce a template with three attributes to a single sellable variant, and only the server knows that.

When the answer is a single variant, the widget sets it and the line behaves like any other. When it is not, the grid opens and the quantities entered there generate the lines rather than the field setting one.

Everything else, the dropdown, the search, the creation paths, is inherited from the many-to-one field unchanged, which is why the file is short.

Version compatibility

VersionStatusNotes
Odoo 20.0In developmentNot released. Byte-identical to Odoo 19 on the development branch.
Odoo 19.0VerifiedFirst version. Verified against the shipped source.
Odoo 18.0Not availableWidget does not exist under this name.
Odoo 17.0Not availableWidget does not exist under this name.
Odoo 16.0Not availableWidget does not exist under this name.

Upgrade note. The widget is new in Odoo 19. On earlier versions the matrix was triggered differently on purchase lines, so an upgrade picks up the new behavior with the standard views and nothing needs migrating.

What is changing in Odoo 20

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. The development branch is unstable and this may still change; we re-verify this page after the release.

Byte-identical. The file on the development branch matches Odoo 19 exactly, including the single variant call.

Common problems and fixes

SymptomCause and fix
The grid never opensEvery product chosen resolves to a single variant. Expected. Check the product actually has several sellable variants.
The grid opens for a product with one variantAttribute values exist that create more than one variant even if only one is used. Archive the unused variants or restrict the attribute values.
Quantities entered in the grid do not appearThe dialog was closed without confirming. Confirm the grid; the lines are generated on confirmation.
Missing widget errorThe purchase product matrix module is not installed. Install it, or use a plain many-to-one on the variant field.
A many-to-one option is ignoredIt should not be; the descriptor is inherited. Check the option spelling against the many-to-one field.
It behaves differently on sales ordersThat side has its own widget. Expected; the two are separate implementations.

Purchase line product vs the alternatives

WidgetBest forKey difference
pol_product_many2oneThe product field on purchase lines where products have variantsAsks the server whether the product is a single variant, and opens a grid when it is not
many2oneAny relation to one recordNo variant handling
many2one_barcodePicking a product by scanningA scanner rather than a matrix
sol_product_many2oneProducts on sales order linesThe sales side equivalent of the same idea
sol_product_many2oneProducts on sales order linesSame idea on the sales side

A plain many-to-one on the variant field is right where products have no meaningful variant axis, and it is one less module to install. The sales side has its own equivalent for order lines.

Frequently asked questions

When does the grid open?+
When the chosen product does not resolve to a single variant. The widget asks the server rather than counting in the browser, which is what makes it correct when attribute rules restrict the combinations.
What if the product has one variant?+
It is set on the line directly and nothing else happens, so simple products behave exactly like a normal product field.
Does it support options?+
None of its own, but it inherits the many-to-one field's descriptor, so those options continue to work.
Is there a sales equivalent?+
Yes, the sales side has its own widget for order lines. The two are separate implementations of the same idea.
Which versions have it?+
Odoo 19 onwards under this name, and byte-identical on the Odoo 20 development branch.

Purchasing that keeps up with your catalog

Variant matrices, vendor pricelists and reordering rules decide whether buying is a morning or a minute. We configure Odoo Purchase around your actual catalog, on versions 16 through 19.

Book a free consultation

How this page was produced

The single variant server call, the branch into the grid configurator and the inherited many-to-one descriptor were read from the purchase line product source on the Odoo 19.0 branch. Version coverage comes from the absence of the file on 16.0, 17.0 and 18.0, and a byte comparison against the public development branch. Spotted an error? Tell us and we will correct the page.