[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) <nim@odoo.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user