Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
document_attachment
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
document_attachment
Commits
46aba6d80afd
Commit
46aba6d80afd
authored
5 years ago
by
oury.balde
Browse files
Options
Downloads
Patches
Plain Diff
[add] new helper func in document attachment model
Note that now we can use this method to retrieve metadata from attachments.
parent
37403acbc7a3
No related branches found
Branches containing commit
Tags
13.0.1.0.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/document_attachment.py
+17
-0
17 additions, 0 deletions
models/document_attachment.py
with
17 additions
and
0 deletions
models/document_attachment.py
+
17
−
0
View file @
46aba6d8
...
...
@@ -80,3 +80,20 @@
attachments
.
unlink
()
return
ret
@api.multi
def
get_metadata
(
self
):
"""
Helper function returning the document attachment metadata
Can be overridden to add some specifics metadata
"""
self
.
ensure_one
()
return
{
"
size
"
:
self
.
file_size
,
"
type
"
:
self
.
mimetype
,
"
filename
"
:
self
.
datas_fname
,
"
hash
"
:
[
"
sha1:%s
"
%
self
.
checksum
],
"
encoding
"
:
""
,
"
customtype
"
:
self
.
type_id
.
name
,
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment