Skip to content

Commit

Permalink
[REF] sale_order_type_automation: adding try/except to avoid rollback
Browse files Browse the repository at this point in the history
closes #826

Signed-off-by: augusto-weiss <awe@adhoc.com.ar>
  • Loading branch information
matiasperalta1 committed Jun 4, 2024
1 parent 0359220 commit ebaf068
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sale_order_type_automation/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def run_invoicing_atomation(self):
invoices = self._create_invoices(final=True)
if not invoices:
continue

if rec.type_id.invoicing_atomation == 'validate_invoice':
validate_using_try_except = bool(self._context.get("validate_using_try_except"))
if not validate_using_try_except and rec.type_id.invoicing_atomation == 'validate_invoice':
invoices.sudo().action_post()
elif rec.type_id.invoicing_atomation == 'try_validate_invoice':
elif validate_using_try_except or rec.type_id.invoicing_atomation == 'try_validate_invoice':
try:
invoices.sudo().action_post()
except Exception as error:
Expand Down

0 comments on commit ebaf068

Please sign in to comment.