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.

29 lines
948 B

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