Skip to content

Commit

Permalink
Merge pull request #257 from beescoop/12.0-fix-beesdoo-inventory-expe…
Browse files Browse the repository at this point in the history
…cted-singleton

[FIX] beesdoo_inventory: ValueError: Expected singleton
  • Loading branch information
vvrossem authored Jul 29, 2021
2 parents b694836 + ee902be commit bf6c357
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion beesdoo_inventory/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
46 changes: 24 additions & 22 deletions beesdoo_inventory/models/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit bf6c357

Please sign in to comment.