[IMP] partner_statement: remove "blocked" feature
If someone comes from v17 or older Odoo versions, and they still have "blocked" lines, there are three options for them: - Develop glue module with another module that contains "blocked" field. - Don't use this commit. - Solve the "blocked" lines. Good luck!
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
# 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 . import models
|
|
||||||
from . import report
|
from . import report
|
||||||
from . import wizard
|
from . import wizard
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
from . import account_move_line
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
from odoo import fields, models
|
|
||||||
|
|
||||||
|
|
||||||
class AccountMoveLine(models.Model):
|
|
||||||
_inherit = "account.move.line"
|
|
||||||
|
|
||||||
# === Misc Information === #
|
|
||||||
blocked = fields.Boolean(
|
|
||||||
string="No Follow-up",
|
|
||||||
default=False,
|
|
||||||
help="You can check this box to mark this journal item "
|
|
||||||
"as a litigation with the associated partner",
|
|
||||||
)
|
|
||||||
@@ -88,7 +88,7 @@ class ActivityStatement(models.AbstractModel):
|
|||||||
) 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
|
WHERE l.partner_id IN %(partners)s
|
||||||
AND aa.id not in %(excluded_accounts_ids)s
|
AND aa.id not in %(excluded_accounts_ids)s
|
||||||
AND l.date < %(date_start)s AND not l.blocked
|
AND l.date < %(date_start)s
|
||||||
AND m.state IN ('posted')
|
AND m.state IN ('posted')
|
||||||
AND aa.account_type = %(account_type)s
|
AND aa.account_type = %(account_type)s
|
||||||
AND (
|
AND (
|
||||||
@@ -181,7 +181,7 @@ class ActivityStatement(models.AbstractModel):
|
|||||||
THEN %(payment_ref)s
|
THEN %(payment_ref)s
|
||||||
ELSE m.ref
|
ELSE m.ref
|
||||||
END as case_ref,
|
END as case_ref,
|
||||||
l.blocked, l.currency_id, l.company_id,
|
l.currency_id, l.company_id,
|
||||||
sum(CASE WHEN (l.currency_id is not null AND l.amount_currency > 0.0)
|
sum(CASE WHEN (l.currency_id is not null AND l.amount_currency > 0.0)
|
||||||
THEN l.amount_currency
|
THEN l.amount_currency
|
||||||
ELSE l.debit
|
ELSE l.debit
|
||||||
@@ -213,7 +213,7 @@ class ActivityStatement(models.AbstractModel):
|
|||||||
CASE WHEN (aj.type IN ('sale', 'purchase'))
|
CASE WHEN (aj.type IN ('sale', 'purchase'))
|
||||||
THEN l.name
|
THEN l.name
|
||||||
ELSE '/'
|
ELSE '/'
|
||||||
END, case_ref, l.blocked, l.currency_id, l.company_id
|
END, case_ref, l.currency_id, l.company_id
|
||||||
""",
|
""",
|
||||||
locals(),
|
locals(),
|
||||||
),
|
),
|
||||||
@@ -226,7 +226,7 @@ class ActivityStatement(models.AbstractModel):
|
|||||||
f"""
|
f"""
|
||||||
SELECT {sub}.partner_id, {sub}.move_id, {sub}.date, {sub}.date_maturity,
|
SELECT {sub}.partner_id, {sub}.move_id, {sub}.date, {sub}.date_maturity,
|
||||||
{sub}.name, {sub}.case_ref as ref, {sub}.debit, {sub}.credit, {sub}.ids,
|
{sub}.name, {sub}.case_ref as ref, {sub}.debit, {sub}.credit, {sub}.ids,
|
||||||
{sub}.debit-{sub}.credit as amount, {sub}.blocked,
|
{sub}.debit-{sub}.credit as amount,
|
||||||
COALESCE({sub}.currency_id, c.currency_id) AS currency_id
|
COALESCE({sub}.currency_id, c.currency_id) AS currency_id
|
||||||
FROM {sub}
|
FROM {sub}
|
||||||
JOIN res_company c ON (c.id = {sub}.company_id)
|
JOIN res_company c ON (c.id = {sub}.company_id)
|
||||||
@@ -250,7 +250,7 @@ class ActivityStatement(models.AbstractModel):
|
|||||||
Q2 AS ({})
|
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, currency_id
|
||||||
FROM Q2
|
FROM Q2
|
||||||
ORDER BY date, date_maturity, move_id""".format(
|
ORDER BY date, date_maturity, move_id""".format(
|
||||||
self._display_activity_lines_sql_q1(
|
self._display_activity_lines_sql_q1(
|
||||||
@@ -280,7 +280,7 @@ class ActivityStatement(models.AbstractModel):
|
|||||||
self._cr.mogrify(
|
self._cr.mogrify(
|
||||||
f"""
|
f"""
|
||||||
SELECT l.id as rel_id, m.name AS move_id, l.partner_id, l.date, l.name,
|
SELECT l.id as rel_id, m.name AS move_id, l.partner_id, l.date, l.name,
|
||||||
l.blocked, l.currency_id, l.company_id, {sub}.id,
|
l.currency_id, l.company_id, {sub}.id,
|
||||||
CASE WHEN l.ref IS NOT NULL
|
CASE WHEN l.ref IS NOT NULL
|
||||||
THEN l.ref
|
THEN l.ref
|
||||||
ELSE m.ref
|
ELSE m.ref
|
||||||
@@ -319,7 +319,7 @@ class ActivityStatement(models.AbstractModel):
|
|||||||
THEN l.ref
|
THEN l.ref
|
||||||
ELSE m.ref
|
ELSE m.ref
|
||||||
END, {sub}.id,
|
END, {sub}.id,
|
||||||
l.blocked, l.currency_id, l.balance, l.amount_currency, l.company_id
|
l.currency_id, l.balance, l.amount_currency, l.company_id
|
||||||
""",
|
""",
|
||||||
locals(),
|
locals(),
|
||||||
),
|
),
|
||||||
@@ -342,7 +342,7 @@ class ActivityStatement(models.AbstractModel):
|
|||||||
Q6 AS ({})
|
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, id
|
||||||
FROM Q6
|
FROM Q6
|
||||||
ORDER BY date, date_maturity, move_id""".format(
|
ORDER BY date, date_maturity, move_id""".format(
|
||||||
self._display_activity_lines_sql_q1(
|
self._display_activity_lines_sql_q1(
|
||||||
|
|||||||
@@ -105,16 +105,10 @@ class ActivityStatementXslx(models.AbstractModel):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _get_currency_line_row_data(self, partner, currency, data, line):
|
def _get_currency_line_row_data(self, partner, currency, data, line):
|
||||||
if line.get("blocked"):
|
format_tcell_left = FORMATS["format_tcell_left"]
|
||||||
format_tcell_left = FORMATS["format_tcell_left_blocked"]
|
format_tcell_date_left = FORMATS["format_tcell_date_left"]
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left_blocked"]
|
format_distributed = FORMATS["format_distributed"]
|
||||||
format_distributed = FORMATS["format_distributed_blocked"]
|
current_money_format = FORMATS["current_money_format"]
|
||||||
current_money_format = FORMATS["current_money_format_blocked"]
|
|
||||||
else:
|
|
||||||
format_tcell_left = FORMATS["format_tcell_left"]
|
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left"]
|
|
||||||
format_distributed = FORMATS["format_distributed"]
|
|
||||||
current_money_format = FORMATS["current_money_format"]
|
|
||||||
name_to_show = (
|
name_to_show = (
|
||||||
line.get("name", "") == "/" or not line.get("name", "")
|
line.get("name", "") == "/" or not line.get("name", "")
|
||||||
) and line.get("ref", "")
|
) and line.get("ref", "")
|
||||||
@@ -434,23 +428,6 @@ class ActivityStatementXslx(models.AbstractModel):
|
|||||||
FORMATS["current_money_format"] = workbook.add_format(
|
FORMATS["current_money_format"] = workbook.add_format(
|
||||||
{"align": "right", "num_format": money_string}
|
{"align": "right", "num_format": money_string}
|
||||||
)
|
)
|
||||||
bg_grey = "#ADB5BD"
|
|
||||||
FORMATS["format_tcell_left_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["format_tcell_left"]
|
|
||||||
)
|
|
||||||
FORMATS["format_tcell_left_blocked"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["format_tcell_date_left_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["format_tcell_date_left"]
|
|
||||||
)
|
|
||||||
FORMATS["format_tcell_date_left_blocked"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["format_distributed_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["format_distributed"]
|
|
||||||
)
|
|
||||||
FORMATS["format_distributed_blocked"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["current_money_format_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["current_money_format"]
|
|
||||||
)
|
|
||||||
FORMATS["current_money_format_blocked"].set_bg_color(bg_grey)
|
|
||||||
row_pos = self._write_currency_lines(
|
row_pos = self._write_currency_lines(
|
||||||
row_pos, sheet, partner, currency, data
|
row_pos, sheet, partner, currency, data
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -64,36 +64,12 @@ class DetailedActivityStatementXslx(models.AbstractModel):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _get_currency_line_row_data(self, partner, currency, data, line):
|
def _get_currency_line_row_data(self, partner, currency, data, line):
|
||||||
if line.get("blocked") and not line.get("reconciled_line"):
|
if line.get("reconciled_line") and not line.get("outside-date-rank"):
|
||||||
format_tcell_left = FORMATS["format_tcell_left_blocked"]
|
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left_blocked"]
|
|
||||||
format_distributed = FORMATS["format_distributed_blocked"]
|
|
||||||
current_money_format = FORMATS["current_money_format_blocked"]
|
|
||||||
elif (
|
|
||||||
line.get("reconciled_line")
|
|
||||||
and not line.get("blocked")
|
|
||||||
and not line.get("outside-date-rank")
|
|
||||||
):
|
|
||||||
format_tcell_left = FORMATS["format_tcell_left_reconciled"]
|
format_tcell_left = FORMATS["format_tcell_left_reconciled"]
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left_reconciled"]
|
format_tcell_date_left = FORMATS["format_tcell_date_left_reconciled"]
|
||||||
format_distributed = FORMATS["format_distributed_reconciled"]
|
format_distributed = FORMATS["format_distributed_reconciled"]
|
||||||
current_money_format = FORMATS["current_money_format_reconciled"]
|
current_money_format = FORMATS["current_money_format_reconciled"]
|
||||||
elif (
|
elif line.get("reconciled_line") and line.get("outside-date-rank"):
|
||||||
line.get("blocked")
|
|
||||||
and line.get("reconciled_line")
|
|
||||||
and not line.get("outside-date-rank")
|
|
||||||
):
|
|
||||||
format_tcell_left = FORMATS["format_tcell_left_blocked_reconciled"]
|
|
||||||
format_tcell_date_left = FORMATS[
|
|
||||||
"format_tcell_date_left_blocked_reconciled"
|
|
||||||
]
|
|
||||||
format_distributed = FORMATS["format_distributed_blocked_reconciled"]
|
|
||||||
current_money_format = FORMATS["current_money_format_blocked_reconciled"]
|
|
||||||
elif (
|
|
||||||
line.get("reconciled_line")
|
|
||||||
and not line.get("blocked")
|
|
||||||
and line.get("outside-date-rank")
|
|
||||||
):
|
|
||||||
format_tcell_left = FORMATS[
|
format_tcell_left = FORMATS[
|
||||||
"format_tcell_left_reconciled_outside-date-rank"
|
"format_tcell_left_reconciled_outside-date-rank"
|
||||||
]
|
]
|
||||||
@@ -106,23 +82,6 @@ class DetailedActivityStatementXslx(models.AbstractModel):
|
|||||||
current_money_format = FORMATS[
|
current_money_format = FORMATS[
|
||||||
"current_money_format_reconciled_outside-date-rank"
|
"current_money_format_reconciled_outside-date-rank"
|
||||||
]
|
]
|
||||||
elif (
|
|
||||||
line.get("blocked")
|
|
||||||
and line.get("reconciled_line")
|
|
||||||
and line.get("outside-date-rank")
|
|
||||||
):
|
|
||||||
format_tcell_left = FORMATS[
|
|
||||||
"format_tcell_left_blocked_reconciled_outside-date-rank"
|
|
||||||
]
|
|
||||||
format_tcell_date_left = FORMATS[
|
|
||||||
"format_tcell_date_left_blocked_reconciled_outside-date-rank"
|
|
||||||
]
|
|
||||||
format_distributed = FORMATS[
|
|
||||||
"format_distributed_blocked_reconciled_outside-date-rank"
|
|
||||||
]
|
|
||||||
current_money_format = FORMATS[
|
|
||||||
"current_money_format_blocked_reconciled_outside-date-rank"
|
|
||||||
]
|
|
||||||
else:
|
else:
|
||||||
format_tcell_left = FORMATS["format_tcell_left"]
|
format_tcell_left = FORMATS["format_tcell_left"]
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left"]
|
format_tcell_date_left = FORMATS["format_tcell_date_left"]
|
||||||
@@ -242,23 +201,11 @@ class DetailedActivityStatementXslx(models.AbstractModel):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _get_currency_prior_line_row_data(self, partner, currency, data, line):
|
def _get_currency_prior_line_row_data(self, partner, currency, data, line):
|
||||||
if line.get("blocked") and not line.get("reconciled_line"):
|
if line.get("reconciled_line"):
|
||||||
format_tcell_left = FORMATS["format_tcell_left_blocked"]
|
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left_blocked"]
|
|
||||||
format_distributed = FORMATS["format_distributed_blocked"]
|
|
||||||
current_money_format = FORMATS["current_money_format_blocked"]
|
|
||||||
elif line.get("reconciled_line") and not line.get("blocked"):
|
|
||||||
format_tcell_left = FORMATS["format_tcell_left_reconciled"]
|
format_tcell_left = FORMATS["format_tcell_left_reconciled"]
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left_reconciled"]
|
format_tcell_date_left = FORMATS["format_tcell_date_left_reconciled"]
|
||||||
format_distributed = FORMATS["format_distributed_reconciled"]
|
format_distributed = FORMATS["format_distributed_reconciled"]
|
||||||
current_money_format = FORMATS["current_money_format_reconciled"]
|
current_money_format = FORMATS["current_money_format_reconciled"]
|
||||||
elif line.get("blocked") and line.get("reconciled_line"):
|
|
||||||
format_tcell_left = FORMATS["format_tcell_left_blocked_reconciled"]
|
|
||||||
format_tcell_date_left = FORMATS[
|
|
||||||
"format_tcell_date_left_blocked_reconciled"
|
|
||||||
]
|
|
||||||
format_distributed = FORMATS["format_distributed_blocked_reconciled"]
|
|
||||||
current_money_format = FORMATS["current_money_format_blocked_reconciled"]
|
|
||||||
else:
|
else:
|
||||||
format_tcell_left = FORMATS["format_tcell_left"]
|
format_tcell_left = FORMATS["format_tcell_left"]
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left"]
|
format_tcell_date_left = FORMATS["format_tcell_date_left"]
|
||||||
@@ -396,23 +343,11 @@ class DetailedActivityStatementXslx(models.AbstractModel):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _get_currency_ending_line_row_data(self, partner, currency, data, line):
|
def _get_currency_ending_line_row_data(self, partner, currency, data, line):
|
||||||
if line.get("blocked") and not line.get("reconciled_line"):
|
if line.get("reconciled_line"):
|
||||||
format_tcell_left = FORMATS["format_tcell_left_blocked"]
|
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left_blocked"]
|
|
||||||
format_distributed = FORMATS["format_distributed_blocked"]
|
|
||||||
current_money_format = FORMATS["current_money_format_blocked"]
|
|
||||||
elif line.get("reconciled_line") and not line.get("blocked"):
|
|
||||||
format_tcell_left = FORMATS["format_tcell_left_reconciled"]
|
format_tcell_left = FORMATS["format_tcell_left_reconciled"]
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left_reconciled"]
|
format_tcell_date_left = FORMATS["format_tcell_date_left_reconciled"]
|
||||||
format_distributed = FORMATS["format_distributed_reconciled"]
|
format_distributed = FORMATS["format_distributed_reconciled"]
|
||||||
current_money_format = FORMATS["current_money_format_reconciled"]
|
current_money_format = FORMATS["current_money_format_reconciled"]
|
||||||
elif line.get("blocked") and line.get("reconciled_line"):
|
|
||||||
format_tcell_left = FORMATS["format_tcell_left_blocked_reconciled"]
|
|
||||||
format_tcell_date_left = FORMATS[
|
|
||||||
"format_tcell_date_left_blocked_reconciled"
|
|
||||||
]
|
|
||||||
format_distributed = FORMATS["format_distributed_blocked_reconciled"]
|
|
||||||
current_money_format = FORMATS["current_money_format_blocked_reconciled"]
|
|
||||||
else:
|
else:
|
||||||
format_tcell_left = FORMATS["format_tcell_left"]
|
format_tcell_left = FORMATS["format_tcell_left"]
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left"]
|
format_tcell_date_left = FORMATS["format_tcell_date_left"]
|
||||||
@@ -639,24 +574,7 @@ class DetailedActivityStatementXslx(models.AbstractModel):
|
|||||||
FORMATS["current_money_format"] = workbook.add_format(
|
FORMATS["current_money_format"] = workbook.add_format(
|
||||||
{"align": "right", "num_format": money_string}
|
{"align": "right", "num_format": money_string}
|
||||||
)
|
)
|
||||||
bg_grey = "#ADB5BD"
|
|
||||||
fc_red = "#DC3545"
|
fc_red = "#DC3545"
|
||||||
FORMATS["format_tcell_left_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["format_tcell_left"]
|
|
||||||
)
|
|
||||||
FORMATS["format_tcell_left_blocked"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["format_tcell_date_left_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["format_tcell_date_left"]
|
|
||||||
)
|
|
||||||
FORMATS["format_tcell_date_left_blocked"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["format_distributed_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["format_distributed"]
|
|
||||||
)
|
|
||||||
FORMATS["format_distributed_blocked"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["current_money_format_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["current_money_format"]
|
|
||||||
)
|
|
||||||
FORMATS["current_money_format_blocked"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["format_tcell_left_reconciled"] = copy_format(
|
FORMATS["format_tcell_left_reconciled"] = copy_format(
|
||||||
workbook, FORMATS["format_tcell_left"]
|
workbook, FORMATS["format_tcell_left"]
|
||||||
)
|
)
|
||||||
@@ -678,24 +596,6 @@ class DetailedActivityStatementXslx(models.AbstractModel):
|
|||||||
)
|
)
|
||||||
FORMATS["current_money_format_reconciled"].set_italic(True)
|
FORMATS["current_money_format_reconciled"].set_italic(True)
|
||||||
FORMATS["current_money_format_reconciled"].set_font_size(10)
|
FORMATS["current_money_format_reconciled"].set_font_size(10)
|
||||||
FORMATS["format_tcell_left_blocked_reconciled"] = copy_format(
|
|
||||||
workbook, FORMATS["format_tcell_left_reconciled"]
|
|
||||||
)
|
|
||||||
FORMATS["format_tcell_left_blocked_reconciled"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["format_tcell_date_left_blocked_reconciled"] = copy_format(
|
|
||||||
workbook, FORMATS["format_tcell_date_left_reconciled"]
|
|
||||||
)
|
|
||||||
FORMATS["format_tcell_date_left_blocked_reconciled"].set_bg_color(
|
|
||||||
bg_grey
|
|
||||||
)
|
|
||||||
FORMATS["format_distributed_blocked_reconciled"] = copy_format(
|
|
||||||
workbook, FORMATS["format_distributed_reconciled"]
|
|
||||||
)
|
|
||||||
FORMATS["format_distributed_blocked_reconciled"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["current_money_format_blocked_reconciled"] = copy_format(
|
|
||||||
workbook, FORMATS["current_money_format_reconciled"]
|
|
||||||
)
|
|
||||||
FORMATS["current_money_format_blocked_reconciled"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["format_tcell_left_reconciled_outside-date-rank"] = copy_format(
|
FORMATS["format_tcell_left_reconciled_outside-date-rank"] = copy_format(
|
||||||
workbook, FORMATS["format_tcell_left_reconciled"]
|
workbook, FORMATS["format_tcell_left_reconciled"]
|
||||||
)
|
)
|
||||||
@@ -720,38 +620,6 @@ class DetailedActivityStatementXslx(models.AbstractModel):
|
|||||||
FORMATS[
|
FORMATS[
|
||||||
"current_money_format_reconciled_outside-date-rank"
|
"current_money_format_reconciled_outside-date-rank"
|
||||||
].set_font_color(fc_red)
|
].set_font_color(fc_red)
|
||||||
FORMATS["format_tcell_left_blocked_reconciled_outside-date-rank"] = (
|
|
||||||
copy_format(
|
|
||||||
workbook, FORMATS["format_tcell_left_blocked_reconciled"]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
FORMATS[
|
|
||||||
"format_tcell_left_blocked_reconciled_outside-date-rank"
|
|
||||||
].set_font_color(fc_red)
|
|
||||||
FORMATS[
|
|
||||||
"format_tcell_date_left_blocked_reconciled_outside-date-rank"
|
|
||||||
] = copy_format(
|
|
||||||
workbook, FORMATS["format_tcell_date_left_blocked_reconciled"]
|
|
||||||
)
|
|
||||||
FORMATS[
|
|
||||||
"format_tcell_date_left_blocked_reconciled_outside-date-rank"
|
|
||||||
].set_font_color(fc_red)
|
|
||||||
FORMATS["format_distributed_blocked_reconciled_outside-date-rank"] = (
|
|
||||||
copy_format(
|
|
||||||
workbook, FORMATS["format_distributed_blocked_reconciled"]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
FORMATS[
|
|
||||||
"format_distributed_blocked_reconciled_outside-date-rank"
|
|
||||||
].set_font_color(fc_red)
|
|
||||||
FORMATS["current_money_format_blocked_reconciled_outside-date-rank"] = (
|
|
||||||
copy_format(
|
|
||||||
workbook, FORMATS["current_money_format_blocked_reconciled"]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
FORMATS[
|
|
||||||
"current_money_format_blocked_reconciled_outside-date-rank"
|
|
||||||
].set_font_color(fc_red)
|
|
||||||
row_pos = self._write_currency_prior_lines(
|
row_pos = self._write_currency_prior_lines(
|
||||||
row_pos, sheet, partner, currency, data
|
row_pos, sheet, partner, currency, data
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class OutstandingStatement(models.AbstractModel):
|
|||||||
self._cr.mogrify(
|
self._cr.mogrify(
|
||||||
"""
|
"""
|
||||||
SELECT l.id, m.name AS move_id, l.partner_id, l.date, l.name,
|
SELECT l.id, m.name AS move_id, l.partner_id, l.date, l.name,
|
||||||
l.blocked, l.currency_id, l.company_id,
|
l.currency_id, l.company_id,
|
||||||
CASE WHEN l.ref IS NOT NULL
|
CASE WHEN l.ref IS NOT NULL
|
||||||
THEN l.ref
|
THEN l.ref
|
||||||
ELSE m.ref
|
ELSE m.ref
|
||||||
@@ -94,7 +94,7 @@ class OutstandingStatement(models.AbstractModel):
|
|||||||
THEN l.ref
|
THEN l.ref
|
||||||
ELSE m.ref
|
ELSE m.ref
|
||||||
END,
|
END,
|
||||||
l.blocked, l.currency_id, l.balance, l.amount_currency, l.company_id
|
l.currency_id, l.balance, l.amount_currency, l.company_id
|
||||||
""",
|
""",
|
||||||
locals(),
|
locals(),
|
||||||
),
|
),
|
||||||
@@ -107,7 +107,7 @@ class OutstandingStatement(models.AbstractModel):
|
|||||||
f"""
|
f"""
|
||||||
SELECT {sub}.partner_id, {sub}.currency_id, {sub}.move_id,
|
SELECT {sub}.partner_id, {sub}.currency_id, {sub}.move_id,
|
||||||
{sub}.date, {sub}.date_maturity, {sub}.debit, {sub}.credit,
|
{sub}.date, {sub}.date_maturity, {sub}.debit, {sub}.credit,
|
||||||
{sub}.name, {sub}.ref, {sub}.blocked, {sub}.company_id,
|
{sub}.name, {sub}.ref, {sub}.company_id,
|
||||||
CASE WHEN {sub}.currency_id is not null
|
CASE WHEN {sub}.currency_id is not null
|
||||||
THEN {sub}.open_amount_currency
|
THEN {sub}.open_amount_currency
|
||||||
ELSE {sub}.open_amount
|
ELSE {sub}.open_amount
|
||||||
@@ -127,7 +127,7 @@ class OutstandingStatement(models.AbstractModel):
|
|||||||
{sub}.date_maturity, {sub}.name, {sub}.ref, {sub}.debit,
|
{sub}.date_maturity, {sub}.name, {sub}.ref, {sub}.debit,
|
||||||
{sub}.credit, {sub}.debit-{sub}.credit AS amount,
|
{sub}.credit, {sub}.debit-{sub}.credit AS amount,
|
||||||
COALESCE({sub}.currency_id, c.currency_id) AS currency_id,
|
COALESCE({sub}.currency_id, c.currency_id) AS currency_id,
|
||||||
{sub}.open_amount, {sub}.blocked, {sub}.id
|
{sub}.open_amount, {sub}.id
|
||||||
FROM {sub}
|
FROM {sub}
|
||||||
JOIN res_company c ON (c.id = {sub}.company_id)
|
JOIN res_company c ON (c.id = {sub}.company_id)
|
||||||
WHERE c.id = %(company_id)s AND {sub}.open_amount != 0.0
|
WHERE c.id = %(company_id)s AND {sub}.open_amount != 0.0
|
||||||
@@ -150,7 +150,7 @@ class OutstandingStatement(models.AbstractModel):
|
|||||||
Q3 AS ({})
|
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, id
|
||||||
FROM Q3
|
FROM Q3
|
||||||
ORDER BY date, date_maturity, move_id""".format(
|
ORDER BY date, date_maturity, move_id""".format(
|
||||||
self._display_outstanding_lines_sql_q1(
|
self._display_outstanding_lines_sql_q1(
|
||||||
|
|||||||
@@ -54,16 +54,10 @@ class OutstandingStatementXslx(models.AbstractModel):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _get_currency_line_row_data(self, partner, currency, data, line):
|
def _get_currency_line_row_data(self, partner, currency, data, line):
|
||||||
if line.get("blocked"):
|
format_tcell_left = FORMATS["format_tcell_left"]
|
||||||
format_tcell_left = FORMATS["format_tcell_left_blocked"]
|
format_tcell_date_left = FORMATS["format_tcell_date_left"]
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left_blocked"]
|
format_distributed = FORMATS["format_distributed"]
|
||||||
format_distributed = FORMATS["format_distributed_blocked"]
|
current_money_format = FORMATS["current_money_format"]
|
||||||
current_money_format = FORMATS["current_money_format_blocked"]
|
|
||||||
else:
|
|
||||||
format_tcell_left = FORMATS["format_tcell_left"]
|
|
||||||
format_tcell_date_left = FORMATS["format_tcell_date_left"]
|
|
||||||
format_distributed = FORMATS["format_distributed"]
|
|
||||||
current_money_format = FORMATS["current_money_format"]
|
|
||||||
name_to_show = (
|
name_to_show = (
|
||||||
line.get("name", "") == "/" or not line.get("name", "")
|
line.get("name", "") == "/" or not line.get("name", "")
|
||||||
) and line.get("ref", "")
|
) and line.get("ref", "")
|
||||||
@@ -352,23 +346,6 @@ class OutstandingStatementXslx(models.AbstractModel):
|
|||||||
FORMATS["current_money_format"] = workbook.add_format(
|
FORMATS["current_money_format"] = workbook.add_format(
|
||||||
{"align": "right", "num_format": money_string}
|
{"align": "right", "num_format": money_string}
|
||||||
)
|
)
|
||||||
bg_grey = "#ADB5BD"
|
|
||||||
FORMATS["format_tcell_left_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["format_tcell_left"]
|
|
||||||
)
|
|
||||||
FORMATS["format_tcell_left_blocked"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["format_tcell_date_left_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["format_tcell_date_left"]
|
|
||||||
)
|
|
||||||
FORMATS["format_tcell_date_left_blocked"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["format_distributed_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["format_distributed"]
|
|
||||||
)
|
|
||||||
FORMATS["format_distributed_blocked"].set_bg_color(bg_grey)
|
|
||||||
FORMATS["current_money_format_blocked"] = copy_format(
|
|
||||||
workbook, FORMATS["current_money_format"]
|
|
||||||
)
|
|
||||||
FORMATS["current_money_format_blocked"].set_bg_color(bg_grey)
|
|
||||||
row_pos = self._write_currency_lines(
|
row_pos = self._write_currency_lines(
|
||||||
row_pos, sheet, partner, currency, data
|
row_pos, sheet, partner, currency, data
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class ReportStatementCommon(models.AbstractModel):
|
|||||||
(pc.id IS NOT NULL AND
|
(pc.id IS NOT NULL AND
|
||||||
pc.max_date <= %(date_end)s) OR
|
pc.max_date <= %(date_end)s) OR
|
||||||
(pd.id IS NULL AND pc.id IS NULL)
|
(pd.id IS NULL AND pc.id IS NULL)
|
||||||
) AND l.date <= %(date_end)s AND not l.blocked
|
) AND l.date <= %(date_end)s
|
||||||
AND m.state IN ('posted')
|
AND m.state IN ('posted')
|
||||||
AND aa.account_type = %(account_type)s
|
AND aa.account_type = %(account_type)s
|
||||||
AND CASE
|
AND CASE
|
||||||
@@ -473,8 +473,7 @@ class ReportStatementCommon(models.AbstractModel):
|
|||||||
line["currency_id"], currencies, 0.0, 0.0
|
line["currency_id"], currencies, 0.0, 0.0
|
||||||
)
|
)
|
||||||
line_currency = currency_dict[line["currency_id"]]
|
line_currency = currency_dict[line["currency_id"]]
|
||||||
if not line["blocked"]:
|
line_currency["amount_due"] += line["open_amount"]
|
||||||
line_currency["amount_due"] += line["open_amount"]
|
|
||||||
line["balance"] = line_currency["amount_due"]
|
line["balance"] = line_currency["amount_due"]
|
||||||
line["date"] = format_date(
|
line["date"] = format_date(
|
||||||
line["date"], date_formats.get(partner_id, default_fmt)
|
line["date"], date_formats.get(partner_id, default_fmt)
|
||||||
@@ -496,12 +495,10 @@ class ReportStatementCommon(models.AbstractModel):
|
|||||||
)
|
)
|
||||||
line_currency = currency_dict[line["currency_id"]]
|
line_currency = currency_dict[line["currency_id"]]
|
||||||
if not is_activity:
|
if not is_activity:
|
||||||
if not line["blocked"]:
|
line_currency["amount_due"] += line[amount_field]
|
||||||
line_currency["amount_due"] += line[amount_field]
|
|
||||||
line["balance"] = line_currency["amount_due"]
|
line["balance"] = line_currency["amount_due"]
|
||||||
else:
|
else:
|
||||||
if not line["blocked"]:
|
line_currency["ending_balance"] += line[amount_field]
|
||||||
line_currency["ending_balance"] += line[amount_field]
|
|
||||||
line["balance"] = line_currency["ending_balance"]
|
line["balance"] = line_currency["ending_balance"]
|
||||||
line["outside-date-rank"] = False
|
line["outside-date-rank"] = False
|
||||||
line["date"] = format_date(
|
line["date"] = format_date(
|
||||||
@@ -523,8 +520,7 @@ class ReportStatementCommon(models.AbstractModel):
|
|||||||
line2["applied_amount"] = line2["open_amount"]
|
line2["applied_amount"] = line2["open_amount"]
|
||||||
if line2["date"] >= date_start and line2["date"] <= date_end:
|
if line2["date"] >= date_start and line2["date"] <= date_end:
|
||||||
line2["outside-date-rank"] = False
|
line2["outside-date-rank"] = False
|
||||||
if not line2["blocked"]:
|
line["applied_amount"] += line2["open_amount"]
|
||||||
line["applied_amount"] += line2["open_amount"]
|
|
||||||
else:
|
else:
|
||||||
line2["outside-date-rank"] = True
|
line2["outside-date-rank"] = True
|
||||||
line2["date"] = format_date(
|
line2["date"] = format_date(
|
||||||
@@ -542,8 +538,7 @@ class ReportStatementCommon(models.AbstractModel):
|
|||||||
)
|
)
|
||||||
if is_activity:
|
if is_activity:
|
||||||
line["open_amount"] = line["amount"] + line["applied_amount"]
|
line["open_amount"] = line["amount"] + line["applied_amount"]
|
||||||
if not line["blocked"]:
|
line_currency["amount_due"] += line["open_amount"]
|
||||||
line_currency["amount_due"] += line["open_amount"]
|
|
||||||
|
|
||||||
if is_detailed:
|
if is_detailed:
|
||||||
for line_currency in currency_dict.values():
|
for line_currency in currency_dict.values():
|
||||||
@@ -551,8 +546,7 @@ class ReportStatementCommon(models.AbstractModel):
|
|||||||
|
|
||||||
for line in ending_lines.get(partner_id, []):
|
for line in ending_lines.get(partner_id, []):
|
||||||
line_currency = currency_dict[line["currency_id"]]
|
line_currency = currency_dict[line["currency_id"]]
|
||||||
if not line["blocked"]:
|
line_currency["amount_due"] += line["open_amount"]
|
||||||
line_currency["amount_due"] += line["open_amount"]
|
|
||||||
line["balance"] = line_currency["amount_due"]
|
line["balance"] = line_currency["amount_due"]
|
||||||
line["date"] = format_date(
|
line["date"] = format_date(
|
||||||
line["date"], date_formats.get(partner_id, default_fmt)
|
line["date"], date_formats.get(partner_id, default_fmt)
|
||||||
|
|||||||
@@ -14,13 +14,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.statement-blocked {
|
|
||||||
background-color: $gray-500 !important;
|
|
||||||
td:last-child {
|
|
||||||
background-color: $gray-500 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.statement-reconciled {
|
.statement-reconciled {
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
font-style: italic !important;
|
font-style: italic !important;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<tr
|
<tr
|
||||||
t-foreach="currency['lines']"
|
t-foreach="currency['lines']"
|
||||||
t-as="line"
|
t-as="line"
|
||||||
t-att-class="('statement-blocked ' if line['blocked'] else '') + ('statement-reconciled ' if line['reconciled_line'] else '') + ('statement-outside-date-rank' if line['outside-date-rank'] else '')"
|
t-att-class="('statement-reconciled ' if line['reconciled_line'] else '') + ('statement-outside-date-rank' if line['outside-date-rank'] else '')"
|
||||||
>
|
>
|
||||||
<td>
|
<td>
|
||||||
<span
|
<span
|
||||||
|
|||||||
@@ -21,11 +21,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr
|
<tr t-foreach="currency[line_type]" t-as="line" t-att-class="''">
|
||||||
t-foreach="currency[line_type]"
|
|
||||||
t-as="line"
|
|
||||||
t-att-class="'statement-blocked' if line['blocked'] else ''"
|
|
||||||
>
|
|
||||||
<td>
|
<td>
|
||||||
<span t-out="line['move_id']" />
|
<span t-out="line['move_id']" />
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user