mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 08:47:40 +00:00
Merge pull request #9 from vrenaville/delivery_carrier_label_s3
[FIX] call method on attachement_id instead of self
This commit is contained in:
committed by
GitHub
co-authored by
GitHub
commit
fa008a3e83
@@ -17,7 +17,7 @@ class ShippingLabel(models.Model):
|
|||||||
|
|
||||||
@api.depends('store_fname', 'db_datas')
|
@api.depends('store_fname', 'db_datas')
|
||||||
def _compute_datas(self):
|
def _compute_datas(self):
|
||||||
values = self._data_get('datas', None)
|
values = self.attachment_id._data_get('datas', None)
|
||||||
for attach in self:
|
for attach in self:
|
||||||
attach.datas = values.get(attach.id)
|
attach.datas = values.get(attach.id)
|
||||||
|
|
||||||
@@ -26,13 +26,13 @@ class ShippingLabel(models.Model):
|
|||||||
# we keep them in the database instead of the object storage
|
# we keep them in the database instead of the object storage
|
||||||
location = self.attachment_id._storage()
|
location = self.attachment_id._storage()
|
||||||
for attach in self:
|
for attach in self:
|
||||||
if location == 's3' and self._store_in_db_when_s3():
|
if location == 's3' and self.attachment_id._store_in_db_when_s3():
|
||||||
# compute the fields that depend on datas
|
# compute the fields that depend on datas
|
||||||
value = attach.datas
|
value = attach.datas
|
||||||
bin_data = value and value.decode('base64') or ''
|
bin_data = value and value.decode('base64') or ''
|
||||||
vals = {
|
vals = {
|
||||||
'file_size': len(bin_data),
|
'file_size': len(bin_data),
|
||||||
'checksum': self._compute_checksum(bin_data),
|
'checksum': self.attachment_id._compute_checksum(bin_data),
|
||||||
'db_datas': value,
|
'db_datas': value,
|
||||||
# we seriously don't need index content on those fields
|
# we seriously don't need index content on those fields
|
||||||
'index_content': False,
|
'index_content': False,
|
||||||
@@ -43,6 +43,6 @@ class ShippingLabel(models.Model):
|
|||||||
# have write access
|
# have write access
|
||||||
super(ShippingLabel, attach.sudo()).write(vals)
|
super(ShippingLabel, attach.sudo()).write(vals)
|
||||||
if fname:
|
if fname:
|
||||||
self._file_delete(fname)
|
self.attachment_id._file_delete(fname)
|
||||||
continue
|
continue
|
||||||
self.attachment_id._data_set('datas', attach.datas, None)
|
self.attachment_id._data_set('datas', attach.datas, None)
|
||||||
|
|||||||
Reference in New Issue
Block a user