[IMP] : pre-commit auto fixes
This commit is contained in:
@@ -25,8 +25,12 @@ class ActivityStatement(models.AbstractModel):
|
||||
ELSE l.balance + sum(coalesce(pc.amount, 0.0))
|
||||
END AS open_amount,
|
||||
CASE WHEN l.balance > 0.0
|
||||
THEN l.amount_currency - sum(coalesce(pd.debit_amount_currency, 0.0))
|
||||
ELSE l.amount_currency + sum(coalesce(pc.credit_amount_currency, 0.0))
|
||||
THEN l.amount_currency - sum(coalesce(
|
||||
pd.debit_amount_currency, 0.0)
|
||||
)
|
||||
ELSE l.amount_currency + sum(coalesce(
|
||||
pc.credit_amount_currency, 0.0)
|
||||
)
|
||||
END AS open_amount_currency
|
||||
FROM account_move_line l
|
||||
JOIN account_account aa ON (aa.id = l.account_id)
|
||||
@@ -98,13 +102,12 @@ class ActivityStatement(models.AbstractModel):
|
||||
partners = tuple(partner_ids)
|
||||
# pylint: disable=E8103
|
||||
self.env.cr.execute(
|
||||
"""WITH Q1 AS (%s),
|
||||
Q2 AS (%s),
|
||||
Q3 AS (%s)
|
||||
"""WITH Q1 AS ({}),
|
||||
Q2 AS ({}),
|
||||
Q3 AS ({})
|
||||
SELECT partner_id, currency_id, sum(balance) as balance
|
||||
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_q2("Q1"),
|
||||
self._initial_balance_sql_q3("Q2", company_id),
|
||||
@@ -193,14 +196,13 @@ class ActivityStatement(models.AbstractModel):
|
||||
# pylint: disable=E8103
|
||||
self.env.cr.execute(
|
||||
"""
|
||||
WITH Q1 AS (%s),
|
||||
Q2 AS (%s)
|
||||
WITH Q1 AS ({}),
|
||||
Q2 AS ({})
|
||||
SELECT partner_id, move_id, date, date_maturity, ids,
|
||||
COALESCE(name, '') as name, COALESCE(ref, '') as ref,
|
||||
debit, credit, amount, blocked, currency_id
|
||||
FROM Q2
|
||||
ORDER BY date, date_maturity, move_id"""
|
||||
% (
|
||||
ORDER BY date, date_maturity, move_id""".format(
|
||||
self._display_activity_lines_sql_q1(
|
||||
partners, date_start, date_end, account_type
|
||||
),
|
||||
@@ -282,18 +284,17 @@ class ActivityStatement(models.AbstractModel):
|
||||
# pylint: disable=E8103
|
||||
self.env.cr.execute(
|
||||
"""
|
||||
WITH Q1 AS (%s),
|
||||
Q2 AS (%s),
|
||||
Q3 AS (%s),
|
||||
Q4 AS (%s),
|
||||
Q5 AS (%s),
|
||||
Q6 AS (%s)
|
||||
WITH Q1 AS ({}),
|
||||
Q2 AS ({}),
|
||||
Q3 AS ({}),
|
||||
Q4 AS ({}),
|
||||
Q5 AS ({}),
|
||||
Q6 AS ({})
|
||||
SELECT partner_id, currency_id, move_id, date, date_maturity, debit,
|
||||
credit, amount, open_amount, COALESCE(name, '') as name,
|
||||
COALESCE(ref, '') as ref, blocked, id
|
||||
FROM Q6
|
||||
ORDER BY date, date_maturity, move_id"""
|
||||
% (
|
||||
ORDER BY date, date_maturity, move_id""".format(
|
||||
self._display_activity_lines_sql_q1(
|
||||
partners, date_start, date_end, account_type
|
||||
),
|
||||
|
||||
@@ -29,7 +29,7 @@ class ActivityStatementXslx(models.AbstractModel):
|
||||
report_name = _("Activity Statement")
|
||||
if 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
|
||||
return report_name
|
||||
|
||||
@@ -300,11 +300,12 @@ class ActivityStatementXslx(models.AbstractModel):
|
||||
for currency_id in currencies:
|
||||
currency = self.env["res.currency"].browse(currency_id)
|
||||
if currency.position == "after":
|
||||
money_string = "#,##0.%s " % (
|
||||
"0" * currency.decimal_places
|
||||
) + "[${}]".format(currency.symbol)
|
||||
money_string = (
|
||||
"#,##0.%s " % ("0" * currency.decimal_places)
|
||||
+ f"[${currency.symbol}]"
|
||||
)
|
||||
elif currency.position == "before":
|
||||
money_string = "[${}]".format(currency.symbol) + " #,##0.%s" % (
|
||||
money_string = f"[${currency.symbol}]" + " #,##0.%s" % (
|
||||
"0" * currency.decimal_places
|
||||
)
|
||||
FORMATS["current_money_format"] = workbook.add_format(
|
||||
|
||||
@@ -29,7 +29,7 @@ class DetailedActivityStatementXslx(models.AbstractModel):
|
||||
report_name = _("Detailed Activity Statement")
|
||||
if 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
|
||||
return report_name
|
||||
|
||||
@@ -39,7 +39,8 @@ class DetailedActivityStatementXslx(models.AbstractModel):
|
||||
account_type = data.get("account_type", False)
|
||||
row_pos += 2
|
||||
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 "",
|
||||
"start": partner_data.get("start"),
|
||||
@@ -523,11 +524,12 @@ class DetailedActivityStatementXslx(models.AbstractModel):
|
||||
for currency_id in currencies:
|
||||
currency = self.env["res.currency"].browse(currency_id)
|
||||
if currency.position == "after":
|
||||
money_string = "#,##0.%s " % (
|
||||
"0" * currency.decimal_places
|
||||
) + "[${}]".format(currency.symbol)
|
||||
money_string = (
|
||||
"#,##0.%s " % ("0" * currency.decimal_places)
|
||||
+ f"[${currency.symbol}]"
|
||||
)
|
||||
elif currency.position == "before":
|
||||
money_string = "[${}]".format(currency.symbol) + " #,##0.%s" % (
|
||||
money_string = f"[${currency.symbol}]" + " #,##0.%s" % (
|
||||
"0" * currency.decimal_places
|
||||
)
|
||||
FORMATS["current_money_format"] = workbook.add_format(
|
||||
|
||||
@@ -123,15 +123,14 @@ class OutstandingStatement(models.AbstractModel):
|
||||
# pylint: disable=E8103
|
||||
self.env.cr.execute(
|
||||
"""
|
||||
WITH Q1 as (%s),
|
||||
Q2 AS (%s),
|
||||
Q3 AS (%s)
|
||||
WITH Q1 as ({}),
|
||||
Q2 AS ({}),
|
||||
Q3 AS ({})
|
||||
SELECT partner_id, currency_id, move_id, date, date_maturity, debit,
|
||||
credit, amount, open_amount, COALESCE(name, '') as name,
|
||||
COALESCE(ref, '') as ref, blocked, id
|
||||
FROM Q3
|
||||
ORDER BY date, date_maturity, move_id"""
|
||||
% (
|
||||
ORDER BY date, date_maturity, move_id""".format(
|
||||
self._display_outstanding_lines_sql_q1(
|
||||
partners, date_end, account_type
|
||||
),
|
||||
|
||||
@@ -29,7 +29,7 @@ class OutstandingStatementXslx(models.AbstractModel):
|
||||
report_name = _("Outstanding Statement")
|
||||
if 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
|
||||
return report_name
|
||||
|
||||
@@ -278,11 +278,12 @@ class OutstandingStatementXslx(models.AbstractModel):
|
||||
for currency_id in currencies:
|
||||
currency = self.env["res.currency"].browse(currency_id)
|
||||
if currency.position == "after":
|
||||
money_string = "#,##0.%s " % (
|
||||
"0" * currency.decimal_places
|
||||
) + "[${}]".format(currency.symbol)
|
||||
money_string = (
|
||||
"#,##0.%s " % ("0" * currency.decimal_places)
|
||||
+ f"[${currency.symbol}]"
|
||||
)
|
||||
elif currency.position == "before":
|
||||
money_string = "[${}]".format(currency.symbol) + " #,##0.%s" % (
|
||||
money_string = f"[${currency.symbol}]" + " #,##0.%s" % (
|
||||
"0" * currency.decimal_places
|
||||
)
|
||||
FORMATS["current_money_format"] = workbook.add_format(
|
||||
|
||||
@@ -233,18 +233,17 @@ class ReportStatementCommon(models.AbstractModel):
|
||||
# All input queries are properly escaped - false positive
|
||||
self.env.cr.execute(
|
||||
"""
|
||||
WITH Q1 AS (%s),
|
||||
Q2 AS (%s),
|
||||
Q3 AS (%s),
|
||||
Q4 AS (%s)
|
||||
WITH Q1 AS ({}),
|
||||
Q2 AS ({}),
|
||||
Q3 AS ({}),
|
||||
Q4 AS ({})
|
||||
SELECT partner_id, currency_id, 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
|
||||
FROM Q4
|
||||
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_q2(
|
||||
full_dates["date_end"],
|
||||
|
||||
Reference in New Issue
Block a user