From eadd3076230e5bd944d066b8c6827a69b48e729c Mon Sep 17 00:00:00 2001 From: mariadforgeflow Date: Fri, 4 Feb 2022 14:33:36 +0100 Subject: [PATCH] [IMP] partner_statement: black, isort, prettier --- .../report/activity_statement_xlsx.py | 26 +++++++++---------- .../report/outstanting_statement_xlsx.py | 25 +++++++++--------- .../tests/test_activity_statement.py | 2 +- .../tests/test_outstanding_statement.py | 2 +- .../wizard/activity_statement_wizard.py | 3 ++- partner_statement/wizard/statement_common.py | 1 - 6 files changed, 29 insertions(+), 30 deletions(-) diff --git a/partner_statement/report/activity_statement_xlsx.py b/partner_statement/report/activity_statement_xlsx.py index 5f7cfa14..4f43625d 100644 --- a/partner_statement/report/activity_statement_xlsx.py +++ b/partner_statement/report/activity_statement_xlsx.py @@ -27,14 +27,14 @@ class ActivityStatementXslx(models.AbstractModel): account_type = data.get("account_type", False) row_pos += 2 statement_header = _( - "%sStatement between %s and %s in %s" - % ( - account_type == "payable" and _("Supplier ") or "", - partner_data.get("start"), - partner_data.get("end"), - currency.display_name, - ) - ) + "%(payable)sStatement between %(start)s and %(end)s in %(currency)s" + ) % { + "payable": account_type == "payable" and _("Supplier ") or "", + "start": partner_data.get("start"), + "end": partner_data.get("end"), + "currency": currency.display_name, + } + sheet.merge_range( row_pos, 0, row_pos, 6, statement_header, FORMATS["format_right_bold"] ) @@ -116,10 +116,10 @@ class ActivityStatementXslx(models.AbstractModel): currency_data = partner_data.get("currencies", {}).get(currency.id) if currency_data.get("buckets"): row_pos += 2 - buckets_header = _("Aging Report at %s in %s") % ( - partner_data.get("end"), - currency.display_name, - ) + buckets_header = _("Aging Report at %(end)s in %(currency)s") % { + "end": partner_data.get("end"), + "currency": currency.display_name, + } sheet.merge_range( row_pos, 0, row_pos, 6, buckets_header, FORMATS["format_right_bold"] ) @@ -203,7 +203,7 @@ class ActivityStatementXslx(models.AbstractModel): 0, row_pos, 6, - _("Statement of Account from %s" % (company.display_name)), + _("Statement of Account from %s") % (company.display_name), FORMATS["format_ws_title"], ) row_pos += 1 diff --git a/partner_statement/report/outstanting_statement_xlsx.py b/partner_statement/report/outstanting_statement_xlsx.py index ae84a28c..58ef076e 100644 --- a/partner_statement/report/outstanting_statement_xlsx.py +++ b/partner_statement/report/outstanting_statement_xlsx.py @@ -26,14 +26,12 @@ class OutstandingStatementXslx(models.AbstractModel): currency_data = partner_data.get("currencies", {}).get(currency.id) account_type = data.get("account_type", False) row_pos += 2 - statement_header = _( - "%sStatement up to %s in %s" - % ( - account_type == "payable" and _("Supplier ") or "", - partner_data.get("end"), - currency.display_name, - ) - ) + statement_header = _("%(payable)sStatement up to %(end)s in %(currency)s") % { + "payable": account_type == "payable" and _("Supplier ") or "", + "end": partner_data.get("end"), + "currency": currency.display_name, + } + sheet.merge_range( row_pos, 0, row_pos, 6, statement_header, FORMATS["format_right_bold"] ) @@ -106,10 +104,11 @@ class OutstandingStatementXslx(models.AbstractModel): currency_data = partner_data.get("currencies", {}).get(currency.id) if currency_data.get("buckets"): row_pos += 2 - buckets_header = _("Aging Report at %s in %s") % ( - partner_data.get("end"), - currency.display_name, - ) + buckets_header = _("Aging Report at %(end)s in %(currency)s") % { + "end": partner_data.get("end"), + "currency": currency.display_name, + } + sheet.merge_range( row_pos, 0, row_pos, 6, buckets_header, FORMATS["format_right_bold"] ) @@ -193,7 +192,7 @@ class OutstandingStatementXslx(models.AbstractModel): 0, row_pos, 6, - _("Statement of Account from %s" % (company.display_name)), + _("Statement of Account from %s") % (company.display_name), FORMATS["format_ws_title"], ) row_pos += 1 diff --git a/partner_statement/tests/test_activity_statement.py b/partner_statement/tests/test_activity_statement.py index ac052286..7b78c67b 100644 --- a/partner_statement/tests/test_activity_statement.py +++ b/partner_statement/tests/test_activity_statement.py @@ -8,7 +8,7 @@ from odoo.tests.common import TransactionCase class TestActivityStatement(TransactionCase): - """ Tests for Activity Statement.""" + """Tests for Activity Statement.""" def setUp(self): super().setUp() diff --git a/partner_statement/tests/test_outstanding_statement.py b/partner_statement/tests/test_outstanding_statement.py index 7481e804..baede255 100644 --- a/partner_statement/tests/test_outstanding_statement.py +++ b/partner_statement/tests/test_outstanding_statement.py @@ -5,7 +5,7 @@ from odoo.tests.common import TransactionCase class TestOutstandingStatement(TransactionCase): - """ Tests for Outstanding Statement.""" + """Tests for Outstanding Statement.""" def setUp(self): super().setUp() diff --git a/partner_statement/wizard/activity_statement_wizard.py b/partner_statement/wizard/activity_statement_wizard.py index 5cfa3c88..49fdf85e 100644 --- a/partner_statement/wizard/activity_statement_wizard.py +++ b/partner_statement/wizard/activity_statement_wizard.py @@ -23,11 +23,12 @@ class ActivityStatementWizard(models.TransientModel): @api.onchange("aging_type") def onchange_aging_type(self): - super().onchange_aging_type() + res = super().onchange_aging_type() if self.aging_type == "months": self.date_start = self.date_end.replace(day=1) else: self.date_start = self.date_end - relativedelta(days=30) + return res def _prepare_statement(self): res = super()._prepare_statement() diff --git a/partner_statement/wizard/statement_common.py b/partner_statement/wizard/statement_common.py index 769bc615..bb0f71d8 100644 --- a/partner_statement/wizard/statement_common.py +++ b/partner_statement/wizard/statement_common.py @@ -37,7 +37,6 @@ class StatementCommon(models.AbstractModel): account_type = fields.Selection( [("receivable", "Receivable"), ("payable", "Payable")], - string="Account type", default="receivable", )