Skip to content
Snippets Groups Projects
Commit 620730ed authored by jbm-odoo's avatar jbm-odoo
Browse files

[IMP] stock: Add context key to avoid send sms

In stock, before sending an sms, we check if there aren't the key
'skip_sms' in the context. It is useful, for example, in fsm
application.

TaskID: 2081191
parent ac8c30be
Branches
Tags
No related merge requests found
......@@ -11,7 +11,7 @@ class Picking(models.Model):
def _pre_action_done_hook(self):
res = super()._pre_action_done_hook()
if res is True:
if res is True and not self.env.context.get('skip_sms'):
pickings_to_warn_sms = self._check_warn_sms()
if pickings_to_warn_sms:
return pickings_to_warn_sms._action_generate_warn_sms_wizard()
......@@ -52,7 +52,7 @@ class Picking(models.Model):
def _send_confirmation_email(self):
super(Picking, self)._send_confirmation_email()
if not getattr(threading.currentThread(), 'testing', False) and not self.env.registry.in_test_mode():
if not self.env.context.get('skip_sms') and not getattr(threading.currentThread(), 'testing', False) and not self.env.registry.in_test_mode():
pickings = self.filtered(lambda p: p.company_id.stock_move_sms_validation and p.picking_type_id.code == 'outgoing' and (p.partner_id.mobile or p.partner_id.phone))
for picking in pickings:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment