mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
139 lines
5.8 KiB
ReStructuredText
139 lines
5.8 KiB
ReStructuredText
=================================
|
|
MRP BoM Line formula for quantity
|
|
=================================
|
|
|
|
..
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
!! This file is generated by oca-gen-addon-readme !!
|
|
!! changes will be overwritten. !!
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
!! source digest: sha256:7cfb3a88e42e13f128328dd4a63d5bfccdef0769822be4828842019e65c5b98e
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
|
:target: https://odoo-community.org/page/development-status
|
|
:alt: Beta
|
|
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
|
:alt: License: AGPL-3
|
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github
|
|
:target: https://github.com/OCA/manufacture/tree/16.0/mrp_bom_line_formula_quantity
|
|
:alt: OCA/manufacture
|
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
|
:target: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-mrp_bom_line_formula_quantity
|
|
:alt: Translate me on Weblate
|
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
|
:target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=16.0
|
|
:alt: Try me on Runboat
|
|
|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|
|
|
Compute the quantity of a Production Line using a formula defined in the BoM Line.
|
|
|
|
**Table of contents**
|
|
|
|
.. contents::
|
|
:local:
|
|
|
|
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
|
|
|
|
.. image:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_line_formula_quantity/static/description/images/product_attribute.png
|
|
|
|
#. Create and publish a Product having the configured custom value, and the MTO route (archived by default)
|
|
|
|
.. image:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_line_formula_quantity/static/description/images/product_tab_attributes.png
|
|
#. Add a BoM to the product, where one Component has the following formula for the quantity:
|
|
|
|
.. image:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_line_formula_quantity/static/description/images/bom.png
|
|
|
|
.. code-block:: python
|
|
|
|
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
|
|
|
|
.. image:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_line_formula_quantity/static/description/images/website_sale_product.png
|
|
|
|
#. Confirm the sale order
|
|
|
|
.. image:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_line_formula_quantity/static/description/images/sale_order.png
|
|
|
|
a Production order with the selected value of Component will be created
|
|
|
|
.. image:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_line_formula_quantity/static/description/images/production_order.png
|
|
|
|
Bug Tracker
|
|
===========
|
|
|
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/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 <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_bom_line_formula_quantity%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
|
|
|
Do not contact contributors directly about support or help with technical issues.
|
|
|
|
Credits
|
|
=======
|
|
|
|
Authors
|
|
~~~~~~~
|
|
|
|
* Aion Tech
|
|
|
|
Maintainers
|
|
~~~~~~~~~~~
|
|
|
|
This module is maintained by the OCA.
|
|
|
|
.. image:: https://odoo-community.org/logo.png
|
|
:alt: Odoo Community Association
|
|
:target: https://odoo-community.org
|
|
|
|
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.
|
|
|
|
.. |maintainer-SirAionTech| image:: https://github.com/SirAionTech.png?size=40px
|
|
:target: https://github.com/SirAionTech
|
|
:alt: SirAionTech
|
|
|
|
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
|
|
|
|maintainer-SirAionTech|
|
|
|
|
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/16.0/mrp_bom_line_formula_quantity>`_ project on GitHub.
|
|
|
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|