Skip to content

Commit

Permalink
[MIG] account_invoice_clearing: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Shide committed Dec 4, 2024
1 parent 1d53122 commit 3ed794e
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 123 deletions.
10 changes: 5 additions & 5 deletions account_invoice_clearing/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Account Invoice Clearing
: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/15.0/account_invoice_clearing
:target: https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_clearing
: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-15-0/account-invoicing-15-0-account_invoice_clearing
:target: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_clearing
: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=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -72,7 +72,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_clearing%0Aversion:%2015.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_clearing%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.

Expand Down Expand Up @@ -118,6 +118,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-Shide|

This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/15.0/account_invoice_clearing>`_ project on GitHub.
This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_clearing>`_ 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_clearing/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Account Invoice Clearing",
"summary": "Account invoice clearing wizard",
"version": "15.0.0.1.3",
"version": "16.0.1.0.0",
"development_status": "Alpha",
"category": "Accounting/Accounting",
"website": "https://github.com/OCA/account-invoicing",
Expand Down
18 changes: 10 additions & 8 deletions account_invoice_clearing/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Account Invoice Clearing</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:92e9f3c4fed7e9092315ca511cc7ec5bb4af3700968dedcaa5c9de0eff4a58cd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.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/15.0/account_invoice_clearing"><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-15-0/account-invoicing-15-0-account_invoice_clearing"><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=15.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="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.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/16.0/account_invoice_clearing"><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-16-0/account-invoicing-16-0-account_invoice_clearing"><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=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module complements the functionality of <em>Automatic Entries</em> in Accounting.
It provides a Wizard to clear invoices by creating an intermediate journal entry.
It allows to clear any invoice with its opposite types. <em>out_</em> types are cleared with <em>in_</em> types and vice versa.
Expand Down Expand Up @@ -422,7 +422,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">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_clearing%0Aversion:%2015.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_clearing%0Aversion:%2016.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 @@ -450,13 +450,15 @@ <h2><a class="toc-backref" href="#toc-entry-7">Other credits</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<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>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/Shide"><img alt="Shide" src="https://github.com/Shide.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-invoicing/tree/15.0/account_invoice_clearing">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/16.0/account_invoice_clearing">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
47 changes: 28 additions & 19 deletions account_invoice_clearing/tests/test_clearing_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,51 @@ def test_clearing_wizard(self):
"""Test clearing wizard with different move types."""

def sorted_by_sequence(lines):
return sorted(lines, key=lambda l: l.sequence)
return sorted(lines, key=lambda line: line.sequence)

t = fields.Date.today()
t_5 = t + timedelta(days=5)
t_10 = t + timedelta(days=10)
move_types = ["out_invoice", "in_invoice"]
for init_move_type, clearing_move_type in [move_types, move_types[::-1]]:
with self.subTest(
init_move_type=init_move_type, clearing_move_type=clearing_move_type
):
init_inv = self.init_invoice(
invoice_date=fields.Date.today(),
invoice_date=t,
move_type=init_move_type,
partner=self.cl_partner,
amounts=[100, 200],
post=True,
)
cl_inv_1 = self.init_invoice(
invoice_date=fields.Date.today() + timedelta(days=5),
invoice_date=t_5,
move_type=clearing_move_type,
partner=self.cl_partner.child_ids[0],
amounts=[100],
post=True,
post=False,
)
cl_inv_2 = self.init_invoice(
invoice_date=fields.Date.today() + timedelta(days=10),
move_type=clearing_move_type,
partner=self.cl_partner.child_ids[1],
amounts=[200],
post=True,
post=False,
)
# Set date maturities
cl_inv_1.invoice_date_due = t_5
cl_inv_2.invoice_date_due = t_10
# Post clearing invoices
cl_inv_1.action_post()
cl_inv_2.action_post()
# Create wizard
cw_action = init_inv.action_open_invoice_clearing_wizard()
wizard = self.env[cw_action["res_model"]].browse(cw_action["res_id"])
# Test Action: Unlink Lines
wizard.action_unlink_lines()
wizard._action_unlink_lines()
self.assertFalse(wizard.line_ids)
# Test Action: Add Lines
wizard.action_add_lines()
wizard._action_add_lines()
self.assertTrue(wizard.line_ids)
# Test Action: Sort Lines by Date Due
wizard.action_sort_by_date_due_asc()
Expand All @@ -83,7 +92,7 @@ def sorted_by_sequence(lines):
self.assertTrue(slines[0].amount_residual > slines[1].amount_residual)
# Test Action: Fill Amount to Clear
wizard.action_fill_amount_to_clear()
wizard.refresh()
wizard.invalidate_recordset()
self.assertTrue(
float_is_zero(
wizard.amount_to_clear,
Expand All @@ -92,7 +101,7 @@ def sorted_by_sequence(lines):
)
# Test Action: Reset Lines
wizard.action_reset_lines()
wizard.refresh()
wizard.invalidate_recordset()
self.assertTrue(
not float_is_zero(
wizard.amount_to_clear,
Expand All @@ -101,37 +110,37 @@ def sorted_by_sequence(lines):
)
# Create moves
wizard.action_fill_amount_to_clear()
wizard.refresh()
wizard.invalidate_recordset()
wizard.button_confirm()
self.assertEqual(init_inv.payment_state, "paid")
self.assertEqual(cl_inv_1.payment_state, "paid")
self.assertEqual(cl_inv_2.payment_state, "paid")

def test_internal_types(self):
def test_account_types(self):
aicw_model = self.env["account.invoice.clearing.wizard"]
# For lines to clear
self.assertEqual(
"payable",
aicw_model._get_internal_type_from_move_type(
"liability_payable",
aicw_model._get_account_type_from_move_type(
"in_invoice", is_counterpart=False
),
)
self.assertEqual(
"receivable",
aicw_model._get_internal_type_from_move_type(
"asset_receivable",
aicw_model._get_account_type_from_move_type(
"out_invoice", is_counterpart=False
),
)
# For counterpart lines
self.assertEqual(
"receivable",
aicw_model._get_internal_type_from_move_type(
"asset_receivable",
aicw_model._get_account_type_from_move_type(
"in_invoice", is_counterpart=True
),
)
self.assertEqual(
"payable",
aicw_model._get_internal_type_from_move_type(
"liability_payable",
aicw_model._get_account_type_from_move_type(
"out_invoice", is_counterpart=True
),
)
Loading

0 comments on commit 3ed794e

Please sign in to comment.