-
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX]account_invoice_report_grouped_by_picking: do not show negative …
…values with partially invoiced services
- Loading branch information
1 parent
27748ff
commit 326607d
Showing
5 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ Account Invoice Grouped by Picking | |
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:de4c4463a2aa0e1670dca3c708e6ca71ab665dded60239f6e7a61b20792fc61a | ||
!! source digest: sha256:fa621af850264f0ff2d2219fca81d3676f300dde7b1bc668e0d215a217d86107 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
|
@@ -86,6 +86,10 @@ Contributors | |
|
||
* Ioan Galan <[email protected]> | ||
|
||
* `Sygel <https://www.sygel.es>`__: | ||
|
||
* Manuel Regidor <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,7 @@ | |
* `Studio73 <https://www.studio73.es>`__: | ||
|
||
* Ioan Galan <[email protected]> | ||
|
||
* `Sygel <https://www.sygel.es>`__: | ||
|
||
* Manuel Regidor <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Copyright 2017 Carlos Dauden <[email protected]> | ||
# Copyright 2018 David Vidal <[email protected]> | ||
# Copyright 2019 Tecnativa - Pedro M. Baeza | ||
# Copyright 2024 Manuel Regidor <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from lxml import html | ||
|
@@ -313,3 +314,51 @@ def test_account_invoice_group_picking_refund_without_return(self): | |
self.assertEqual(tbody.count(self.sale.name), 1) | ||
# information about pickings is printed | ||
self.assertTrue(picking.name in tbody) | ||
|
||
def test_service_less_than_ordered(self): | ||
self.sale.action_confirm() | ||
picking = self.sale.picking_ids[:1] | ||
picking.action_confirm() | ||
picking.move_line_ids.write({"qty_done": 2}) | ||
picking._action_done() | ||
invoice = self.sale._create_invoices() | ||
invoice_service_line = invoice.invoice_line_ids.filtered( | ||
lambda a: a.product_id.type == "service" | ||
) | ||
invoice_service_line.write({"quantity": 1}) | ||
grouped_lines = invoice.lines_grouped_by_picking() | ||
service_dict = list( | ||
filter(lambda e: e.get("line") == invoice_service_line, grouped_lines) | ||
) | ||
self.assertEqual(len(service_dict), 1) | ||
self.assertEqual(service_dict[0].get("quantity"), 1) | ||
|
||
def test_service_greater_than_ordered(self): | ||
self.sale.action_confirm() | ||
picking = self.sale.picking_ids[:1] | ||
picking.action_confirm() | ||
picking.move_line_ids.write({"qty_done": 2}) | ||
picking._action_done() | ||
invoice = self.sale._create_invoices() | ||
invoice_service_line = invoice.invoice_line_ids.filtered( | ||
lambda a: a.product_id.type == "service" | ||
) | ||
invoice_service_line.write({"quantity": 5}) | ||
grouped_lines = invoice.lines_grouped_by_picking() | ||
service_with_picking_dict = list( | ||
filter( | ||
lambda e: e.get("line") == invoice_service_line and e.get("picking"), | ||
grouped_lines, | ||
) | ||
) | ||
service_without_picking_dict = list( | ||
filter( | ||
lambda e: e.get("line") == invoice_service_line | ||
and not e.get("picking"), | ||
grouped_lines, | ||
) | ||
) | ||
self.assertEqual(len(service_with_picking_dict), 1) | ||
self.assertEqual(service_with_picking_dict[0].get("quantity"), 3) | ||
self.assertEqual(len(service_without_picking_dict), 1) | ||
self.assertEqual(service_without_picking_dict[0].get("quantity"), 2) |