Skip to content

Commit

Permalink
[MIG] partner_aging: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cormaza committed Oct 22, 2024
1 parent ff28518 commit 4ea2dee
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 40 deletions.
10 changes: 5 additions & 5 deletions partner_aging/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Interactive Partner Aging at any date
: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--payment-lightgray.png?logo=github
:target: https://github.com/OCA/account-payment/tree/15.0/partner_aging
:target: https://github.com/OCA/account-payment/tree/16.0/partner_aging
:alt: OCA/account-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-payment-15-0/account-payment-15-0-partner_aging
:target: https://translation.odoo-community.org/projects/account-payment-16-0/account-payment-16-0-partner_aging
: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-payment&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-payment&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -58,7 +58,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-payment/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-payment/issues/new?body=module:%20partner_aging%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/account-payment/issues/new?body=module:%20partner_aging%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 @@ -112,6 +112,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-Urvisha-OSI|

This module is part of the `OCA/account-payment <https://github.com/OCA/account-payment/tree/15.0/partner_aging>`_ project on GitHub.
This module is part of the `OCA/account-payment <https://github.com/OCA/account-payment/tree/16.0/partner_aging>`_ 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 partner_aging/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Interactive Partner Aging at any date",
"summary": "Aging as a view - invoices and credits",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"category": "Accounting & Finance",
Expand Down
18 changes: 10 additions & 8 deletions partner_aging/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">Interactive Partner Aging at any date</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9bfe8999840f5c140815c6c429d7c322c387700d6bd03841e4a0722999efaf40
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/account-payment/tree/15.0/partner_aging"><img alt="OCA/account-payment" src="https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-payment-15-0/account-payment-15-0-partner_aging"><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-payment&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="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/account-payment/tree/16.0/partner_aging"><img alt="OCA/account-payment" src="https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-payment-16-0/account-payment-16-0-partner_aging"><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-payment&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 creates a new customer / supplier aging report as of a given date.</p>
<p>The default Aged Partner balance report is related to a specific date and a
static PDF that is based on the difference between credits and debits, not
Expand Down Expand Up @@ -404,7 +404,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-payment/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-payment/issues/new?body=module:%20partner_aging%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-payment/issues/new?body=module:%20partner_aging%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 @@ -440,13 +440,15 @@ <h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">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/Urvisha-OSI"><img alt="Urvisha-OSI" src="https://github.com/Urvisha-OSI.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-payment/tree/15.0/partner_aging">OCA/account-payment</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-payment/tree/16.0/partner_aging">OCA/account-payment</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
57 changes: 44 additions & 13 deletions partner_aging/tests/test_partner_aging.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@
from odoo.tests import common
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT

from odoo.addons.account.tests.common import AccountTestInvoicingCommon


@common.tagged("-at_install", "post_install")
class TestPartnerAging(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)

class TestPartnerAging(common.TransactionCase):
def setUp(self):
super(TestPartnerAging, self).setUp()
self.partner_aging_date_model = self.env["res.partner.aging.date"]
Expand All @@ -21,7 +28,6 @@ def setUp(self):
self.account_account_obj = self.env["account.account"]
self.account_journal_obj = self.env["account.journal"]

self.account_receivable = self.env.ref("account.data_account_type_receivable")
self.partner_12 = self.env.ref("base.res_partner_12")
self.partner_2 = self.env.ref("base.res_partner_2")
self.partner_10 = self.env.ref("base.res_partner_10")
Expand All @@ -39,11 +45,34 @@ def setUp(self):
{
"code": "RA1000",
"name": "Test Receivable Account",
"user_type_id": self.account_receivable.id,
"account_type": "asset_receivable",
"reconcile": True,
}
)

self.income_account_id = self.account_account_obj.create(
{
"code": "RA1001",
"name": "Test Income Account",
"account_type": "income",
}
)

self.expense_account_id = self.account_account_obj.create(
{
"code": "RA1002",
"name": "Test Expense Account",
"account_type": "expense",
}
)

self.env.ref("product.product_product_4").categ_id.write(
{
"property_account_income_categ_id": self.income_account_id.id,
"property_account_expense_categ_id": self.expense_account_id.id,
}
)

invoice_data_list = [
# Customer Invoice Data
[
Expand Down Expand Up @@ -118,16 +147,18 @@ def _create_invoice_with_reference(self, invoice_data):
"partner_id": invoice_data[2],
}
)
self.account_move_line_obj.create(
{
"product_id": self.env.ref("product.product_product_4").id,
"quantity": 1.0,
"price_unit": 0,
"move_id": invoice.id,
"name": "product that cost 100",
"account_id": self.account_id.id,
}
)
invoice_form = common.Form(invoice)
with invoice_form.invoice_line_ids.new() as line_form:
line_form.product_id = self.env.ref("product.product_product_4")
line_form.quantity = 1
line_form.price_unit = 0
line_form.name = "product that cost 100"
line_form.account_id = (
invoice_data[0] == "out_invoice"
and self.income_account_id
or self.expense_account_id
)
invoice = invoice_form.save()
invoice.action_post()
return invoice

Expand Down
11 changes: 4 additions & 7 deletions partner_aging/wizard/res_partner_aging_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@ def execute_aging_query(self, age_date=False):
on lt.move_id = inv.id) DaysDue
ON DaysDue.id = aml.id
LEFT JOIN account_move as ai ON ai.id = aml.move_id
WHERE ac.user_type_id in
(select id from account_account_type where
type = 'receivable') and aml.date
WHERE ac.account_type = 'asset_receivable'
and aml.date
<= '{}' AND ai.state = 'posted' AND
(ai.payment_state != 'paid' OR
aml.full_reconcile_id IS NULL) AND
Expand Down Expand Up @@ -286,8 +285,7 @@ def execute_aging_query(self, age_date=False):
) DaysDue
ON DaysDue.id = aml.id
LEFT JOIN account_move as ai ON ai.id = aml.move_id
WHERE ac.user_type_id in (select id from account_account_type
where type = 'receivable')
WHERE ac.account_type = 'asset_receivable'
AND aml.date <= '{}'
AND aml.partner_id IS NULL
AND ai.partner_id IS not NULL
Expand Down Expand Up @@ -321,8 +319,7 @@ def execute_aging_query(self, age_date=False):
where aml.date <= '{}'
and aml.partner_id IS NOT NULL
and aml.full_reconcile_id IS NOT NULL
and ac.user_type_id in (select id from
account_account_type where type = 'receivable')
and ac.account_type = 'asset_receivable'
and aml.credit > 0
""".format(
age_date,
Expand Down
1 change: 1 addition & 0 deletions partner_aging/wizard/res_partner_aging_customer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
name="open_document"
type="object"
icon="fa-list-alt"
title="Open Document"
attrs="{'invisible':[('invoice_id', '=', False)]}"
/>
<field name="invoice_ref" />
Expand Down
9 changes: 3 additions & 6 deletions partner_aging/wizard/res_partner_aging_supplier.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ def execute_aging_query(self, age_date=False):
ON DaysDue.id = aml.id
LEFT JOIN account_move as ai ON ai.id = aml.move_id
WHERE
ac.user_type_id in (select id from account_account_type where
type = 'payable')
ac.account_type = 'liability_payable'
AND aml.date <= '{}'
AND ai.state = 'posted' AND
(ai.payment_state != 'paid' OR
Expand Down Expand Up @@ -307,8 +306,7 @@ def execute_aging_query(self, age_date=False):
ON DaysDue.id = aml.id
LEFT JOIN account_move as ai ON ai.id = aml.move_id
WHERE
ac.user_type_id in (select id from account_account_type where
type = 'payable')
ac.account_type = 'liability_payable'
AND aml.date <= '{}'
AND aml.partner_id IS NULL
and ai.partner_id IS NOT NULL
Expand Down Expand Up @@ -345,8 +343,7 @@ def execute_aging_query(self, age_date=False):
LEFT JOIN account_account ac on ac.id = aml.account_id
where aml.date <= '{}'
and aml.full_reconcile_id IS NOT NULL
and ac.user_type_id in (select id from account_account_type
where type = 'payable')
and ac.account_type = 'liability_payable'
and aml.debit > 0
""".format(
age_date,
Expand Down
1 change: 1 addition & 0 deletions partner_aging/wizard/res_partner_aging_supplier.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
name="open_document"
type="object"
icon="fa-list-alt"
title="Open Document"
attrs="{'invisible':[('invoice_id', '=', False)]}"
/>
<field name="invoice_ref" />
Expand Down

0 comments on commit 4ea2dee

Please sign in to comment.