Compute the quantity of a Production Line using a formula in the BoM Line.
Project description
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:
Create an attribute “Component quantity” with a custom value
Create and publish a Product having the configured custom value, and the MTO route (archived by default)
Add a BoM to the product, where one Component has the following formula for the quantity:
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)
In the e-commerce, select a quantity for the custom value and buy the product
Confirm the sale order
a Production order with the selected value of Component will be created
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
Maintainers
This module is maintained by the OCA.
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:
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file odoo_addon_mrp_bom_line_formula_quantity-16.0.1.0.0.2-py3-none-any.whl
.
File metadata
- Download URL: odoo_addon_mrp_bom_line_formula_quantity-16.0.1.0.0.2-py3-none-any.whl
- Upload date:
- Size: 360.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff5068fceb142d2f736a594a049c683f540408af4d03ab39ece84e60cf73feb8 |
|
MD5 | 8aa1d9c7bf343c26ea48b9eae3c68b76 |
|
BLAKE2b-256 | fd5bae13781e96477e3315809e0c03fcfafefca9c79dc6c4137a3f5faadb252e |