[FIX] account: fix resquence with empty journal name
Steps to reproduce: - Accounting > journal entries > misc - add entries (draft) with empty journal name - resquence those entries with entries that have names Bug: calling min or sort on the names fails when some are strings and others are bools (False for empty strings) Fix: replace names that aren't set with an empty strings opw-2957750 closes odoo/odoo#99772 X-original-commit: 0f90852818a334d66ed8a6781f5abdc022f76ff7 Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
This commit is contained in:
@@ -55,7 +55,7 @@ class ReSequenceWizard(models.TransientModel):
|
||||
self.first_name = ""
|
||||
for record in self:
|
||||
if record.move_ids:
|
||||
record.first_name = min(record.move_ids._origin.mapped('name'))
|
||||
record.first_name = min(record.move_ids._origin.mapped(lambda move: move.name or ""))
|
||||
|
||||
@api.depends('new_values', 'ordering')
|
||||
def _compute_preview_moves(self):
|
||||
@@ -128,7 +128,7 @@ class ReSequenceWizard(models.TransientModel):
|
||||
for move, new_name in zip(period_recs.sorted(lambda m: (m.sequence_prefix, m.sequence_number)), new_name_list):
|
||||
new_values[move.id]['new_by_name'] = new_name
|
||||
# For all the moves of this period, assign the name by increasing date
|
||||
for move, new_name in zip(period_recs.sorted(lambda m: (m.date, m.name, m.id)), new_name_list):
|
||||
for move, new_name in zip(period_recs.sorted(lambda m: (m.date, m.name or "", m.id)), new_name_list):
|
||||
new_values[move.id]['new_by_date'] = new_name
|
||||
|
||||
record.new_values = json.dumps(new_values)
|
||||
|
||||
Reference in New Issue
Block a user