[IMP] : pre-commit auto fixes

This commit is contained in:
ellbristow
2024-06-25 11:40:46 +02:00
committed by Miquel Raïch
parent e1b5b9729e
commit 3158417c4a
24 changed files with 236 additions and 183 deletions

View File

@@ -17,33 +17,39 @@ Partner Statement
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-reporting/tree/16.0/partner_statement :target: https://github.com/OCA/account-financial-reporting/tree/17.0/partner_statement
:alt: OCA/account-financial-reporting :alt: OCA/account-financial-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-reporting-16-0/account-financial-reporting-16-0-partner_statement :target: https://translation.odoo-community.org/projects/account-financial-reporting-17-0/account-financial-reporting-17-0-partner_statement
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-reporting&target_branch=16.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-reporting&target_branch=17.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module extends the functionality of Invoicing to support the printing of customer and vendor statements. This module extends the functionality of Invoicing to support the
There are three types of statements: Activity, Detailed Activity, and Outstanding. Aging details can be shown printing of customer and vendor statements. There are three types of
in the reports, expressed in aging buckets, so the customer or vendor can review how much is open, due or overdue. statements: Activity, Detailed Activity, and Outstanding. Aging details
can be shown in the reports, expressed in aging buckets, so the customer
or vendor can review how much is open, due or overdue.
The activity statement provides details of all activity on the partner receivables or payables The activity statement provides details of all activity on the partner
between two selected dates. This includes all invoices, refunds and payments. receivables or payables between two selected dates. This includes all
Any outstanding balance dated prior to the chosen statement period will appear invoices, refunds and payments. Any outstanding balance dated prior to
as a forward balance at the top of the statement. The list is displayed in chronological the chosen statement period will appear as a forward balance at the top
order and is split by currencies. of the statement. The list is displayed in chronological order and is
split by currencies.
The detailed activity statement is an extension of the previous statement, and intends to explain the transactions The detailed activity statement is an extension of the previous
that have happened during the period, also providing with a Prior Balance section and an Ending Balance section. statement, and intends to explain the transactions that have happened
during the period, also providing with a Prior Balance section and an
Ending Balance section.
The outstanding statement provides details of all outstanding partner receivables or payables The outstanding statement provides details of all outstanding partner
up to a particular date. This includes all unpaid invoices, unclaimed refunds and receivables or payables up to a particular date. This includes all
outstanding payments. The list is displayed in chronological order and is split by currencies. unpaid invoices, unclaimed refunds and outstanding payments. The list is
displayed in chronological order and is split by currencies.
**Table of contents** **Table of contents**
@@ -53,18 +59,21 @@ outstanding payments. The list is displayed in chronological order and is split
Configuration Configuration
============= =============
Users willing to access to this report should have proper Accounting &
Finance rights:
Users willing to access to this report should have proper Accounting & Finance rights: 1. Go to *Settings / Users* and edit your user to add the corresponding
access rights as follows.
#. Go to *Settings / Users* and edit your user to add the corresponding access rights as follows. 2. In *Application / Accounting & Finance*, select *Billing* or *Billing
#. In *Application / Accounting & Finance*, select *Billing* or *Billing Manager* Manager*
To configure this module, you need to: To configure this module, you need to:
#. Go to *Invoicing / Configuration / Settings* 1. Go to *Invoicing / Configuration / Settings*
#. Under the *Partner Statements* of *Accounting* option select either or both of OCA Activity or Outstanding Statement 2. Under the *Partner Statements* of *Accounting* option select either
#. Once selected, you may set default options for the reports. or both of OCA Activity or Outstanding Statement
#. Click *Save* 3. Once selected, you may set default options for the reports.
4. Click *Save*
Removing the wizard from menus follows the same process. Removing the wizard from menus follows the same process.
@@ -73,33 +82,41 @@ Usage
To use this module, you need to: To use this module, you need to:
#. Go to a list of Partners, Contacts, Customer or Vendors and select one or more. 1. Go to a list of Partners, Contacts, Customer or Vendors and select
#. Press 'Action > Partner Activity Statement' or 'Action > Partner Outstanding Statement' respectively. one or more.
#. Indicate if you want to display receivables or payables, and if you want to display aging buckets and the aging type. 2. Press 'Action > Partner Activity Statement' or 'Action > Partner
#. Optionally complete advanced options such as filtering non due or negative balance partners. Outstanding Statement' respectively.
3. Indicate if you want to display receivables or payables, and if you
want to display aging buckets and the aging type.
4. Optionally complete advanced options such as filtering non due or
negative balance partners.
Known issues / Roadmap Known issues / Roadmap
====================== ======================
* Email template. - Email template.
* Expose reports (using defaults) to billing users while restricting the wizard to managers option. - Expose reports (using defaults) to billing users while restricting
* Concept of statement run - to start an async job to send out all statements. the wizard to managers option.
- Concept of statement run - to start an async job to send out all
statements.
Changelog Changelog
========= =========
12.0.1.0.0 (2018-11-08) 12.0.1.0.0 (2018-11-08)
~~~~~~~~~~~~~~~~~~~~~~~ -----------------------
* [BREAKING] Modules customer_activity_statement and customer_outstanding_statement merged to create partner_statement. - [BREAKING] Modules customer_activity_statement and
* [ADD] New features. customer_outstanding_statement merged to create partner_statement.
* Age by months or days - [ADD] New features.
* Filter negative balances
- Age by months or days
- Filter negative balances
14.0.2.0.0 (2022-12-16) 14.0.2.0.0 (2022-12-16)
~~~~~~~~~~~~~~~~~~~~~~~ -----------------------
* [ADD] Detailed Activity Statement. - [ADD] Detailed Activity Statement.
Bug Tracker Bug Tracker
=========== ===========
@@ -107,7 +124,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-reporting/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-reporting/issues>`_.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20partner_statement%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20partner_statement%0Aversion:%2017.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. Do not contact contributors directly about support or help with technical issues.
@@ -115,21 +132,21 @@ Credits
======= =======
Authors Authors
~~~~~~~ -------
* ForgeFlow * ForgeFlow
Contributors Contributors
~~~~~~~~~~~~ ------------
* Miquel Raïch <miquel.raich@forgeflow.com> - Miquel Raïch <miquel.raich@forgeflow.com>
* Graeme Gellatly <graeme@o4sb.com> - Graeme Gellatly <graeme@o4sb.com>
* Lois Rilo <lois.rilo@forgeflow.com> - Lois Rilo <lois.rilo@forgeflow.com>
* Dhara Solanki <dhara.solanki@initos.com> - Dhara Solanki <dhara.solanki@initos.com>
* Danny Adair <danny@o4sb.com> - Danny Adair <danny@o4sb.com>
Maintainers Maintainers
~~~~~~~~~~~ -----------
This module is maintained by the OCA. This module is maintained by the OCA.
@@ -149,6 +166,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-MiquelRForgeFlow| |maintainer-MiquelRForgeFlow|
This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/16.0/partner_statement>`_ project on GitHub. This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/17.0/partner_statement>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@@ -0,0 +1,17 @@
Users willing to access to this report should have proper Accounting &
Finance rights:
1. Go to *Settings / Users* and edit your user to add the corresponding
access rights as follows.
2. In *Application / Accounting & Finance*, select *Billing* or
*Billing Manager*
To configure this module, you need to:
1. Go to *Invoicing / Configuration / Settings*
2. Under the *Partner Statements* of *Accounting* option select either
or both of OCA Activity or Outstanding Statement
3. Once selected, you may set default options for the reports.
4. Click *Save*
Removing the wizard from menus follows the same process.

View File

@@ -1,14 +0,0 @@
Users willing to access to this report should have proper Accounting & Finance rights:
#. Go to *Settings / Users* and edit your user to add the corresponding access rights as follows.
#. In *Application / Accounting & Finance*, select *Billing* or *Billing Manager*
To configure this module, you need to:
#. Go to *Invoicing / Configuration / Settings*
#. Under the *Partner Statements* of *Accounting* option select either or both of OCA Activity or Outstanding Statement
#. Once selected, you may set default options for the reports.
#. Click *Save*
Removing the wizard from menus follows the same process.

View File

@@ -0,0 +1,5 @@
- Miquel Raïch \<<miquel.raich@forgeflow.com>\>
- Graeme Gellatly \<<graeme@o4sb.com>\>
- Lois Rilo \<<lois.rilo@forgeflow.com>\>
- Dhara Solanki \<<dhara.solanki@initos.com>\>
- Danny Adair \<<danny@o4sb.com>\>

View File

@@ -1,5 +0,0 @@
* Miquel Raïch <miquel.raich@forgeflow.com>
* Graeme Gellatly <graeme@o4sb.com>
* Lois Rilo <lois.rilo@forgeflow.com>
* Dhara Solanki <dhara.solanki@initos.com>
* Danny Adair <danny@o4sb.com>

View File

@@ -0,0 +1,22 @@
This module extends the functionality of Invoicing to support the
printing of customer and vendor statements. There are three types of
statements: Activity, Detailed Activity, and Outstanding. Aging details
can be shown in the reports, expressed in aging buckets, so the customer
or vendor can review how much is open, due or overdue.
The activity statement provides details of all activity on the partner
receivables or payables between two selected dates. This includes all
invoices, refunds and payments. Any outstanding balance dated prior to
the chosen statement period will appear as a forward balance at the top
of the statement. The list is displayed in chronological order and is
split by currencies.
The detailed activity statement is an extension of the previous
statement, and intends to explain the transactions that have happened
during the period, also providing with a Prior Balance section and an
Ending Balance section.
The outstanding statement provides details of all outstanding partner
receivables or payables up to a particular date. This includes all
unpaid invoices, unclaimed refunds and outstanding payments. The list is
displayed in chronological order and is split by currencies.

View File

@@ -1,16 +0,0 @@
This module extends the functionality of Invoicing to support the printing of customer and vendor statements.
There are three types of statements: Activity, Detailed Activity, and Outstanding. Aging details can be shown
in the reports, expressed in aging buckets, so the customer or vendor can review how much is open, due or overdue.
The activity statement provides details of all activity on the partner receivables or payables
between two selected dates. This includes all invoices, refunds and payments.
Any outstanding balance dated prior to the chosen statement period will appear
as a forward balance at the top of the statement. The list is displayed in chronological
order and is split by currencies.
The detailed activity statement is an extension of the previous statement, and intends to explain the transactions
that have happened during the period, also providing with a Prior Balance section and an Ending Balance section.
The outstanding statement provides details of all outstanding partner receivables or payables
up to a particular date. This includes all unpaid invoices, unclaimed refunds and
outstanding payments. The list is displayed in chronological order and is split by currencies.

View File

@@ -0,0 +1,11 @@
## 12.0.1.0.0 (2018-11-08)
- \[BREAKING\] Modules customer_activity_statement and
customer_outstanding_statement merged to create partner_statement.
- \[ADD\] New features.
- Age by months or days
- Filter negative balances
## 14.0.2.0.0 (2022-12-16)
- \[ADD\] Detailed Activity Statement.

View File

@@ -1,12 +0,0 @@
12.0.1.0.0 (2018-11-08)
~~~~~~~~~~~~~~~~~~~~~~~
* [BREAKING] Modules customer_activity_statement and customer_outstanding_statement merged to create partner_statement.
* [ADD] New features.
* Age by months or days
* Filter negative balances
14.0.2.0.0 (2022-12-16)
~~~~~~~~~~~~~~~~~~~~~~~
* [ADD] Detailed Activity Statement.

View File

@@ -0,0 +1,5 @@
- Email template.
- Expose reports (using defaults) to billing users while restricting the
wizard to managers option.
- Concept of statement run - to start an async job to send out all
statements.

View File

@@ -1,3 +0,0 @@
* Email template.
* Expose reports (using defaults) to billing users while restricting the wizard to managers option.
* Concept of statement run - to start an async job to send out all statements.

View File

@@ -0,0 +1,10 @@
To use this module, you need to:
1. Go to a list of Partners, Contacts, Customer or Vendors and select
one or more.
2. Press 'Action \> Partner Activity Statement' or 'Action \> Partner
Outstanding Statement' respectively.
3. Indicate if you want to display receivables or payables, and if you
want to display aging buckets and the aging type.
4. Optionally complete advanced options such as filtering non due or
negative balance partners.

View File

@@ -1,6 +0,0 @@
To use this module, you need to:
#. Go to a list of Partners, Contacts, Customer or Vendors and select one or more.
#. Press 'Action > Partner Activity Statement' or 'Action > Partner Outstanding Statement' respectively.
#. Indicate if you want to display receivables or payables, and if you want to display aging buckets and the aging type.
#. Optionally complete advanced options such as filtering non due or negative balance partners.

View File

@@ -25,8 +25,12 @@ class ActivityStatement(models.AbstractModel):
ELSE l.balance + sum(coalesce(pc.amount, 0.0)) ELSE l.balance + sum(coalesce(pc.amount, 0.0))
END AS open_amount, END AS open_amount,
CASE WHEN l.balance > 0.0 CASE WHEN l.balance > 0.0
THEN l.amount_currency - sum(coalesce(pd.debit_amount_currency, 0.0)) THEN l.amount_currency - sum(coalesce(
ELSE l.amount_currency + sum(coalesce(pc.credit_amount_currency, 0.0)) pd.debit_amount_currency, 0.0)
)
ELSE l.amount_currency + sum(coalesce(
pc.credit_amount_currency, 0.0)
)
END AS open_amount_currency END AS open_amount_currency
FROM account_move_line l FROM account_move_line l
JOIN account_account aa ON (aa.id = l.account_id) JOIN account_account aa ON (aa.id = l.account_id)
@@ -98,13 +102,12 @@ class ActivityStatement(models.AbstractModel):
partners = tuple(partner_ids) partners = tuple(partner_ids)
# pylint: disable=E8103 # pylint: disable=E8103
self.env.cr.execute( self.env.cr.execute(
"""WITH Q1 AS (%s), """WITH Q1 AS ({}),
Q2 AS (%s), Q2 AS ({}),
Q3 AS (%s) Q3 AS ({})
SELECT partner_id, currency_id, sum(balance) as balance SELECT partner_id, currency_id, sum(balance) as balance
FROM Q3 FROM Q3
GROUP BY partner_id, currency_id""" GROUP BY partner_id, currency_id""".format(
% (
self._initial_balance_sql_q1(partners, date_start, account_type), self._initial_balance_sql_q1(partners, date_start, account_type),
self._initial_balance_sql_q2("Q1"), self._initial_balance_sql_q2("Q1"),
self._initial_balance_sql_q3("Q2", company_id), self._initial_balance_sql_q3("Q2", company_id),
@@ -193,14 +196,13 @@ class ActivityStatement(models.AbstractModel):
# pylint: disable=E8103 # pylint: disable=E8103
self.env.cr.execute( self.env.cr.execute(
""" """
WITH Q1 AS (%s), WITH Q1 AS ({}),
Q2 AS (%s) Q2 AS ({})
SELECT partner_id, move_id, date, date_maturity, ids, SELECT partner_id, move_id, date, date_maturity, ids,
COALESCE(name, '') as name, COALESCE(ref, '') as ref, COALESCE(name, '') as name, COALESCE(ref, '') as ref,
debit, credit, amount, blocked, currency_id debit, credit, amount, blocked, currency_id
FROM Q2 FROM Q2
ORDER BY date, date_maturity, move_id""" ORDER BY date, date_maturity, move_id""".format(
% (
self._display_activity_lines_sql_q1( self._display_activity_lines_sql_q1(
partners, date_start, date_end, account_type partners, date_start, date_end, account_type
), ),
@@ -282,18 +284,17 @@ class ActivityStatement(models.AbstractModel):
# pylint: disable=E8103 # pylint: disable=E8103
self.env.cr.execute( self.env.cr.execute(
""" """
WITH Q1 AS (%s), WITH Q1 AS ({}),
Q2 AS (%s), Q2 AS ({}),
Q3 AS (%s), Q3 AS ({}),
Q4 AS (%s), Q4 AS ({}),
Q5 AS (%s), Q5 AS ({}),
Q6 AS (%s) Q6 AS ({})
SELECT partner_id, currency_id, move_id, date, date_maturity, debit, SELECT partner_id, currency_id, move_id, date, date_maturity, debit,
credit, amount, open_amount, COALESCE(name, '') as name, credit, amount, open_amount, COALESCE(name, '') as name,
COALESCE(ref, '') as ref, blocked, id COALESCE(ref, '') as ref, blocked, id
FROM Q6 FROM Q6
ORDER BY date, date_maturity, move_id""" ORDER BY date, date_maturity, move_id""".format(
% (
self._display_activity_lines_sql_q1( self._display_activity_lines_sql_q1(
partners, date_start, date_end, account_type partners, date_start, date_end, account_type
), ),

View File

@@ -29,7 +29,7 @@ class ActivityStatementXslx(models.AbstractModel):
report_name = _("Activity Statement") report_name = _("Activity Statement")
if company_id: if company_id:
company = self.env["res.company"].browse(company_id) company = self.env["res.company"].browse(company_id)
suffix = " - {} - {}".format(company.name, company.currency_id.name) suffix = f" - {company.name} - {company.currency_id.name}"
report_name = report_name + suffix report_name = report_name + suffix
return report_name return report_name
@@ -300,11 +300,12 @@ class ActivityStatementXslx(models.AbstractModel):
for currency_id in currencies: for currency_id in currencies:
currency = self.env["res.currency"].browse(currency_id) currency = self.env["res.currency"].browse(currency_id)
if currency.position == "after": if currency.position == "after":
money_string = "#,##0.%s " % ( money_string = (
"0" * currency.decimal_places "#,##0.%s " % ("0" * currency.decimal_places)
) + "[${}]".format(currency.symbol) + f"[${currency.symbol}]"
)
elif currency.position == "before": elif currency.position == "before":
money_string = "[${}]".format(currency.symbol) + " #,##0.%s" % ( money_string = f"[${currency.symbol}]" + " #,##0.%s" % (
"0" * currency.decimal_places "0" * currency.decimal_places
) )
FORMATS["current_money_format"] = workbook.add_format( FORMATS["current_money_format"] = workbook.add_format(

View File

@@ -29,7 +29,7 @@ class DetailedActivityStatementXslx(models.AbstractModel):
report_name = _("Detailed Activity Statement") report_name = _("Detailed Activity Statement")
if company_id: if company_id:
company = self.env["res.company"].browse(company_id) company = self.env["res.company"].browse(company_id)
suffix = " - {} - {}".format(company.name, company.currency_id.name) suffix = f" - {company.name} - {company.currency_id.name}"
report_name = report_name + suffix report_name = report_name + suffix
return report_name return report_name
@@ -39,7 +39,8 @@ class DetailedActivityStatementXslx(models.AbstractModel):
account_type = data.get("account_type", False) account_type = data.get("account_type", False)
row_pos += 2 row_pos += 2
statement_header = _( statement_header = _(
"Detailed %(payable)sStatement between %(start)s and %(end)s in %(currency)s" "Detailed %(payable)sStatement between %(start)s and %(end)s"
" in %(currency)s"
) % { ) % {
"payable": account_type == "liability_payable" and _("Supplier ") or "", "payable": account_type == "liability_payable" and _("Supplier ") or "",
"start": partner_data.get("start"), "start": partner_data.get("start"),
@@ -523,11 +524,12 @@ class DetailedActivityStatementXslx(models.AbstractModel):
for currency_id in currencies: for currency_id in currencies:
currency = self.env["res.currency"].browse(currency_id) currency = self.env["res.currency"].browse(currency_id)
if currency.position == "after": if currency.position == "after":
money_string = "#,##0.%s " % ( money_string = (
"0" * currency.decimal_places "#,##0.%s " % ("0" * currency.decimal_places)
) + "[${}]".format(currency.symbol) + f"[${currency.symbol}]"
)
elif currency.position == "before": elif currency.position == "before":
money_string = "[${}]".format(currency.symbol) + " #,##0.%s" % ( money_string = f"[${currency.symbol}]" + " #,##0.%s" % (
"0" * currency.decimal_places "0" * currency.decimal_places
) )
FORMATS["current_money_format"] = workbook.add_format( FORMATS["current_money_format"] = workbook.add_format(

View File

@@ -123,15 +123,14 @@ class OutstandingStatement(models.AbstractModel):
# pylint: disable=E8103 # pylint: disable=E8103
self.env.cr.execute( self.env.cr.execute(
""" """
WITH Q1 as (%s), WITH Q1 as ({}),
Q2 AS (%s), Q2 AS ({}),
Q3 AS (%s) Q3 AS ({})
SELECT partner_id, currency_id, move_id, date, date_maturity, debit, SELECT partner_id, currency_id, move_id, date, date_maturity, debit,
credit, amount, open_amount, COALESCE(name, '') as name, credit, amount, open_amount, COALESCE(name, '') as name,
COALESCE(ref, '') as ref, blocked, id COALESCE(ref, '') as ref, blocked, id
FROM Q3 FROM Q3
ORDER BY date, date_maturity, move_id""" ORDER BY date, date_maturity, move_id""".format(
% (
self._display_outstanding_lines_sql_q1( self._display_outstanding_lines_sql_q1(
partners, date_end, account_type partners, date_end, account_type
), ),

View File

@@ -29,7 +29,7 @@ class OutstandingStatementXslx(models.AbstractModel):
report_name = _("Outstanding Statement") report_name = _("Outstanding Statement")
if company_id: if company_id:
company = self.env["res.company"].browse(company_id) company = self.env["res.company"].browse(company_id)
suffix = " - {} - {}".format(company.name, company.currency_id.name) suffix = f" - {company.name} - {company.currency_id.name}"
report_name = report_name + suffix report_name = report_name + suffix
return report_name return report_name
@@ -278,11 +278,12 @@ class OutstandingStatementXslx(models.AbstractModel):
for currency_id in currencies: for currency_id in currencies:
currency = self.env["res.currency"].browse(currency_id) currency = self.env["res.currency"].browse(currency_id)
if currency.position == "after": if currency.position == "after":
money_string = "#,##0.%s " % ( money_string = (
"0" * currency.decimal_places "#,##0.%s " % ("0" * currency.decimal_places)
) + "[${}]".format(currency.symbol) + f"[${currency.symbol}]"
)
elif currency.position == "before": elif currency.position == "before":
money_string = "[${}]".format(currency.symbol) + " #,##0.%s" % ( money_string = f"[${currency.symbol}]" + " #,##0.%s" % (
"0" * currency.decimal_places "0" * currency.decimal_places
) )
FORMATS["current_money_format"] = workbook.add_format( FORMATS["current_money_format"] = workbook.add_format(

View File

@@ -233,18 +233,17 @@ class ReportStatementCommon(models.AbstractModel):
# All input queries are properly escaped - false positive # All input queries are properly escaped - false positive
self.env.cr.execute( self.env.cr.execute(
""" """
WITH Q1 AS (%s), WITH Q1 AS ({}),
Q2 AS (%s), Q2 AS ({}),
Q3 AS (%s), Q3 AS ({}),
Q4 AS (%s) Q4 AS ({})
SELECT partner_id, currency_id, current, b_1_30, b_30_60, b_60_90, SELECT partner_id, currency_id, current, b_1_30, b_30_60, b_60_90,
b_90_120, b_over_120, b_90_120, b_over_120,
current+b_1_30+b_30_60+b_60_90+b_90_120+b_over_120 current+b_1_30+b_30_60+b_60_90+b_90_120+b_over_120
AS balance AS balance
FROM Q4 FROM Q4
GROUP BY partner_id, currency_id, current, b_1_30, b_30_60, GROUP BY partner_id, currency_id, current, b_1_30, b_30_60,
b_60_90, b_90_120, b_over_120""" b_60_90, b_90_120, b_over_120""".format(
% (
self._show_buckets_sql_q1(partners, date_end, account_type), self._show_buckets_sql_q1(partners, date_end, account_type),
self._show_buckets_sql_q2( self._show_buckets_sql_q2(
full_dates["date_end"], full_dates["date_end"],

View File

@@ -368,20 +368,26 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:77de87887c4a3ada88f9db6a00b25d47dd445dc8bb5c0da54a72841d3c2816a3 !! source digest: sha256:77de87887c4a3ada88f9db6a00b25d47dd445dc8bb5c0da54a72841d3c2816a3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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-financial-reporting/tree/16.0/partner_statement"><img alt="OCA/account-financial-reporting" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-financial-reporting-16-0/account-financial-reporting-16-0-partner_statement"><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-financial-reporting&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><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-financial-reporting/tree/17.0/partner_statement"><img alt="OCA/account-financial-reporting" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-financial-reporting-17-0/account-financial-reporting-17-0-partner_statement"><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-financial-reporting&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>This module extends the functionality of Invoicing to support the printing of customer and vendor statements. <p>This module extends the functionality of Invoicing to support the
There are three types of statements: Activity, Detailed Activity, and Outstanding. Aging details can be shown printing of customer and vendor statements. There are three types of
in the reports, expressed in aging buckets, so the customer or vendor can review how much is open, due or overdue.</p> statements: Activity, Detailed Activity, and Outstanding. Aging details
<p>The activity statement provides details of all activity on the partner receivables or payables can be shown in the reports, expressed in aging buckets, so the customer
between two selected dates. This includes all invoices, refunds and payments. or vendor can review how much is open, due or overdue.</p>
Any outstanding balance dated prior to the chosen statement period will appear <p>The activity statement provides details of all activity on the partner
as a forward balance at the top of the statement. The list is displayed in chronological receivables or payables between two selected dates. This includes all
order and is split by currencies.</p> invoices, refunds and payments. Any outstanding balance dated prior to
<p>The detailed activity statement is an extension of the previous statement, and intends to explain the transactions the chosen statement period will appear as a forward balance at the top
that have happened during the period, also providing with a Prior Balance section and an Ending Balance section.</p> of the statement. The list is displayed in chronological order and is
<p>The outstanding statement provides details of all outstanding partner receivables or payables split by currencies.</p>
up to a particular date. This includes all unpaid invoices, unclaimed refunds and <p>The detailed activity statement is an extension of the previous
outstanding payments. The list is displayed in chronological order and is split by currencies.</p> statement, and intends to explain the transactions that have happened
during the period, also providing with a Prior Balance section and an
Ending Balance section.</p>
<p>The outstanding statement provides details of all outstanding partner
receivables or payables up to a particular date. This includes all
unpaid invoices, unclaimed refunds and outstanding payments. The list is
displayed in chronological order and is split by currencies.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
@@ -404,15 +410,19 @@ outstanding payments. The list is displayed in chronological order and is split
</div> </div>
<div class="section" id="configuration"> <div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1> <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>Users willing to access to this report should have proper Accounting &amp; Finance rights:</p> <p>Users willing to access to this report should have proper Accounting &amp;
Finance rights:</p>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Go to <em>Settings / Users</em> and edit your user to add the corresponding access rights as follows.</li> <li>Go to <em>Settings / Users</em> and edit your user to add the corresponding
<li>In <em>Application / Accounting &amp; Finance</em>, select <em>Billing</em> or <em>Billing Manager</em></li> access rights as follows.</li>
<li>In <em>Application / Accounting &amp; Finance</em>, select <em>Billing</em> or <em>Billing
Manager</em></li>
</ol> </ol>
<p>To configure this module, you need to:</p> <p>To configure this module, you need to:</p>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Go to <em>Invoicing / Configuration / Settings</em></li> <li>Go to <em>Invoicing / Configuration / Settings</em></li>
<li>Under the <em>Partner Statements</em> of <em>Accounting</em> option select either or both of OCA Activity or Outstanding Statement</li> <li>Under the <em>Partner Statements</em> of <em>Accounting</em> option select either
or both of OCA Activity or Outstanding Statement</li>
<li>Once selected, you may set default options for the reports.</li> <li>Once selected, you may set default options for the reports.</li>
<li>Click <em>Save</em></li> <li>Click <em>Save</em></li>
</ol> </ol>
@@ -422,18 +432,24 @@ outstanding payments. The list is displayed in chronological order and is split
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1> <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To use this module, you need to:</p> <p>To use this module, you need to:</p>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Go to a list of Partners, Contacts, Customer or Vendors and select one or more.</li> <li>Go to a list of Partners, Contacts, Customer or Vendors and select
<li>Press Action &gt; Partner Activity Statement or Action &gt; Partner Outstanding Statement respectively.</li> one or more.</li>
<li>Indicate if you want to display receivables or payables, and if you want to display aging buckets and the aging type.</li> <li>Press Action &gt; Partner Activity Statement or Action &gt; Partner
<li>Optionally complete advanced options such as filtering non due or negative balance partners.</li> Outstanding Statement respectively.</li>
<li>Indicate if you want to display receivables or payables, and if you
want to display aging buckets and the aging type.</li>
<li>Optionally complete advanced options such as filtering non due or
negative balance partners.</li>
</ol> </ol>
</div> </div>
<div class="section" id="known-issues-roadmap"> <div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1> <h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
<ul class="simple"> <ul class="simple">
<li>Email template.</li> <li>Email template.</li>
<li>Expose reports (using defaults) to billing users while restricting the wizard to managers option.</li> <li>Expose reports (using defaults) to billing users while restricting
<li>Concept of statement run - to start an async job to send out all statements.</li> the wizard to managers option.</li>
<li>Concept of statement run - to start an async job to send out all
statements.</li>
</ul> </ul>
</div> </div>
<div class="section" id="changelog"> <div class="section" id="changelog">
@@ -441,10 +457,13 @@ outstanding payments. The list is displayed in chronological order and is split
<div class="section" id="section-1"> <div class="section" id="section-1">
<h2><a class="toc-backref" href="#toc-entry-5">12.0.1.0.0 (2018-11-08)</a></h2> <h2><a class="toc-backref" href="#toc-entry-5">12.0.1.0.0 (2018-11-08)</a></h2>
<ul class="simple"> <ul class="simple">
<li>[BREAKING] Modules customer_activity_statement and customer_outstanding_statement merged to create partner_statement.</li> <li>[BREAKING] Modules customer_activity_statement and
<li>[ADD] New features. customer_outstanding_statement merged to create partner_statement.</li>
* Age by months or days <li>[ADD] New features.<ul>
* Filter negative balances</li> <li>Age by months or days</li>
<li>Filter negative balances</li>
</ul>
</li>
</ul> </ul>
</div> </div>
<div class="section" id="section-2"> <div class="section" id="section-2">
@@ -459,7 +478,7 @@ outstanding payments. The list is displayed in chronological order and is split
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-reporting/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-reporting/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 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-financial-reporting/issues/new?body=module:%20partner_statement%0Aversion:%2016.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-financial-reporting/issues/new?body=module:%20partner_statement%0Aversion:%2017.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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -489,7 +508,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</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/MiquelRForgeFlow"><img alt="MiquelRForgeFlow" src="https://github.com/MiquelRForgeFlow.png?size=40px" /></a></p> <p><a class="reference external image-reference" href="https://github.com/MiquelRForgeFlow"><img alt="MiquelRForgeFlow" src="https://github.com/MiquelRForgeFlow.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-reporting/tree/16.0/partner_statement">OCA/account-financial-reporting</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-reporting/tree/17.0/partner_statement">OCA/account-financial-reporting</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> <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>
</div> </div>

View File

@@ -44,7 +44,6 @@ class TestActivityStatement(TransactionCase):
cls.today = fields.Date.context_today(cls.wiz) cls.today = fields.Date.context_today(cls.wiz)
def test_customer_activity_statement(self): def test_customer_activity_statement(self):
wiz_id = self.wiz.with_context( wiz_id = self.wiz.with_context(
active_ids=[self.partner1.id, self.partner2.id] active_ids=[self.partner1.id, self.partner2.id]
).create({}) ).create({})

View File

@@ -38,7 +38,6 @@ class TestOutstandingStatement(TransactionCase):
cls.report_title = "Outstanding Statement" cls.report_title = "Outstanding Statement"
def test_customer_outstanding_statement(self): def test_customer_outstanding_statement(self):
wiz_id = self.wiz.with_context( wiz_id = self.wiz.with_context(
active_ids=[self.partner1.id, self.partner2.id] active_ids=[self.partner1.id, self.partner2.id]
).create({}) ).create({})

View File

@@ -7,7 +7,6 @@ from odoo import api, fields, models
class StatementCommon(models.AbstractModel): class StatementCommon(models.AbstractModel):
_name = "statement.common.wizard" _name = "statement.common.wizard"
_description = "Statement Reports Common Wizard" _description = "Statement Reports Common Wizard"