Skip to content

Commit

Permalink
[MIG] account_invoice_section_sale_order: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Tran committed Dec 31, 2024
1 parent afca7ce commit 8ff69d4
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 42 deletions.
29 changes: 15 additions & 14 deletions account_invoice_section_sale_order/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Acccount Invoice Section Sale Order
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/17.0/account_invoice_section_sale_order
:target: https://github.com/OCA/account-invoicing/tree/18.0/account_invoice_section_sale_order
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-17-0/account-invoicing-17-0-account_invoice_section_sale_order
:target: https://translation.odoo-community.org/projects/account-invoicing-18-0/account-invoicing-18-0-account_invoice_section_sale_order
: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/account-invoicing&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -48,7 +48,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/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/account-invoicing/issues/new?body=module:%20account_invoice_section_sale_order%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_section_sale_order%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 @@ -63,26 +63,27 @@ Authors
Contributors
------------

- `Camptocamp <https://www.camptocamp.com>`__
- `Camptocamp <https://www.camptocamp.com>`__

- Thierry Ducrest <[email protected]>
- Hiep Nguyen Hoang <[email protected]>
- Thierry Ducrest <[email protected]>
- Hiep Nguyen Hoang <[email protected]>
- Nhan Tran <[email protected]>

- `Dynapps <https://www.dynapps.eu>`__
- `Dynapps <https://www.dynapps.eu>`__

- Jeroen Evens
- Raf Ven
- Jeroen Evens
- Raf Ven

- `NICO SOLUTIONS <https://www.nico-solutions-de>`__
- `NICO SOLUTIONS <https://www.nico-solutions-de>`__

- Nils Coenen
- Nils Coenen

Other credits
-------------

The development of this module has been financially supported by:

- Camptocamp
- Camptocamp

Maintainers
-----------
Expand All @@ -97,6 +98,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/account-invoicing <https://github.com/OCA/account-invoicing/tree/17.0/account_invoice_section_sale_order>`_ project on GitHub.
This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/18.0/account_invoice_section_sale_order>`_ 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 account_invoice_section_sale_order/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Acccount Invoice Section Sale Order",
"version": "17.0.2.0.0",
"version": "18.0.1.0.0",
"summary": "For invoices targetting multiple sale order add"
"sections with sale order name.",
"author": "Camptocamp, Odoo Community Association (OCA)",
Expand Down
1 change: 1 addition & 0 deletions account_invoice_section_sale_order/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- [Camptocamp](https://www.camptocamp.com)
- Thierry Ducrest \<<[email protected]>\>
- Hiep Nguyen Hoang \<<[email protected]>\>
- Nhan Tran \<<[email protected]>\>
- [Dynapps](https://www.dynapps.eu)
- Jeroen Evens
- Raf Ven
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Acccount Invoice Section Sale Order</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cda83a22f718e3acd31993bc22376dede8661afffa5b7eec0e166dc8f3430bad
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/account-invoicing/tree/17.0/account_invoice_section_sale_order"><img alt="OCA/account-invoicing" src="https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-invoicing-17-0/account-invoicing-17-0-account_invoice_section_sale_order"><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/account-invoicing&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="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/account-invoicing/tree/18.0/account_invoice_section_sale_order"><img alt="OCA/account-invoicing" src="https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-invoicing-18-0/account-invoicing-18-0-account_invoice_section_sale_order"><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/account-invoicing&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>When invoicing multiple sale orders at the same time, sale orders may be
grouped by customer into a single invoice. Unfortunately when this
happens, it is hard to know which invoice line belongs to which sale
Expand All @@ -395,7 +395,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/account-invoicing/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/account-invoicing/issues/new?body=module:%20account_invoice_section_sale_order%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/account-invoicing/issues/new?body=module:%20account_invoice_section_sale_order%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 All @@ -412,6 +412,7 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<li><a class="reference external" href="https://www.camptocamp.com">Camptocamp</a><ul>
<li>Thierry Ducrest &lt;<a class="reference external" href="mailto:thierry.ducrest&#64;camptocamp.com">thierry.ducrest&#64;camptocamp.com</a>&gt;</li>
<li>Hiep Nguyen Hoang &lt;<a class="reference external" href="mailto:hiepnh&#64;trobz.com">hiepnh&#64;trobz.com</a>&gt;</li>
<li>Nhan Tran &lt;<a class="reference external" href="mailto:nhant&#64;trobz.com">nhant&#64;trobz.com</a>&gt;</li>
</ul>
</li>
<li><a class="reference external" href="https://www.dynapps.eu">Dynapps</a><ul>
Expand Down Expand Up @@ -441,7 +442,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">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/account-invoicing/tree/17.0/account_invoice_section_sale_order">OCA/account-invoicing</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-invoicing/tree/18.0/account_invoice_section_sale_order">OCA/account-invoicing</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
9 changes: 7 additions & 2 deletions account_invoice_section_sale_order/tests/common.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from odoo.tests import tagged
from odoo.tests.common import SavepointCase
from odoo.tests.common import TransactionCase


@tagged("-at_install", "post_install")
class Common(SavepointCase):
class Common(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand All @@ -17,12 +17,16 @@ def setUpClassOrder(cls):
cls.product_2 = cls.env.ref("product.product_product_2")
cls.product_1.invoice_policy = "order"
cls.product_2.invoice_policy = "order"
cls.pricelist = cls.env["product.pricelist"].create(
{"name": "Europe pricelist", "currency_id": cls.env.ref("base.EUR").id}
)
cls.order1_p1 = cls.env["sale.order"].create(
{
"partner_id": cls.partner_1.id,
"partner_shipping_id": cls.partner_1.id,
"partner_invoice_id": cls.partner_1.id,
"client_order_ref": "ref123",
"pricelist_id": cls.pricelist.id,
"order_line": [
(
0,
Expand Down Expand Up @@ -55,6 +59,7 @@ def setUpClassOrder(cls):
"partner_id": cls.partner_1.id,
"partner_shipping_id": cls.partner_1.id,
"partner_invoice_id": cls.partner_1.id,
"pricelist_id": cls.pricelist.id,
"order_line": [
(
0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import mock
from unittest import mock

from odoo.exceptions import UserError

Expand All @@ -20,18 +20,14 @@ def test_create_invoice(self):
"".join([self.order1_p1.name, " - ", self.order1_p1.client_order_ref]),
"line_section",
),
20: ("order 1 line 1", False),
30: ("order 1 line 2", False),
20: (f"{self.product_1.name} order 1 line 1", "product"),
30: (f"{self.product_2.name} order 1 line 2", "product"),
40: (self.order2_p1.name, "line_section"),
50: ("order 2 line 1", False),
60: ("order 2 line 2", False),
50: (f"{self.product_1.name} order 2 line 1", "product"),
60: (f"{self.product_2.name} order 2 line 2", "product"),
}
invoice_ids = (self.order1_p1 + self.order2_p1)._create_invoices()
lines = (
invoice_ids[0]
.line_ids.sorted("sequence")
.filtered(lambda r: not r.exclude_from_invoice_tab)
)
lines = invoice_ids[0].invoice_line_ids.sorted("sequence")
for line in lines:
if line.sequence not in result:
continue

Check warning on line 33 in account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py

View check run for this annotation

Codecov / codecov/patch

account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py#L33

Added line #L33 was not covered by tests
Expand All @@ -40,14 +36,9 @@ def test_create_invoice(self):

def test_create_invoice_with_currency(self):
"""Check invoice is generated with a correct total amount"""
eur = self.env.ref("base.EUR")
pricelist = self.env["product.pricelist"].create(
{"name": "Europe pricelist", "currency_id": eur.id}
)
orders = self.order1_p1 | self.order2_p1
orders.write({"pricelist_id": pricelist.id})
invoices = orders._create_invoices()
self.assertEqual(invoices.amount_total, 80)
self.assertEqual(invoices.amount_untaxed, 80)

def test_create_invoice_with_default_journal(self):
"""Using a specific journal for the invoice should not be broken"""
Expand Down Expand Up @@ -108,13 +99,13 @@ def test_custom_grouping_by_sale_order_user(self):
invoice = (orders + sale_order_3)._create_invoices()
result = {
10: ("Mocked value from ResUsers", "line_section"),
20: ("order 1 line 1", False),
30: ("order 1 line 2", False),
40: ("order 2 line 1", False),
50: ("order 2 line 2", False),
20: (f"{self.product_1.name} order 1 line 1", "product"),
30: (f"{self.product_2.name} order 1 line 2", "product"),
40: (f"{self.product_1.name} order 2 line 1", "product"),
50: (f"{self.product_2.name} order 2 line 2", "product"),
60: ("Mocked value from ResUsers", "line_section"),
70: ("order 3 line 1", False),
80: ("order 3 line 2", False),
70: (f"{self.product_1.name} order 3 line 1", "product"),
80: (f"{self.product_2.name} order 3 line 2", "product"),
}
for line in invoice.invoice_line_ids.sorted("sequence"):
if line.sequence not in result:
Expand Down

0 comments on commit 8ff69d4

Please sign in to comment.