diff options
| author | jbm-odoo <jbm@odoo.com> | 2019-11-21 12:46:02 +0000 |
|---|---|---|
| committer | jbm-odoo <jbm@odoo.com> | 2020-02-03 13:11:58 +0000 |
| commit | 620730ed7062a83d6dd5dc62beab58270c83bc1d (patch) | |
| tree | 5bed8d2ba35a2b00d6050897e5f2b8f3002bb806 /addons/stock_sms | |
| parent | ac8c30beec072dd1f52735230eca86195bbeab7b (diff) | |
[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
Diffstat (limited to 'addons/stock_sms')
| -rw-r--r-- | addons/stock_sms/models/stock_picking.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/stock_sms/models/stock_picking.py b/addons/stock_sms/models/stock_picking.py index bcb1121da0c..4588275ee7d 100644 --- a/addons/stock_sms/models/stock_picking.py +++ b/addons/stock_sms/models/stock_picking.py @@ -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: |
