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.

20 lines
612 B

  1. from odoo import models, fields, api
  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('product.template', default=_get_selected_products)
  8. @api.one
  9. def request_printing(self):
  10. self.product_ids.write({'label_to_be_printed' : True})
  11. @api.one
  12. def set_as_printed(self):
  13. self.product_ids.write({'label_to_be_printed' : False, 'label_last_printed' : fields.Datetime.now()})