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

  1. from odoo import models, fields, api
  2. class RequestLabelPrintingWizard(models.TransientModel):
  3. _name = 'label.printing.wizard'
  4. def _get_selected_products(self):
  5. return self.env.context['active_ids']
  6. product_ids = fields.Many2many('product.template', default=_get_selected_products)
  7. @api.one
  8. def request_printing(self):
  9. self.product_ids.write({'label_to_be_printed' : True})
  10. @api.one
  11. def set_as_printed(self):
  12. self.product_ids.write({'label_to_be_printed' : False, 'label_last_printed' : fields.Datetime.now()})