Browse Source

Fixing multiple comments from @yvaucher

pull/130/head
Valentin Chemiere 9 years ago
committed by MonsieurB
parent
commit
dbc3de272d
  1. 4
      sms_send_picking/__openerp__.py
  2. 11
      sms_send_picking/stock.py

4
sms_send_picking/__openerp__.py

@ -23,10 +23,10 @@
{ {
'name': 'Sms Send Picking', 'name': 'Sms Send Picking',
'version': '0.0.1', 'version': '0.0.1',
'author': 'Akretion',
'author': 'Akretion, OCA',
'website': 'www.akretion.com', 'website': 'www.akretion.com',
'license': 'AGPL-3', 'license': 'AGPL-3',
'category': 'Generic Modules',
'category': 'Phone',
'description': """ 'description': """
Automatic sms sending when a delivery is ready to transfert Automatic sms sending when a delivery is ready to transfert
""", """,

11
sms_send_picking/stock.py

@ -26,13 +26,13 @@ from openerp import api, models, fields
class StockPicking(models.Model): class StockPicking(models.Model):
_inherit = 'stock.picking' _inherit = 'stock.picking'
sms_sent = fields.Boolean()
sms_sent = fields.Boolean(default=False)
@api.model @api.model
def _send_sms(self): def _send_sms(self):
sms_sender_obj = self.env['partner.sms.send'] sms_sender_obj = self.env['partner.sms.send']
gateways = self.env['sms.smsclient'].search([('default_gateway', '=', gateways = self.env['sms.smsclient'].search([('default_gateway', '=',
True)])
True)], limit=1)
gateway = gateways[0] gateway = gateways[0]
pickings = self.env['stock.picking'].search( pickings = self.env['stock.picking'].search(
[('state', '=', 'assigned'), ('sms_sent', '=', False), [('state', '=', 'assigned'), ('sms_sent', '=', False),
@ -46,10 +46,3 @@ class StockPicking(models.Model):
sms_sender = sms_sender_obj.create(data) sms_sender = sms_sender_obj.create(data)
sms_sender.sms_send() sms_sender.sms_send()
pick.sms_sent = True pick.sms_sent = True
@api.one
def copy(self, default=None):
if default is None:
default = {}
default['sms_sent'] = False
return super(StockPicking, self).copy(default=default)
Loading…
Cancel
Save