[FIX] account: Fix clearing of the accounting date

Steps to reproduce the bug:
- Go to Accounting > Vendors > Bills
- Create a new Bills
- Delete the contents of the 'Accounting Date' field.
- Click off that field.

Problem:
-An AttributeError is triggered because we try to recalculate a new name via the function `"_compute_name"`
and we base ourselves on the date field, but we do not check if it is null or not before accessing it.

This field is only used for purchase receipts, vendor bills, vendor credit notes, payments
and regular journal entries. Other move types are unaffected here.

opw-2511799

closes odoo/odoo#73490

X-original-commit: f830efa1af28de4a4cc3b861643ac9b6fb352c8d
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
This commit is contained in:
Touati Djamel (otd)
2021-07-09 11:06:11 +00:00
parent 997086ba5f
commit 511a87b488
+1 -1
View File
@@ -1096,7 +1096,7 @@ class AccountMove(models.Model):
# Group the moves by journal and month
for move in self:
if not highest_name and move == self[0] and not move.posted_before:
if not highest_name and move == self[0] and not move.posted_before and move.date:
# In the form view, we need to compute a default sequence so that the user can edit
# it. We only check the first move as an approximation (enough for new in form view)
pass