diff --git a/beesdoo_inventory/__manifest__.py b/beesdoo_inventory/__manifest__.py index 4a24a920b..7c446bd99 100644 --- a/beesdoo_inventory/__manifest__.py +++ b/beesdoo_inventory/__manifest__.py @@ -12,7 +12,7 @@ "author": "Beescoop - Cellule IT, Coop IT Easy SCRLfs", "website": "https://github.com/beescoop/Obeesdoo", "category": "Inventory", - "version": "12.0.1.0.0", + "version": "12.0.1.0.1", "depends": ["delivery", "beesdoo_base", "beesdoo_product"], "data": ["views/stock.xml"], "installable": True, diff --git a/beesdoo_inventory/models/stock.py b/beesdoo_inventory/models/stock.py index 8b3c09a18..ec26594a9 100644 --- a/beesdoo_inventory/models/stock.py +++ b/beesdoo_inventory/models/stock.py @@ -11,30 +11,32 @@ class StockPicking(models.Model): default=lambda self: self.env.user.partner_id.id, ) + @api.multi def _add_follower(self): - if self.responsible: - 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", - "res_id": self.id, - "partner_id": self.responsible.id, - "subtype_ids": [(6, 0, types.ids)], - } + for picking in self: + if picking.responsible: + types = self.env["mail.message.subtype"].search( + [ + "|", + ("res_model", "=", "stock.picking"), + ("name", "=", "Discussions"), + ] ) + if not self.env["mail.followers"].search( + [ + ("res_id", "=", picking.id), + ("res_model", "=", "stock.picking"), + ("partner_id", "=", picking.responsible.id), + ] + ): + self.env["mail.followers"].create( + { + "res_model": "stock.picking", + "res_id": picking.id, + "partner_id": picking.responsible.id, + "subtype_ids": [(6, 0, types.ids)], + } + ) @api.multi def write(self, values):