[IMP] partner_statement: black, isort, prettier
parent
b24cd6ca38
commit
eadd307623
|
@ -27,14 +27,14 @@ class ActivityStatementXslx(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 = _(
|
||||||
"%sStatement between %s and %s in %s"
|
"%(payable)sStatement between %(start)s and %(end)s in %(currency)s"
|
||||||
% (
|
) % {
|
||||||
account_type == "payable" and _("Supplier ") or "",
|
"payable": account_type == "payable" and _("Supplier ") or "",
|
||||||
partner_data.get("start"),
|
"start": partner_data.get("start"),
|
||||||
partner_data.get("end"),
|
"end": partner_data.get("end"),
|
||||||
currency.display_name,
|
"currency": currency.display_name,
|
||||||
)
|
}
|
||||||
)
|
|
||||||
sheet.merge_range(
|
sheet.merge_range(
|
||||||
row_pos, 0, row_pos, 6, statement_header, FORMATS["format_right_bold"]
|
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)
|
currency_data = partner_data.get("currencies", {}).get(currency.id)
|
||||||
if currency_data.get("buckets"):
|
if currency_data.get("buckets"):
|
||||||
row_pos += 2
|
row_pos += 2
|
||||||
buckets_header = _("Aging Report at %s in %s") % (
|
buckets_header = _("Aging Report at %(end)s in %(currency)s") % {
|
||||||
partner_data.get("end"),
|
"end": partner_data.get("end"),
|
||||||
currency.display_name,
|
"currency": currency.display_name,
|
||||||
)
|
}
|
||||||
sheet.merge_range(
|
sheet.merge_range(
|
||||||
row_pos, 0, row_pos, 6, buckets_header, FORMATS["format_right_bold"]
|
row_pos, 0, row_pos, 6, buckets_header, FORMATS["format_right_bold"]
|
||||||
)
|
)
|
||||||
|
@ -203,7 +203,7 @@ class ActivityStatementXslx(models.AbstractModel):
|
||||||
0,
|
0,
|
||||||
row_pos,
|
row_pos,
|
||||||
6,
|
6,
|
||||||
_("Statement of Account from %s" % (company.display_name)),
|
_("Statement of Account from %s") % (company.display_name),
|
||||||
FORMATS["format_ws_title"],
|
FORMATS["format_ws_title"],
|
||||||
)
|
)
|
||||||
row_pos += 1
|
row_pos += 1
|
||||||
|
|
|
@ -26,14 +26,12 @@ class OutstandingStatementXslx(models.AbstractModel):
|
||||||
currency_data = partner_data.get("currencies", {}).get(currency.id)
|
currency_data = partner_data.get("currencies", {}).get(currency.id)
|
||||||
account_type = data.get("account_type", False)
|
account_type = data.get("account_type", False)
|
||||||
row_pos += 2
|
row_pos += 2
|
||||||
statement_header = _(
|
statement_header = _("%(payable)sStatement up to %(end)s in %(currency)s") % {
|
||||||
"%sStatement up to %s in %s"
|
"payable": account_type == "payable" and _("Supplier ") or "",
|
||||||
% (
|
"end": partner_data.get("end"),
|
||||||
account_type == "payable" and _("Supplier ") or "",
|
"currency": currency.display_name,
|
||||||
partner_data.get("end"),
|
}
|
||||||
currency.display_name,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
sheet.merge_range(
|
sheet.merge_range(
|
||||||
row_pos, 0, row_pos, 6, statement_header, FORMATS["format_right_bold"]
|
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)
|
currency_data = partner_data.get("currencies", {}).get(currency.id)
|
||||||
if currency_data.get("buckets"):
|
if currency_data.get("buckets"):
|
||||||
row_pos += 2
|
row_pos += 2
|
||||||
buckets_header = _("Aging Report at %s in %s") % (
|
buckets_header = _("Aging Report at %(end)s in %(currency)s") % {
|
||||||
partner_data.get("end"),
|
"end": partner_data.get("end"),
|
||||||
currency.display_name,
|
"currency": currency.display_name,
|
||||||
)
|
}
|
||||||
|
|
||||||
sheet.merge_range(
|
sheet.merge_range(
|
||||||
row_pos, 0, row_pos, 6, buckets_header, FORMATS["format_right_bold"]
|
row_pos, 0, row_pos, 6, buckets_header, FORMATS["format_right_bold"]
|
||||||
)
|
)
|
||||||
|
@ -193,7 +192,7 @@ class OutstandingStatementXslx(models.AbstractModel):
|
||||||
0,
|
0,
|
||||||
row_pos,
|
row_pos,
|
||||||
6,
|
6,
|
||||||
_("Statement of Account from %s" % (company.display_name)),
|
_("Statement of Account from %s") % (company.display_name),
|
||||||
FORMATS["format_ws_title"],
|
FORMATS["format_ws_title"],
|
||||||
)
|
)
|
||||||
row_pos += 1
|
row_pos += 1
|
||||||
|
|
|
@ -8,7 +8,7 @@ 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()
|
||||||
|
|
|
@ -5,7 +5,7 @@ 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()
|
||||||
|
|
|
@ -23,11 +23,12 @@ class ActivityStatementWizard(models.TransientModel):
|
||||||
|
|
||||||
@api.onchange("aging_type")
|
@api.onchange("aging_type")
|
||||||
def onchange_aging_type(self):
|
def onchange_aging_type(self):
|
||||||
super().onchange_aging_type()
|
res = super().onchange_aging_type()
|
||||||
if self.aging_type == "months":
|
if self.aging_type == "months":
|
||||||
self.date_start = self.date_end.replace(day=1)
|
self.date_start = self.date_end.replace(day=1)
|
||||||
else:
|
else:
|
||||||
self.date_start = self.date_end - relativedelta(days=30)
|
self.date_start = self.date_end - relativedelta(days=30)
|
||||||
|
return res
|
||||||
|
|
||||||
def _prepare_statement(self):
|
def _prepare_statement(self):
|
||||||
res = super()._prepare_statement()
|
res = super()._prepare_statement()
|
||||||
|
|
|
@ -37,7 +37,6 @@ class StatementCommon(models.AbstractModel):
|
||||||
|
|
||||||
account_type = fields.Selection(
|
account_type = fields.Selection(
|
||||||
[("receivable", "Receivable"), ("payable", "Payable")],
|
[("receivable", "Receivable"), ("payable", "Payable")],
|
||||||
string="Account type",
|
|
||||||
default="receivable",
|
default="receivable",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue