Skip to content

Commit

Permalink
Merge PR OCA#4052 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by aleuffre
  • Loading branch information
OCA-git-bot committed Mar 15, 2024
2 parents 0f5c518 + e6199b3 commit c4ae78a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions l10n_it_delivery_note/models/stock_delivery_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,17 @@ def _action_confirm(self):
note.date = datetime.date.today()

if not note.name:
note.name = sequence.with_context(
ir_sequence_date=note.date
).next_by_id()
# Avoid duplicates
while True:
name = sequence.with_context(
ir_sequence_date=note.date
).next_by_id()
if not self.search(
[("name", "=", name), ("company_id", "=", note.company_id.id)]
):
break

note.name = name
note.sequence_id = sequence

def action_confirm(self):
Expand Down

0 comments on commit c4ae78a

Please sign in to comment.