From 64b9269b9b37f31ecba3bec18ae953c4b2cc3310 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Wed, 20 Nov 2019 08:46:19 +0000 Subject: [PATCH] [FIX] account: no force lock date after deleting tax line Open Accounting app, go to Accounting>"Lock Dates" and set a "Tax Lock Date". Now create a Vendor Bill with invoice date prior to the tax lock date, add a line, Odoo will display a warning. Remove the Tax from the line, save. The accounting date will be forced to tax_lock_date + 1 which should be not the case since the order is without tax. Adding a check to force the tax only when tax line ids are present. opw-2115547 closes odoo/odoo#40570 X-original-commit: 8083f103287b7632351e06de6c48bf3ea32d90aa Signed-off-by: Nicolas Martinelli (nim) --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 5339dece157..b8104a841d3 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2079,7 +2079,7 @@ class AccountMove(models.Model): # When the accounting date is prior to the tax lock date, move it automatically to the next available date. # /!\ 'check_move_validity' must be there since the dynamic lines will be recomputed outside the 'onchange' # environment. - if move.company_id.tax_lock_date and move.date <= move.company_id.tax_lock_date: + if (move.company_id.tax_lock_date and move.date <= move.company_id.tax_lock_date) and (move.line_ids.tax_ids or move.line_ids.tag_ids): move.date = move.company_id.tax_lock_date + timedelta(days=1) move.with_context(check_move_validity=False)._onchange_currency()