diff --git a/partner_statement/__init__.py b/partner_statement/__init__.py index 81837962..997d84a6 100644 --- a/partner_statement/__init__.py +++ b/partner_statement/__init__.py @@ -1,5 +1,4 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from . import models from . import report from . import wizard diff --git a/partner_statement/models/__init__.py b/partner_statement/models/__init__.py deleted file mode 100644 index 8795b3be..00000000 --- a/partner_statement/models/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import account_move_line diff --git a/partner_statement/models/account_move_line.py b/partner_statement/models/account_move_line.py deleted file mode 100644 index 8cb05fef..00000000 --- a/partner_statement/models/account_move_line.py +++ /dev/null @@ -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", - ) diff --git a/partner_statement/report/activity_statement.py b/partner_statement/report/activity_statement.py index d45b581a..ed70b0d8 100644 --- a/partner_statement/report/activity_statement.py +++ b/partner_statement/report/activity_statement.py @@ -88,7 +88,7 @@ class ActivityStatement(models.AbstractModel): ) as pc ON pc.credit_move_id = l.id WHERE l.partner_id IN %(partners)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 aa.account_type = %(account_type)s AND ( @@ -181,7 +181,7 @@ class ActivityStatement(models.AbstractModel): THEN %(payment_ref)s ELSE m.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) THEN l.amount_currency ELSE l.debit @@ -213,7 +213,7 @@ class ActivityStatement(models.AbstractModel): CASE WHEN (aj.type IN ('sale', 'purchase')) THEN l.name ELSE '/' - END, case_ref, l.blocked, l.currency_id, l.company_id + END, case_ref, l.currency_id, l.company_id """, locals(), ), @@ -226,7 +226,7 @@ class ActivityStatement(models.AbstractModel): f""" 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}.debit-{sub}.credit as amount, {sub}.blocked, + {sub}.debit-{sub}.credit as amount, COALESCE({sub}.currency_id, c.currency_id) AS currency_id FROM {sub} JOIN res_company c ON (c.id = {sub}.company_id) @@ -250,7 +250,7 @@ class ActivityStatement(models.AbstractModel): 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 + debit, credit, amount, currency_id FROM Q2 ORDER BY date, date_maturity, move_id""".format( self._display_activity_lines_sql_q1( @@ -280,7 +280,7 @@ class ActivityStatement(models.AbstractModel): self._cr.mogrify( f""" 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 THEN l.ref ELSE m.ref @@ -319,7 +319,7 @@ class ActivityStatement(models.AbstractModel): THEN l.ref ELSE m.ref 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(), ), @@ -342,7 +342,7 @@ class ActivityStatement(models.AbstractModel): 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 + COALESCE(ref, '') as ref, id FROM Q6 ORDER BY date, date_maturity, move_id""".format( self._display_activity_lines_sql_q1( diff --git a/partner_statement/report/activity_statement_xlsx.py b/partner_statement/report/activity_statement_xlsx.py index cf187557..ed18209d 100644 --- a/partner_statement/report/activity_statement_xlsx.py +++ b/partner_statement/report/activity_statement_xlsx.py @@ -105,16 +105,10 @@ class ActivityStatementXslx(models.AbstractModel): ] def _get_currency_line_row_data(self, partner, currency, data, line): - if line.get("blocked"): - 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"] - 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"] + 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 = ( line.get("name", "") == "/" or not line.get("name", "") ) and line.get("ref", "") @@ -434,23 +428,6 @@ class ActivityStatementXslx(models.AbstractModel): FORMATS["current_money_format"] = workbook.add_format( {"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, sheet, partner, currency, data ) diff --git a/partner_statement/report/detailed_activity_statement_xlsx.py b/partner_statement/report/detailed_activity_statement_xlsx.py index 8bb95dde..09b7aba7 100644 --- a/partner_statement/report/detailed_activity_statement_xlsx.py +++ b/partner_statement/report/detailed_activity_statement_xlsx.py @@ -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 ) diff --git a/partner_statement/report/outstanding_statement.py b/partner_statement/report/outstanding_statement.py index 58ccc2df..70d9ec60 100644 --- a/partner_statement/report/outstanding_statement.py +++ b/partner_statement/report/outstanding_statement.py @@ -34,7 +34,7 @@ class OutstandingStatement(models.AbstractModel): self._cr.mogrify( """ 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 THEN l.ref ELSE m.ref @@ -94,7 +94,7 @@ class OutstandingStatement(models.AbstractModel): THEN l.ref ELSE m.ref 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(), ), @@ -107,7 +107,7 @@ class OutstandingStatement(models.AbstractModel): f""" SELECT {sub}.partner_id, {sub}.currency_id, {sub}.move_id, {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 THEN {sub}.open_amount_currency ELSE {sub}.open_amount @@ -127,7 +127,7 @@ class OutstandingStatement(models.AbstractModel): {sub}.date_maturity, {sub}.name, {sub}.ref, {sub}.debit, {sub}.credit, {sub}.debit-{sub}.credit AS amount, COALESCE({sub}.currency_id, c.currency_id) AS currency_id, - {sub}.open_amount, {sub}.blocked, {sub}.id + {sub}.open_amount, {sub}.id FROM {sub} JOIN res_company c ON (c.id = {sub}.company_id) WHERE c.id = %(company_id)s AND {sub}.open_amount != 0.0 @@ -150,7 +150,7 @@ class OutstandingStatement(models.AbstractModel): 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 + COALESCE(ref, '') as ref, id FROM Q3 ORDER BY date, date_maturity, move_id""".format( self._display_outstanding_lines_sql_q1( diff --git a/partner_statement/report/outstanting_statement_xlsx.py b/partner_statement/report/outstanting_statement_xlsx.py index cd74d00a..592d17ed 100644 --- a/partner_statement/report/outstanting_statement_xlsx.py +++ b/partner_statement/report/outstanting_statement_xlsx.py @@ -54,16 +54,10 @@ class OutstandingStatementXslx(models.AbstractModel): ] def _get_currency_line_row_data(self, partner, currency, data, line): - if line.get("blocked"): - 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"] - 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"] + 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 = ( line.get("name", "") == "/" or not line.get("name", "") ) and line.get("ref", "") @@ -352,23 +346,6 @@ class OutstandingStatementXslx(models.AbstractModel): FORMATS["current_money_format"] = workbook.add_format( {"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, sheet, partner, currency, data ) diff --git a/partner_statement/report/report_statement_common.py b/partner_statement/report/report_statement_common.py index 49347a31..e7c06c8a 100644 --- a/partner_statement/report/report_statement_common.py +++ b/partner_statement/report/report_statement_common.py @@ -102,7 +102,7 @@ class ReportStatementCommon(models.AbstractModel): (pc.id IS NOT NULL AND pc.max_date <= %(date_end)s) OR (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 aa.account_type = %(account_type)s AND CASE @@ -473,8 +473,7 @@ class ReportStatementCommon(models.AbstractModel): line["currency_id"], currencies, 0.0, 0.0 ) 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["date"] = format_date( line["date"], date_formats.get(partner_id, default_fmt) @@ -496,12 +495,10 @@ class ReportStatementCommon(models.AbstractModel): ) line_currency = currency_dict[line["currency_id"]] 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"] 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["outside-date-rank"] = False line["date"] = format_date( @@ -523,8 +520,7 @@ class ReportStatementCommon(models.AbstractModel): line2["applied_amount"] = line2["open_amount"] if line2["date"] >= date_start and line2["date"] <= date_end: line2["outside-date-rank"] = False - if not line2["blocked"]: - line["applied_amount"] += line2["open_amount"] + line["applied_amount"] += line2["open_amount"] else: line2["outside-date-rank"] = True line2["date"] = format_date( @@ -542,8 +538,7 @@ class ReportStatementCommon(models.AbstractModel): ) if is_activity: 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: for line_currency in currency_dict.values(): @@ -551,8 +546,7 @@ class ReportStatementCommon(models.AbstractModel): for line in ending_lines.get(partner_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["date"] = format_date( line["date"], date_formats.get(partner_id, default_fmt) diff --git a/partner_statement/static/src/scss/layout_statement.scss b/partner_statement/static/src/scss/layout_statement.scss index 1dc492bd..f45c3a86 100644 --- a/partner_statement/static/src/scss/layout_statement.scss +++ b/partner_statement/static/src/scss/layout_statement.scss @@ -14,13 +14,6 @@ } } -.statement-blocked { - background-color: $gray-500 !important; - td:last-child { - background-color: $gray-500 !important; - } -} - .statement-reconciled { font-size: smaller; font-style: italic !important; diff --git a/partner_statement/views/activity_statement.xml b/partner_statement/views/activity_statement.xml index b87ce5e2..de428cf4 100644 --- a/partner_statement/views/activity_statement.xml +++ b/partner_statement/views/activity_statement.xml @@ -37,7 +37,7 @@