Browse Source

[FIX] [0024-Bug] cannot set two times the same responsible

pull/111/head
Thibault Francois 8 years ago
committed by Rémy Taymans
parent
commit
c0ad80b0fc
  1. 6
      beesdoo_inventory/models/stock.py

6
beesdoo_inventory/models/stock.py

@ -10,7 +10,10 @@ class StockPicking(models.Model):
def _add_follower(self): def _add_follower(self):
if(self.responsible): if(self.responsible):
types = self.env['mail.message.subtype'].search(['|',('res_model','=','stock.picking'),('name','=','Discussions')]) types = self.env['mail.message.subtype'].search(['|',('res_model','=','stock.picking'),('name','=','Discussions')])
self.env['mail.followers'].create({'res_model' : 'stock.picking',
if not self.env['mail.followers'].search([('res_id', '=', self.id),
('res_model', '=', 'stock.picking'),
('partner_id', '=', self.responsible.id)]):
self.env['mail.followers'].create({'res_model' : 'stock.picking',
'res_id' : self.id, 'res_id' : self.id,
'partner_id' : self.responsible.id, 'partner_id' : self.responsible.id,
'subtype_ids': [(6, 0, types.ids)]}) 'subtype_ids': [(6, 0, types.ids)]})
@ -23,7 +26,6 @@ class StockPicking(models.Model):
@api.model @api.model
def create(self, values): def create(self, values):
print "Values", values
picking = super(StockPicking, self).create(values) picking = super(StockPicking, self).create(values)
picking._add_follower() picking._add_follower()
return picking return picking

Loading…
Cancel
Save