File: card_template.py

package info (click to toggle)
odoo 18.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 878,716 kB
  • sloc: javascript: 927,937; python: 685,670; xml: 388,524; sh: 1,033; sql: 415; makefile: 26
file content (22 lines) | stat: -rw-r--r-- 989 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from odoo import fields, models

# Good ratio to have a large image still small enough to stay under 5MB (common limit)
# Close to the 2:1 ratio recommended by twitter and these dimensions are recommended by meta
# https://developers.facebook.com/docs/sharing/webmasters/images/
# https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/summary-card-with-large-image
TEMPLATE_DIMENSIONS = (600, 315)
TEMPLATE_RATIO = 40 / 21


class CardCampaignTemplate(models.Model):
    _name = 'card.template'
    _description = 'Marketing Card Template'

    name = fields.Char(required=True)
    default_background = fields.Image()
    body = fields.Html(sanitize_tags=False, sanitize_attributes=False)

    primary_color = fields.Char(default='#f9f9f9', required=True)
    secondary_color = fields.Char(default='#000000', required=True)
    primary_text_color = fields.Char(default='#000000', required=True)
    secondary_text_color = fields.Char(default='#ffffff', required=True)