You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
909 B

5 years ago
5 years ago
5 years ago
5 years ago
  1. from odoo import api, models
  2. class StockPackOperation(models.Model):
  3. _inherit = "stock.picking"
  4. @api.multi
  5. def actions_on_articles(self):
  6. ids = self._ids
  7. context = self._context
  8. ctx = (context or {}).copy()
  9. ctx["articles"] = []
  10. for line in self.browse(ids).move_line_ids:
  11. ctx["articles"].append(line.product_id.product_tmpl_id.id)
  12. if ctx["articles"]:
  13. return {
  14. "name": "Articles",
  15. "view_type": "list",
  16. "view_mode": "list",
  17. "res_model": "product.template",
  18. "view_id": False,
  19. "target": "current",
  20. "type": "ir.actions.act_window",
  21. "context": ctx,
  22. "nodestroy": True,
  23. "res_id": ctx["articles"],
  24. "domain": [("id", "in", ctx["articles"])],
  25. }