Browse Source

[MIG] partner_statement: Migration to 13.0

pull/654/head
mreficent 4 years ago
parent
commit
69b868cbc6
  1. 18
      partner_statement/README.rst
  2. 8
      partner_statement/__manifest__.py
  3. 2
      partner_statement/i18n/partner_statement.pot
  4. 2
      partner_statement/readme/CONTRIBUTORS.rst
  5. 15
      partner_statement/report/activity_statement.py
  6. 12
      partner_statement/report/outstanding_statement.py
  7. 11
      partner_statement/report/report_statement_common.py
  8. 12
      partner_statement/static/description/index.html
  9. 12
      partner_statement/tests/test_activity_statement.py
  10. 10
      partner_statement/tests/test_outstanding_statement.py
  11. 2
      partner_statement/tests/test_res_config_settings.py
  12. 2
      partner_statement/views/activity_statement.xml
  13. 2
      partner_statement/views/aging_buckets.xml
  14. 2
      partner_statement/views/assets.xml
  15. 2
      partner_statement/views/outstanding_statement.xml
  16. 5
      partner_statement/views/res_config_settings.xml
  17. 7
      partner_statement/wizard/activity_statement_wizard.py
  18. 7
      partner_statement/wizard/outstanding_statement_wizard.py
  19. 1
      partner_statement/wizard/statement_common.py
  20. 10
      partner_statement/wizard/statement_wizard.xml

18
partner_statement/README.rst

@ -14,18 +14,18 @@ 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/12.0/partner_statement
:target: https://github.com/OCA/account-financial-reporting/tree/13.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-12-0/account-financial-reporting-12-0-partner_statement
:target: https://translation.odoo-community.org/projects/account-financial-reporting-13-0/account-financial-reporting-13-0-partner_statement
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/91/12.0
:target: https://runbot.odoo-community.org/runbot/91/13.0
:alt: Try me on Runbot :alt: Try me on Runbot
|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 printing of customer and vendor statements.
There are two types of statements, Activity and Outstanding. Aging details can be shown in the reports, expressed in aging buckets, There are two types of statements, 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. so the customer or vendor can review how much is open, due or overdue.
@ -96,7 +96,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 smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20partner_statement%0Aversion:%2012.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:%2013.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.
@ -106,12 +106,12 @@ Credits
Authors Authors
~~~~~~~ ~~~~~~~
* Eficent
* ForgeFlow
Contributors Contributors
~~~~~~~~~~~~ ~~~~~~~~~~~~
* Miquel Raïch <miquel.raich@eficent.com>
* Miquel Raïch <miquel.raich@forgeflow.com>
* Graeme Gellatly <graeme@o4sb.com> * Graeme Gellatly <graeme@o4sb.com>
Maintainers Maintainers
@ -127,6 +127,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/12.0/partner_statement>`_ project on GitHub.
This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/13.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.

8
partner_statement/__manifest__.py

@ -1,16 +1,16 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2018 ForgeFlow, S.L. (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{ {
"name": "Partner Statement", "name": "Partner Statement",
"version": "12.0.1.0.5",
"version": "13.0.1.0.0",
"category": "Accounting & Finance", "category": "Accounting & Finance",
"summary": "OCA Financial Reports", "summary": "OCA Financial Reports",
"author": "Eficent, Odoo Community Association (OCA)",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-reporting", "website": "https://github.com/OCA/account-financial-reporting",
"license": "AGPL-3", "license": "AGPL-3",
"depends": ["account"], "depends": ["account"],
"external_dependencies": {"python": ["dateutil"]},
"data": [ "data": [
"security/statement_security.xml", "security/statement_security.xml",
"views/activity_statement.xml", "views/activity_statement.xml",

2
partner_statement/i18n/partner_statement.pot

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"

2
partner_statement/readme/CONTRIBUTORS.rst

@ -1,2 +1,2 @@
* Miquel Raïch <miquel.raich@eficent.com>
* Miquel Raïch <miquel.raich@forgeflow.com>
* Graeme Gellatly <graeme@o4sb.com> * Graeme Gellatly <graeme@o4sb.com>

15
partner_statement/report/activity_statement.py

@ -1,5 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from collections import defaultdict from collections import defaultdict
@ -12,6 +11,7 @@ class ActivityStatement(models.AbstractModel):
_inherit = "statement.common" _inherit = "statement.common"
_name = "report.partner_statement.activity_statement" _name = "report.partner_statement.activity_statement"
_description = "Partner Activity Statement"
def _initial_balance_sql_q1(self, partners, date_start, account_type): def _initial_balance_sql_q1(self, partners, date_start, account_type):
return str( return str(
@ -27,9 +27,9 @@ class ActivityStatement(models.AbstractModel):
ELSE sum(l.credit) ELSE sum(l.credit)
END as credit END as credit
FROM account_move_line l FROM account_move_line l
JOIN account_account_type at ON (at.id = l.user_type_id)
JOIN account_move m ON (l.move_id = m.id) JOIN account_move m ON (l.move_id = m.id)
WHERE l.partner_id IN %(partners)s AND at.type = %(account_type)s
WHERE l.partner_id IN %(partners)s
AND l.account_internal_type = %(account_type)s
AND l.date < %(date_start)s AND not l.blocked AND l.date < %(date_start)s AND not l.blocked
AND m.state IN ('posted') AND m.state IN ('posted')
GROUP BY l.partner_id, l.currency_id, l.amount_currency, GROUP BY l.partner_id, l.currency_id, l.amount_currency,
@ -103,11 +103,10 @@ class ActivityStatement(models.AbstractModel):
ELSE l.date_maturity ELSE l.date_maturity
END as date_maturity END as date_maturity
FROM account_move_line l FROM account_move_line l
JOIN account_account_type at ON (at.id = l.user_type_id)
JOIN account_move m ON (l.move_id = m.id) JOIN account_move m ON (l.move_id = m.id)
JOIN account_journal aj ON (l.journal_id = aj.id) JOIN account_journal aj ON (l.journal_id = aj.id)
WHERE l.partner_id IN %(partners)s WHERE l.partner_id IN %(partners)s
AND at.type = %(account_type)s
AND l.account_internal_type = %(account_type)s
AND %(date_start)s <= l.date AND %(date_start)s <= l.date
AND l.date <= %(date_end)s AND l.date <= %(date_end)s
AND m.state IN ('posted') AND m.state IN ('posted')
@ -172,8 +171,8 @@ class ActivityStatement(models.AbstractModel):
res[row.pop("partner_id")].append(row) res[row.pop("partner_id")].append(row)
return res return res
@api.multi
def _get_report_values(self, docids, data):
@api.model
def _get_report_values(self, docids, data=None):
if not data: if not data:
data = {} data = {}
if "company_id" not in data: if "company_id" not in data:

12
partner_statement/report/outstanding_statement.py

@ -1,5 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, models from odoo import api, models
@ -10,6 +9,7 @@ class OutstandingStatement(models.AbstractModel):
_inherit = "statement.common" _inherit = "statement.common"
_name = "report.partner_statement.outstanding_statement" _name = "report.partner_statement.outstanding_statement"
_description = "Partner Outstanding Statement"
def _display_lines_sql_q1(self, partners, date_end, account_type): def _display_lines_sql_q1(self, partners, date_end, account_type):
partners = tuple(partners) partners = tuple(partners)
@ -39,7 +39,6 @@ class OutstandingStatement(models.AbstractModel):
ELSE l.date_maturity ELSE l.date_maturity
END as date_maturity END as date_maturity
FROM account_move_line l FROM account_move_line l
JOIN account_account_type at ON (at.id = l.user_type_id)
JOIN account_move m ON (l.move_id = m.id) JOIN account_move m ON (l.move_id = m.id)
LEFT JOIN (SELECT pr.* LEFT JOIN (SELECT pr.*
FROM account_partial_reconcile pr FROM account_partial_reconcile pr
@ -53,7 +52,8 @@ class OutstandingStatement(models.AbstractModel):
ON pr.debit_move_id = l2.id ON pr.debit_move_id = l2.id
WHERE l2.date <= %(date_end)s WHERE l2.date <= %(date_end)s
) as pc ON pc.credit_move_id = l.id ) as pc ON pc.credit_move_id = l.id
WHERE l.partner_id IN %(partners)s AND at.type = %(account_type)s
WHERE l.partner_id IN %(partners)s
AND l.account_internal_type = %(account_type)s
AND ( AND (
(pd.id IS NOT NULL AND (pd.id IS NOT NULL AND
pd.max_date <= %(date_end)s) OR pd.max_date <= %(date_end)s) OR
@ -131,8 +131,8 @@ class OutstandingStatement(models.AbstractModel):
res[row.pop("partner_id")].append(row) res[row.pop("partner_id")].append(row)
return res return res
@api.multi
def _get_report_values(self, docids, data):
@api.model
def _get_report_values(self, docids, data=None):
if not data: if not data:
data = {} data = {}
if "company_id" not in data: if "company_id" not in data:

11
partner_statement/report/report_statement_common.py

@ -1,5 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime, timedelta from datetime import datetime, timedelta
@ -53,7 +52,6 @@ class ReportStatementCommon(models.AbstractModel):
ELSE l.date_maturity ELSE l.date_maturity
END as date_maturity END as date_maturity
FROM account_move_line l FROM account_move_line l
JOIN account_account_type at ON (at.id = l.user_type_id)
JOIN account_move m ON (l.move_id = m.id) JOIN account_move m ON (l.move_id = m.id)
LEFT JOIN (SELECT pr.* LEFT JOIN (SELECT pr.*
FROM account_partial_reconcile pr FROM account_partial_reconcile pr
@ -67,7 +65,8 @@ class ReportStatementCommon(models.AbstractModel):
ON pr.debit_move_id = l2.id ON pr.debit_move_id = l2.id
WHERE l2.date <= %(date_end)s WHERE l2.date <= %(date_end)s
) as pc ON pc.credit_move_id = l.id ) as pc ON pc.credit_move_id = l.id
WHERE l.partner_id IN %(partners)s AND at.type = %(account_type)s
WHERE l.partner_id IN %(partners)s
AND l.account_internal_type = %(account_type)s
AND ( AND (
(pd.id IS NOT NULL AND (pd.id IS NOT NULL AND
pd.max_date <= %(date_end)s) OR pd.max_date <= %(date_end)s) OR
@ -289,8 +288,8 @@ class ReportStatementCommon(models.AbstractModel):
currencies, currencies,
) )
@api.multi
def _get_report_values(self, docids, data):
@api.model # noqa: C901
def _get_report_values(self, docids, data=None):
""" """
@return: returns a dict of parameters to pass to qweb report. @return: returns a dict of parameters to pass to qweb report.
the most important pair is {'data': res} which contains all the most important pair is {'data': res} which contains all

12
partner_statement/static/description/index.html

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/account-financial-reporting/tree/12.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" href="https://translation.odoo-community.org/projects/account-financial-reporting-12-0/account-financial-reporting-12-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" href="https://runbot.odoo-community.org/runbot/91/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/account-financial-reporting/tree/13.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" href="https://translation.odoo-community.org/projects/account-financial-reporting-13-0/account-financial-reporting-13-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" href="https://runbot.odoo-community.org/runbot/91/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-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 printing of customer and vendor statements.
There are two types of statements, Activity and Outstanding. Aging details can be shown in the reports, expressed in aging buckets, There are two types of statements, 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.</p> so the customer or vendor can review how much is open, due or overdue.</p>
@ -386,7 +386,7 @@ outstanding payments. The list is displayed in chronological order and is split
<li><a class="reference internal" href="#usage" id="id3">Usage</a></li> <li><a class="reference internal" href="#usage" id="id3">Usage</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id4">Known issues / Roadmap</a></li> <li><a class="reference internal" href="#known-issues-roadmap" id="id4">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#changelog" id="id5">Changelog</a><ul> <li><a class="reference internal" href="#changelog" id="id5">Changelog</a><ul>
<li><a class="reference internal" href="#id1" id="id6">12.0.1.0.0 (2018-11-08)</a></li>
<li><a class="reference internal" href="#id1" id="id6">13.0.1.0.0 (2018-11-08)</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#bug-tracker" id="id7">Bug Tracker</a></li> <li><a class="reference internal" href="#bug-tracker" id="id7">Bug Tracker</a></li>
@ -449,7 +449,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 smashing it by providing a detailed and welcomed If you spotted it first, help us smashing 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:%2012.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:%2013.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">
@ -457,13 +457,13 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id9">Authors</a></h2> <h2><a class="toc-backref" href="#id9">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Eficent</li>
<li>ForgeFlow</li>
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id10">Contributors</a></h2> <h2><a class="toc-backref" href="#id10">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Miquel Raïch &lt;<a class="reference external" href="mailto:miquel.raich&#64;eficent.com">miquel.raich&#64;eficent.com</a>&gt;</li>
<li>Miquel Raïch &lt;<a class="reference external" href="mailto:miquel.raich&#64;forgeflow.com">miquel.raich&#64;forgeflow.com</a>&gt;</li>
<li>Graeme Gellatly &lt;<a class="reference external" href="mailto:graeme&#64;o4sb.com">graeme&#64;o4sb.com</a>&gt;</li> <li>Graeme Gellatly &lt;<a class="reference external" href="mailto:graeme&#64;o4sb.com">graeme&#64;o4sb.com</a>&gt;</li>
</ul> </ul>
</div> </div>
@ -474,7 +474,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-reporting/tree/12.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/13.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>

12
partner_statement/tests/test_activity_statement.py

@ -1,5 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import date from datetime import date
@ -9,15 +8,16 @@ from odoo.tests.common import TransactionCase
class TestActivityStatement(TransactionCase): class TestActivityStatement(TransactionCase):
"""
Tests for Activity Statement.
"""
""" Tests for Activity Statement."""
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.res_users_model = self.env["res.users"] self.res_users_model = self.env["res.users"]
self.company = self.env.ref("base.main_company") self.company = self.env.ref("base.main_company")
self.company.external_report_layout_id = self.env.ref(
"web.external_layout_standard"
)
self.partner1 = self.env.ref("base.res_partner_1") self.partner1 = self.env.ref("base.res_partner_1")
self.partner2 = self.env.ref("base.res_partner_2") self.partner2 = self.env.ref("base.res_partner_2")
self.g_account_user = self.env.ref("account.group_account_user") self.g_account_user = self.env.ref("account.group_account_user")
@ -98,7 +98,7 @@ class TestActivityStatement(TransactionCase):
self.assertEqual(res, "30/09/2018") self.assertEqual(res, "30/09/2018")
def test_onchange_aging_type(self): def test_onchange_aging_type(self):
"""Test that partner data is filled accodingly"""
"""Test that partner data is filled accordingly"""
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]
).new() ).new()

10
partner_statement/tests/test_outstanding_statement.py

@ -1,20 +1,20 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase from odoo.tests.common import TransactionCase
class TestOutstandingStatement(TransactionCase): class TestOutstandingStatement(TransactionCase):
"""
Tests for Outstanding Statement.
"""
""" Tests for Outstanding Statement."""
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.res_users_model = self.env["res.users"] self.res_users_model = self.env["res.users"]
self.company = self.env.ref("base.main_company") self.company = self.env.ref("base.main_company")
self.company.external_report_layout_id = self.env.ref(
"web.external_layout_standard"
)
self.partner1 = self.env.ref("base.res_partner_2") self.partner1 = self.env.ref("base.res_partner_2")
self.partner2 = self.env.ref("base.res_partner_3") self.partner2 = self.env.ref("base.res_partner_3")
self.g_account_user = self.env.ref("account.group_account_user") self.g_account_user = self.env.ref("account.group_account_user")

2
partner_statement/tests/test_res_config_settings.py

@ -14,7 +14,7 @@ class TestResConfigSettings(TransactionCase):
"ORDER BY uid DESC LIMIT 1" "ORDER BY uid DESC LIMIT 1"
) )
self.account_user = self.cr.fetchone()[0] self.account_user = self.cr.fetchone()[0]
self.user_obj = self.env["res.users"].sudo(self.account_user)
self.user_obj = self.env["res.users"].with_user(self.account_user)
def test_groups(self): def test_groups(self):
conf = self.config.create( conf = self.config.create(

2
partner_statement/views/activity_statement.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
<!-- Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<template id="partner_statement.activity_statement_document"> <template id="partner_statement.activity_statement_document">

2
partner_statement/views/aging_buckets.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
<!-- Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<template id="aging_buckets"> <template id="aging_buckets">

2
partner_statement/views/assets.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
<!-- Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<template <template

2
partner_statement/views/outstanding_statement.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
<!-- Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<template id="partner_statement.outstanding_statement_document"> <template id="partner_statement.outstanding_statement_document">

5
partner_statement/views/res_config_settings.xml

@ -6,7 +6,10 @@
<field name="priority" eval="40" /> <field name="priority" eval="40" />
<field name="inherit_id" ref="account.res_config_settings_view_form" /> <field name="inherit_id" ref="account.res_config_settings_view_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//div[@id='account_followup']" position="after">
<xpath
expr="//field[@name='module_account_payment']/../.."
position="after"
>
<div class="col-12 col-lg-6 o_setting_box"> <div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane"> <div class="o_setting_left_pane">
<field name="group_activity_statement" /> <field name="group_activity_statement" />

7
partner_statement/wizard/activity_statement_wizard.py

@ -1,5 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2018 ForgeFlow, S.L. (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
@ -34,8 +33,8 @@ class ActivityStatementWizard(models.TransientModel):
"""Export to PDF.""" """Export to PDF."""
data = self._prepare_statement() data = self._prepare_statement()
return self.env.ref( return self.env.ref(
"partner_statement" ".action_print_activity_statement"
).report_action(self, data=data)
"partner_statement.action_print_activity_statement"
).report_action(self.ids, data=data)
def _prepare_statement(self): def _prepare_statement(self):
res = super()._prepare_statement() res = super()._prepare_statement()

7
partner_statement/wizard/outstanding_statement_wizard.py

@ -1,5 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2018 ForgeFlow, S.L. (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models from odoo import models
@ -16,5 +15,5 @@ class OutstandingStatementWizard(models.TransientModel):
"""Export to PDF.""" """Export to PDF."""
data = self._prepare_statement() data = self._prepare_statement()
return self.env.ref( return self.env.ref(
"partner_statement" ".action_print_outstanding_statement"
).report_action(self, data=data)
"partner_statement.action_print_outstanding_statement"
).report_action(self.ids, data=data)

1
partner_statement/wizard/statement_common.py

@ -56,7 +56,6 @@ class StatementCommon(models.AbstractModel):
else: else:
self.date_end = fields.Date.context_today(self) self.date_end = fields.Date.context_today(self)
@api.multi
def button_export_pdf(self): def button_export_pdf(self):
self.ensure_one() self.ensure_one()
return self._export() return self._export()

10
partner_statement/wizard/statement_wizard.xml

@ -1,27 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
<!-- Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<!-- wizard action on res.partner --> <!-- wizard action on res.partner -->
<act_window <act_window
id="activity_statement_wizard_action" id="activity_statement_wizard_action"
name="Partner Activity Statement" name="Partner Activity Statement"
src_model="res.partner"
binding_model="res.partner"
res_model="activity.statement.wizard" res_model="activity.statement.wizard"
view_type="form"
view_mode="form" view_mode="form"
key2="client_action_multi"
target="new" target="new"
groups="partner_statement.group_activity_statement" groups="partner_statement.group_activity_statement"
/> />
<act_window <act_window
id="outstanding_statement_wizard_action" id="outstanding_statement_wizard_action"
name="Partner Outstanding Statement" name="Partner Outstanding Statement"
src_model="res.partner"
binding_model="res.partner"
res_model="outstanding.statement.wizard" res_model="outstanding.statement.wizard"
view_type="form"
view_mode="form" view_mode="form"
key2="client_action_multi"
target="new" target="new"
groups="partner_statement.group_outstanding_statement" groups="partner_statement.group_outstanding_statement"
/> />

Loading…
Cancel
Save