Skip to content

Commit

Permalink
Merge PR OCA#4534 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by tafaRU
  • Loading branch information
OCA-git-bot committed Jan 24, 2025
2 parents 54de5a2 + 86c1415 commit 9ac2132
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion l10n_it_delivery_note/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,20 @@ def button_validate(self):
if not self.delivery_note_id and delivery_note_to_create:
self._check_delivery_note_consistency()
res = super().button_validate()
if delivery_note_to_create and not self.delivery_note_id:
# Since this method can be called multiple times after the
# user clicks on the Validate button we must be sure to create
# the delivery note only after the stock_picking data is updated.
if (
delivery_note_to_create
and not self.delivery_note_id
and (
isinstance(res, bool)
or (
isinstance(res, dict)
and res["res_model"] == "stock.backorder.confirmation"
)
)
):
delivery_note = self._create_delivery_note()
self.write({"delivery_note_id": delivery_note.id})
if self.sale_id:
Expand Down

0 comments on commit 9ac2132

Please sign in to comment.