|
|
@ -35,13 +35,21 @@ class LObjectIrAttachment(models.Model): |
|
|
|
store_lobject = LargeObject( |
|
|
|
string="Data") |
|
|
|
|
|
|
|
@api.model |
|
|
|
def storage_locations(self): |
|
|
|
locations = super(LObjectIrAttachment, self).storage_locations() |
|
|
|
locations.append('lobject') |
|
|
|
return locations |
|
|
|
|
|
|
|
@api.model |
|
|
|
def force_storage(self): |
|
|
|
if not self.env.user._is_admin(): |
|
|
|
raise AccessError(_('Only administrators can execute this action.')) |
|
|
|
if self._storage() != 'lobject': |
|
|
|
return super(LObjectIrAttachment, self).force_storage() |
|
|
|
else: |
|
|
|
storage_domain = { |
|
|
|
'db': ('store_lobject', '=', False), |
|
|
|
'file': ('store_fname', '=', False), |
|
|
|
'lobject': ('store_lobject', '=', False), |
|
|
|
} |
|
|
|
record_domain = [ |
|
|
|
'&', storage_domain[self._storage()], |
|
|
|