Skip to content

Commit

Permalink
[MIG] sale_procurement_group_by_line: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MeritxellAForgeFlow authored and MiquelRForgeFlow committed Nov 25, 2024
1 parent ae7ebfd commit e6c97a9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
20 changes: 10 additions & 10 deletions sale_procurement_group_by_line/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -45,7 +45,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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/sale-workflow/issues/new?body=module:%20sale_procurement_group_by_line%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_procurement_group_by_line%0Aversion:%2018.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.

Expand All @@ -62,11 +62,11 @@ Authors
Contributors
------------

- Guewen Baconnier <[email protected]>
- Yannick Vaucher <[email protected]>
- Jordi Ballester <[email protected]>
- Serpent Consulting Services Pvt. Ltd. <[email protected]>
- Carmen Rondon Regalado <[email protected]>
- Guewen Baconnier <[email protected]>
- Yannick Vaucher <[email protected]>
- Jordi Ballester <[email protected]>
- Serpent Consulting Services Pvt. Ltd. <[email protected]>
- Carmen Rondon Regalado <[email protected]>

Maintainers
-----------
Expand All @@ -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 <https://github.com/OCA/sale-workflow/tree/17.0/sale_procurement_group_by_line>`_ project on GitHub.
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_procurement_group_by_line>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion sale_procurement_group_by_line/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.,"
Expand Down
26 changes: 13 additions & 13 deletions sale_procurement_group_by_line/model/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 48 in sale_procurement_group_by_line/model/sale.py

View check run for this annotation

Codecov / codecov/patch

sale_procurement_group_by_line/model/sale.py#L48

Added line #L48 was not covered by tests
qty = line._get_qty_procurement(previous_product_uom_qty)
if (
Expand Down Expand Up @@ -83,22 +87,18 @@ 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.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.
previous_product_uom_qty[line.id] = line.product_uom_qty
Expand Down
6 changes: 3 additions & 3 deletions sale_procurement_group_by_line/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ <h1 class="title">Sale Procurement Group by Line</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:30d43a042ae36eb1cfd62b1e80ceb060af0619577b76d9294b6731e946aab47b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_procurement_group_by_line"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_procurement_group_by_line"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_procurement_group_by_line"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_procurement_group_by_line"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module was written to extend the functionality of procurement
groups created from a sale order.</p>
<p>On itself, this module does nothing it is a requirement for modules
Expand All @@ -390,7 +390,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-workflow/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_procurement_group_by_line%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_procurement_group_by_line%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -420,7 +420,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_procurement_group_by_line">OCA/sale-workflow</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_procurement_group_by_line">OCA/sale-workflow</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -96,9 +96,9 @@ def test_02_action_launch_procurement_rule_1(self):
self.sale.action_confirm()
self.assertEqual(self.sale.state, "sale")
self.assertEqual(len(self.line1.move_ids), 1)
self.assertEqual(self.line1.move_ids.name, self.line1.display_name)
self.assertEqual(self.line1.move_ids.name, self.line1.product_id.display_name)
self.assertEqual(len(self.line2.move_ids), 1)
self.assertEqual(self.line2.move_ids.name, self.line2.display_name)
self.assertEqual(self.line2.move_ids.name, self.line2.product_id.display_name)

def test_03_action_launch_procurement_rule_2(self):
group_id = self.proc_group_model.create(
Expand Down

0 comments on commit e6c97a9

Please sign in to comment.