[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) <nim@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2019-11-20 15:00:41 +00:00
committed by fw-bot
parent 210858cc66
commit 64b9269b9b
+1 -1
View File
@@ -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()