diff --git a/sale_procurement_group_by_line/README.rst b/sale_procurement_group_by_line/README.rst index 86d4482d04d..a25b42ae1dc 100644 --- a/sale_procurement_group_by_line/README.rst +++ b/sale_procurement_group_by_line/README.rst @@ -17,13 +17,13 @@ Sale Procurement Group by Line :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/sale-workflow/tree/17.0/sale_procurement_group_by_line + :target: https://github.com/OCA/sale-workflow/tree/18.0/sale_procurement_group_by_line :alt: OCA/sale-workflow .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_procurement_group_by_line + :target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_procurement_group_by_line :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/sale-workflow&target_branch=17.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -45,7 +45,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -62,11 +62,11 @@ Authors Contributors ------------ -- Guewen Baconnier -- Yannick Vaucher -- Jordi Ballester -- Serpent Consulting Services Pvt. Ltd. -- Carmen Rondon Regalado +- Guewen Baconnier +- Yannick Vaucher +- Jordi Ballester +- Serpent Consulting Services Pvt. Ltd. +- Carmen Rondon Regalado Maintainers ----------- @@ -81,6 +81,6 @@ 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. -This module is part of the `OCA/sale-workflow `_ project on GitHub. +This module is part of the `OCA/sale-workflow `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_procurement_group_by_line/__manifest__.py b/sale_procurement_group_by_line/__manifest__.py index a9cd3b43d51..8909b15ef38 100644 --- a/sale_procurement_group_by_line/__manifest__.py +++ b/sale_procurement_group_by_line/__manifest__.py @@ -6,7 +6,7 @@ { "name": "Sale Procurement Group by Line", "summary": "Base module for multiple procurement group by Sale order", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "author": "Camptocamp," "ForgeFlow," "Serpent Consulting Services Pvt. Ltd.," diff --git a/sale_procurement_group_by_line/model/sale.py b/sale_procurement_group_by_line/model/sale.py index a58382985b0..2e5cf04b36b 100644 --- a/sale_procurement_group_by_line/model/sale.py +++ b/sale_procurement_group_by_line/model/sale.py @@ -40,7 +40,11 @@ def _action_launch_stock_rule(self, previous_product_uom_qty=False): previous_product_uom_qty = {} for line in self: line = line.with_company(line.company_id) - if line.state != "sale" or line.product_id.type not in ("consu", "product"): + if ( + line.state != "sale" + or line.order_id.locked + or line.product_id.type != "consu" + ): continue qty = line._get_qty_procurement(previous_product_uom_qty) if ( @@ -83,21 +87,16 @@ def _action_launch_stock_rule(self, previous_product_uom_qty=False): line_uom = line.product_uom quant_uom = line.product_id.uom_id + origin = ( + f"{line.order_id.name} - {line.order_id.client_order_ref}" + if line.order_id.client_order_ref + else line.order_id.name + ) product_qty, procurement_uom = line_uom._adjust_uom_quantities( product_qty, quant_uom ) - - procurements.append( - self.env["procurement.group"].Procurement( - line.product_id, - product_qty, - procurement_uom, - line.order_id.partner_shipping_id.property_stock_customer, - line.product_id.display_name, - line.order_id.name, - line.order_id.company_id, - values, - ) + procurements += line._create_procurements( + product_qty, procurement_uom, origin, values ) # We store the procured quantity in the UoM of the line to avoid # duplicated procurements, specially for dropshipping and kits. diff --git a/sale_procurement_group_by_line/static/description/index.html b/sale_procurement_group_by_line/static/description/index.html index ee9ea823bae..f89ca75b762 100644 --- a/sale_procurement_group_by_line/static/description/index.html +++ b/sale_procurement_group_by_line/static/description/index.html @@ -368,7 +368,7 @@

Sale Procurement Group by Line

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:30d43a042ae36eb1cfd62b1e80ceb060af0619577b76d9294b6731e946aab47b !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Production/Stable License: AGPL-3 OCA/sale-workflow Translate me on Weblate Try me on Runboat

+

Production/Stable License: AGPL-3 OCA/sale-workflow Translate me on Weblate Try me on Runboat

This module was written to extend the functionality of procurement groups created from a sale order.

On itself, this module does nothing it is a requirement for modules @@ -390,7 +390,7 @@

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.

+feedback.

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

@@ -420,7 +420,7 @@

Maintainers

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.

-

This module is part of the OCA/sale-workflow project on GitHub.

+

This module is part of the OCA/sale-workflow project on GitHub.

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

diff --git a/sale_procurement_group_by_line/tests/test_sale_procurement_group_by_line.py b/sale_procurement_group_by_line/tests/test_sale_procurement_group_by_line.py index a36a6dd7e87..1cb5427eeb3 100644 --- a/sale_procurement_group_by_line/tests/test_sale_procurement_group_by_line.py +++ b/sale_procurement_group_by_line/tests/test_sale_procurement_group_by_line.py @@ -36,7 +36,7 @@ def _create_product_category(cls): @classmethod def _create_product(cls, name): product = cls.product_model.create( - {"name": name, "categ_id": cls.product_ctg.id, "type": "product"} + {"name": name, "categ_id": cls.product_ctg.id, "is_storable": True} ) return product