|
|
@ -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, |
|
|
|
'res_id': self.id, |
|
|
|
'res_model': "stock.picking",}) |
|
|
|
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, |
|
|
|
'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 |
|
|
|