Skip to main content
Odoo Community Association

MRP BoM Line formula for quantity

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runboat

Compute the quantity of a Production Line using a formula defined in the BoM Line.

Table of contents

Configuration

In any BoM line, fill the Quantity Formula field.

The following values are available:

  • `bom_line`: the current BoM line,

  • `production`: the production order being created,

  • `product`: the Product of current BoM line,

  • `product_uom_qty`: the quantity of the production order line,

  • `product_uom`: the UoM of the Product of current BoM line,

  • `operation`: the operation where the components are consumed for current BoM line,

The computed quantity must be assigned to the quantity variable.

Usage

This module can be used to customize the quantity of a component based on a custom attribute value selected on the product. The following configuration works when the website_sale module is installed.

In order to do that, configure as follows:

  1. Create an attribute “Component quantity” with a custom value

    image

  2. Create and publish a Product having the configured custom value, and the MTO route (archived by default)

    image1

  3. Add a BoM to the product, where one Component has the following formula for the quantity:

    image2

    sale_lines = production.move_dest_ids.sale_line_id
    produced_template = production.product_tmpl_id
    produced_template_sale_line = sale_lines.filtered(lambda l: l.product_template_id == produced_template)
    custom_attributes_values = produced_template_sale_line.product_custom_attribute_value_ids.with_context(lang=None)
    component_quantity_attribute_value = custom_attributes_values.filtered(
        lambda av: av.custom_product_template_attribute_value_id.attribute_id.name == "Component quantity"
    )
    component_quantity = component_quantity_attribute_value.custom_value
    quantity = int(component_quantity)
  4. In the e-commerce, select a quantity for the custom value and buy the product

    image3

  5. Confirm the sale order

    image4

a Production order with the selected value of Component will be created

image5

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Aion Tech

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

SirAionTech

This module is part of the OCA/manufacture project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Metadata

Release files for odoo-addon-mrp-bom-line-formula-quantity 18.0.1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo-addon-mrp-bom-line-formula-quantity 18.0.1.1.0
File Interpreter ABI Platform
odoo_addon_mrp_bom_line_formula_quantity-18.0.1.1.0-py3-none-any.whl Python 3 none any Details

Release files / odoo_addon_mrp_bom_line_formula_quantity-18.0.1.1.0-py3-none-any.whl

Download URL odoo_addon_mrp_bom_line_formula_quantity-18.0.1.1.0-py3-none-any.whl
Size 365.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2a36f7b61f8f5a5a47a3d44a1122afce68e73e1f1a7b3baf4aa99bb52071508
BLAKE2b-256 checksum
How to use checksums
507bb2d11a1ac3eb5db32e562cbda506df333ae166014f94f3c0dc3cfd903f79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page