From 8e493f3f3d7fa5f0fe6e0f9c884640d257e412a2 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 6 May 2020 08:49:30 +0000 Subject: [PATCH] [FIX] stock_sms: SMS for picking from POS Avoid sending an SMS for picking created from the POS. We usually don't want to send an SMS if the customer just bought the product in the physical shop. This is more a workaround than a real fix, since the only field that can be used to distinghish the pickings is the picking type. A better solution would probably be to set the SMS sending configuration at the picking type level. opw-2250185 closes odoo/odoo#50768 X-original-commit: 58492733b81073694a7e2f5e790b31983f91df7d Signed-off-by: Nicolas Martinelli (nim) --- addons/stock_sms/models/stock_picking.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/stock_sms/models/stock_picking.py b/addons/stock_sms/models/stock_picking.py index 4588275ee7d..f3344a483e6 100644 --- a/addons/stock_sms/models/stock_picking.py +++ b/addons/stock_sms/models/stock_picking.py @@ -54,6 +54,9 @@ class Picking(models.Model): super(Picking, self)._send_confirmation_email() 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)) + # Avoid sending SMS for POS deliveries + if 'pos_type_id' in self.env['stock.warehouse']: + pickings = pickings.filtered(lambda p: p.picking_type_id != p.picking_type_id.warehouse_id.pos_type_id) for picking in pickings: # Sudo as the user has not always the right to read this sms template.