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.

26 lines
691 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.one
  11. def request_printing(self):
  12. self.product_ids.write({"label_to_be_printed": True})
  13. @api.one
  14. def set_as_printed(self):
  15. self.product_ids.write(
  16. {
  17. "label_to_be_printed": False,
  18. "label_last_printed": fields.Datetime.now(),
  19. }
  20. )