From d67aa6a798d9f7359549bbf56ec6fa2913f930ec Mon Sep 17 00:00:00 2001
From: Yolann Sabaux <yosa@odoo.com>
Date: Tue, 5 Sep 2023 10:17:13 +0200
Subject: [PATCH] [FIX] account: display banner tax lock before creation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Steps to reproduce:
- set a tax lock date
- create a new move
- set the accounting date prior to the tax lock date
- set an invoice_line with a tax

Issue:
The banner teeling you information about the tax lock date won't appear unless the move is created.

opw-3370727

closes odoo/odoo#134259

Signed-off-by: William André (wan) <wan@odoo.com>
---
 addons/account/models/account_move.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 6aaff2dfeea5..14dca8233034 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -1295,7 +1295,8 @@ class AccountMove(models.Model):
             else:
                 move.bank_partner_id = move.commercial_partner_id
 
-    @api.depends('date', 'line_ids.debit', 'line_ids.credit', 'line_ids.tax_line_id', 'line_ids.tax_ids', 'line_ids.tax_tag_ids')
+    @api.depends('date', 'line_ids.debit', 'line_ids.credit', 'line_ids.tax_line_id', 'line_ids.tax_ids', 'line_ids.tax_tag_ids',
+                 'invoice_line_ids.debit', 'invoice_line_ids.credit', 'invoice_line_ids.tax_line_id', 'invoice_line_ids.tax_ids', 'invoice_line_ids.tax_tag_ids')
     def _compute_tax_lock_date_message(self):
         for move in self:
             accounting_date = move.date or fields.Date.context_today(move)
@@ -3169,7 +3170,7 @@ class AccountMove(models.Model):
         }
 
     def _affect_tax_report(self):
-        return any(line._affect_tax_report() for line in self.line_ids)
+        return any(line._affect_tax_report() for line in (self.line_ids | self.invoice_line_ids))
 
     def _get_move_display_name(self, show_ref=False):
         ''' Helper to get the display name of an invoice depending of its type.
-- 
GitLab