summaryrefslogtreecommitdiff
path: root/odoo/addons/base/models
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2018-12-06 10:46:57 +0000
committerXavier Morel <xmo@odoo.com>2018-12-07 13:37:34 +0000
commit66f0e26f6f3f2155fcfcc55e84f2e76cbfdb2c1d (patch)
tree7dbd4cbc827e8455eb4d8bd4013003b8069fc448 /odoo/addons/base/models
parent299f9f1eb06f9df950df1dc02e368caa9b3a9871 (diff)
[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
Diffstat (limited to 'odoo/addons/base/models')
-rw-r--r--odoo/addons/base/models/ir_actions.py2
-rw-r--r--odoo/addons/base/models/ir_attachment.py2
-rw-r--r--odoo/addons/base/models/ir_property.py2
-rw-r--r--odoo/addons/base/models/res_company.py2
-rw-r--r--odoo/addons/base/models/res_partner.py6
5 files changed, 7 insertions, 7 deletions
diff --git a/odoo/addons/base/models/ir_actions.py b/odoo/addons/base/models/ir_actions.py
index 2b9f88104f1..814973aedc9 100644
--- a/odoo/addons/base/models/ir_actions.py
+++ b/odoo/addons/base/models/ir_actions.py
@@ -772,7 +772,7 @@ class IrActionsActClient(models.Model):
params = fields.Binary(compute='_compute_params', inverse='_inverse_params', string='Supplementary arguments',
help="Arguments sent to the client along with "
"the view tag")
- params_store = fields.Binary(string='Params storage', readonly=True)
+ params_store = fields.Binary(string='Params storage', readonly=True, attachment=False)
@api.depends('params_store')
def _compute_params(self):
diff --git a/odoo/addons/base/models/ir_attachment.py b/odoo/addons/base/models/ir_attachment.py
index 967f93a33e2..942c5c906b2 100644
--- a/odoo/addons/base/models/ir_attachment.py
+++ b/odoo/addons/base/models/ir_attachment.py
@@ -294,7 +294,7 @@ class IrAttachment(models.Model):
# the field 'datas' is computed and may use the other fields below
datas = fields.Binary(string='File Content', compute='_compute_datas', inverse='_inverse_datas')
- db_datas = fields.Binary('Database Data')
+ db_datas = fields.Binary('Database Data', attachment=False)
store_fname = fields.Char('Stored Filename')
file_size = fields.Integer('File Size', readonly=True)
checksum = fields.Char("Checksum/SHA1", size=40, index=True, readonly=True)
diff --git a/odoo/addons/base/models/ir_property.py b/odoo/addons/base/models/ir_property.py
index 3360693d70d..0690080670f 100644
--- a/odoo/addons/base/models/ir_property.py
+++ b/odoo/addons/base/models/ir_property.py
@@ -42,7 +42,7 @@ class Property(models.Model):
value_float = fields.Float()
value_integer = fields.Integer()
value_text = fields.Text() # will contain (char, text)
- value_binary = fields.Binary()
+ value_binary = fields.Binary(attachment=False)
value_reference = fields.Char()
value_datetime = fields.Datetime()
type = fields.Selection([('char', 'Char'),
diff --git a/odoo/addons/base/models/res_company.py b/odoo/addons/base/models/res_company.py
index 64fb3ee6fb2..958b7a4edba 100644
--- a/odoo/addons/base/models/res_company.py
+++ b/odoo/addons/base/models/res_company.py
@@ -39,7 +39,7 @@ class Company(models.Model):
logo = fields.Binary(related='partner_id.image', default=_get_logo, string="Company Logo", readonly=False)
# logo_web: do not store in attachments, since the image is retrieved in SQL for
# performance reasons (see addons/web/controllers/main.py, Binary.company_logo)
- logo_web = fields.Binary(compute='_compute_logo_web', store=True)
+ logo_web = fields.Binary(compute='_compute_logo_web', store=True, attachment=False)
currency_id = fields.Many2one('res.currency', string='Currency', required=True, default=lambda self: self._get_user_currency())
user_ids = fields.Many2many('res.users', 'res_company_users_rel', 'cid', 'user_id', string='Accepted Users')
account_no = fields.Char(string='Account No.')
diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py
index f61dbbced38..5868209f38d 100644
--- a/odoo/addons/base/models/res_partner.py
+++ b/odoo/addons/base/models/res_partner.py
@@ -222,13 +222,13 @@ class Partner(models.Model):
company_name = fields.Char('Company Name')
# image: all image fields are base64 encoded and PIL-supported
- image = fields.Binary("Image", attachment=True,
+ image = fields.Binary("Image",
help="This field holds the image used as avatar for this contact, limited to 1024x1024px",)
- image_medium = fields.Binary("Medium-sized image", attachment=True,
+ image_medium = fields.Binary("Medium-sized image",
help="Medium-sized image of this contact. It is automatically "\
"resized as a 128x128px image, with aspect ratio preserved. "\
"Use this field in form views or some kanban views.")
- image_small = fields.Binary("Small-sized image", attachment=True,
+ image_small = fields.Binary("Small-sized image",
help="Small-sized image of this contact. It is automatically "\
"resized as a 64x64px image, with aspect ratio preserved. "\
"Use this field anywhere a small image is required.")