[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:
Miquel Raïch
2025-07-25 14:16:02 +02:00
parent b426816b11
commit 693d25345a
12 changed files with 34 additions and 244 deletions

View File

@@ -64,36 +64,12 @@ class DetailedActivityStatementXslx(models.AbstractModel):
]
def _get_currency_line_row_data(self, partner, currency, data, line):
if line.get("blocked") and not 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")
and not line.get("outside-date-rank")
):
if line.get("reconciled_line") and not line.get("outside-date-rank"):
format_tcell_left = FORMATS["format_tcell_left_reconciled"]
format_tcell_date_left = FORMATS["format_tcell_date_left_reconciled"]
format_distributed = FORMATS["format_distributed_reconciled"]
current_money_format = FORMATS["current_money_format_reconciled"]
elif (
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")
):
elif line.get("reconciled_line") and line.get("outside-date-rank"):
format_tcell_left = FORMATS[
"format_tcell_left_reconciled_outside-date-rank"
]
@@ -106,23 +82,6 @@ class DetailedActivityStatementXslx(models.AbstractModel):
current_money_format = FORMATS[
"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:
format_tcell_left = FORMATS["format_tcell_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):
if line.get("blocked") and not 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"):
if line.get("reconciled_line"):
format_tcell_left = FORMATS["format_tcell_left_reconciled"]
format_tcell_date_left = FORMATS["format_tcell_date_left_reconciled"]
format_distributed = FORMATS["format_distributed_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:
format_tcell_left = FORMATS["format_tcell_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):
if line.get("blocked") and not 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"):
if line.get("reconciled_line"):
format_tcell_left = FORMATS["format_tcell_left_reconciled"]
format_tcell_date_left = FORMATS["format_tcell_date_left_reconciled"]
format_distributed = FORMATS["format_distributed_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:
format_tcell_left = FORMATS["format_tcell_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(
{"align": "right", "num_format": money_string}
)
bg_grey = "#ADB5BD"
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(
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_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(
workbook, FORMATS["format_tcell_left_reconciled"]
)
@@ -720,38 +620,6 @@ class DetailedActivityStatementXslx(models.AbstractModel):
FORMATS[
"current_money_format_reconciled_outside-date-rank"
].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, sheet, partner, currency, data
)