Browse Source

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

pull/18/head
Thibault Francois 8 years ago
parent
commit
f079d7addd
  1. 4
      beesdoo_inventory/models/stock.py

4
beesdoo_inventory/models/stock.py

@ -10,6 +10,9 @@ 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')])
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', 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,
@ -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