Browse Source

Fix S0024 : add responsible as follower

pull/14/head
EliseDup 8 years ago
parent
commit
018ee9044a
  1. 15
      beesdoo_inventory/models/stock.py

15
beesdoo_inventory/models/stock.py

@ -5,21 +5,20 @@ class StockPicking(models.Model):
_inherit = 'stock.picking'
max_shipping_date = fields.Datetime("End Shipping Date")
responsible = fields.Many2one("res.partner", string="Responsible Person")
responsible = fields.Many2one('res.partner', string="Responsible")
def _add_follower(self):
self.env['mail.followers'].create({'partner_id': self.responsible.id,
if(self.responsible):
types = self.env['mail.message.subtype'].search(['|',('res_model','=','stock.picking'),('name','=','Discussions')])
self.env['mail.followers'].create({'res_model' : 'stock.picking',
'res_id' : self.id,
'res_model': "stock.picking",})
'partner_id' : self.responsible.id,
'subtype_ids': [(6, 0, types.ids)]})
@api.multi
def write(self, values):
res = super(StockPicking, self).write(values)
print "WRITE"
print values.get('responsible')
if values.get('responsible'):
for picking in self:
picking._add_follower()
self._add_follower()
return res
@api.model

Loading…
Cancel
Save