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.

41 lines
1.8 KiB

3 years ago
  1. # © 2021 Le Filament (<http://www.le-filament.com>)
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo import fields, models
  4. PAPER_SIZES = [
  5. {
  6. 'description': 'E1 57 x 35 mm',
  7. 'key': 'E1',
  8. 'height': 35.0,
  9. 'width': 57.0,
  10. }, {
  11. 'key': 'E2',
  12. 'description': 'E2 40 x 45 mm',
  13. 'height': 45.0,
  14. 'width': 40.0,
  15. },
  16. ]
  17. class ReportTicketformat(models.Model):
  18. _name = "report.ticketformat"
  19. _description = "Format pour impression tickets"
  20. name = fields.Char('Nom', required=True)
  21. default = fields.Boolean('Default paper format ?')
  22. format = fields.Selection(
  23. [(ps['key'], ps['description']) for ps in PAPER_SIZES],
  24. "Taille de l'étiquette",
  25. default='E1', help="Sélectionner le format de l'étiquette")
  26. # margin_top = fields.Float('Top Margin (mm)', default=40)
  27. # margin_bottom = fields.Float('Bottom Margin (mm)', default=20)
  28. # margin_left = fields.Float('Left Margin (mm)', default=7)
  29. # margin_right = fields.Float('Right Margin (mm)', default=7)
  30. page_height = fields.Integer('Hauteur du ticket (mm)', default=False)
  31. page_width = fields.Integer('Largeur du ticket (mm)', default=False)
  32. header_line = fields.Boolean('Display a header line', default=False)
  33. # header_spacing = fields.Integer('Header spacing', default=35)
  34. # dpi = fields.Integer('Output DPI', required=True, default=90)
  35. # report_ids = fields.One2many('ir.actions.report', 'paperformat_id', 'Associated reports', help="Explicitly associated reports")
  36. # print_page_width = fields.Float('Print page width (mm)', compute='_compute_print_page_size')
  37. # print_page_height = fields.Float('Print page height (mm)', compute='_compute_print_page_size')