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
747 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. from odoo import api, fields, models
  2. class RequestLabelPrintingWizard(models.TransientModel):
  3. _name = "label.printing.wizard"
  4. _description = "label.printing.wizard"
  5. def _get_selected_products(self):
  6. return self.env.context["active_ids"]
  7. product_ids = fields.Many2many(
  8. "product.template", default=_get_selected_products
  9. )
  10. @api.multi
  11. def request_printing(self):
  12. self.ensure_one()
  13. self.product_ids.write({"label_to_be_printed": True})
  14. @api.multi
  15. def set_as_printed(self):
  16. self.ensure_one()
  17. self.product_ids.write(
  18. {
  19. "label_to_be_printed": False,
  20. "label_last_printed": fields.Datetime.now(),
  21. }
  22. )