Files
odoo_source/addons/web_editor/models/test_models.py
T
Xavier Morel 66f0e26f6f [CHG] *: make binary fields default to attachment=True
Check that it makes custom binary fields into attachment as that's the
main reason for the change: when users create binary fields via Studio,
they're necessarily db-stored (as the interface doesn't allow altering
the attachment attribute and it's unclear how we'd handle users
switching it on/off every time), which significantly bloats their
database (and burns storage & backup space), especially as the primary
use case for binary fields is adding images and documents to records.

* check that binary fields are properly created as attachment=True
* add attachment=False on fields where that seems relevant (most but not
  all of the fields previously using the default)
* remove occurrences of attachment=True

closes odoo/odoo#29308
2018-12-07 13:37:34 +00:00

44 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class ConverterTest(models.Model):
_name = 'web_editor.converter.test'
_description = 'Web Editor Converter Test'
# disable translation export for those brilliant field labels and values
_translate = False
char = fields.Char()
integer = fields.Integer()
float = fields.Float()
numeric = fields.Float(digits=(16, 2))
many2one = fields.Many2one('web_editor.converter.test.sub')
binary = fields.Binary(attachment=False)
date = fields.Date()
datetime = fields.Datetime()
selection = fields.Selection([
(1, "réponse A"),
(2, "réponse B"),
(3, "réponse C"),
(4, "réponse <D>"),
])
selection_str = fields.Selection([
('A', "Qu'il n'est pas arrivé à Toronto"),
('B', "Qu'il était supposé arriver à Toronto"),
('C', "Qu'est-ce qu'il fout ce maudit pancake, tabernacle ?"),
('D', "La réponse D"),
], string=u"Lorsqu'un pancake prend l'avion à destination de Toronto et "
u"qu'il fait une escale technique à St Claude, on dit:")
html = fields.Html()
text = fields.Text()
class ConverterTestSub(models.Model):
_name = 'web_editor.converter.test.sub'
_description = 'Web Editor Converter Subtest'
name = fields.Char()