Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dwsproject
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dws
dwsproject
Commits
ca1ee715
Commit
ca1ee715
authored
Nov 29, 2024
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 修改问题
parent
0f88b96c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
jzjx_project/controllers/inherit_product_task.py
+54
-0
No files found.
jzjx_project/controllers/inherit_product_task.py
View file @
ca1ee715
from
urllib
import
parse
from
odoo
import
models
,
fields
,
api
,
http
,
SUPERUSER_ID
,
_
from
odoo.addons.roke_workstation_api.controllers.product_task
import
RokeWorkstationProductionTask
from
odoo.addons.roke_workstation_api.controllers.product_task
import
RokeWorkstationTaskDispatch
...
...
@@ -183,4 +185,56 @@ class InheritRokeWorkstationTaskDispatch(RokeWorkstationTaskDispatch):
break
_self
.
jsonrequest
[
"work_order_id"
]
=
new_work_order_id
res
=
super
(
InheritRokeWorkstationTaskDispatch
,
self
)
.
product_task_get_document_list
()
if
work_order
.
type
==
"返修"
:
scrap_order_line
=
_self
.
env
[
"roke.repair.order.line"
]
.
sudo
()
.
search
([
(
"repair_work_order_id"
,
"="
,
work_order
.
id
)
],
limit
=
1
)
record_id
=
scrap_order_line
.
wr_id
elif
work_order
.
type
==
"补件"
:
scrap_order_line
=
_self
.
env
[
"roke.scrap.order.line"
]
.
sudo
()
.
search
([(
"scrap_work_order_ids"
,
"="
,
work_order
.
id
)],
limit
=
1
)
record_id
=
scrap_order_line
.
wr_id
else
:
return
res
attachment_ids
=
_self
.
env
[
'ir.attachment'
]
.
sudo
()
.
search
([
(
"res_model"
,
"="
,
"roke.work.record"
),
(
"res_id"
,
"="
,
record_id
.
id
)
])
base_url
=
_self
.
env
[
'ir.config_parameter'
]
.
sudo
()
.
get_param
(
'web.base.url'
)
for
attachment
in
attachment_ids
:
if
not
attachment
.
access_token
:
attachment
.
generate_access_token
()
name
=
f
"{attachment.name}"
if
attachment
.
mimetype
==
"application/pdf"
:
# pdf 预览
content_url
=
parse
.
quote
(
"/web/content/
%
s?access_token=
%
s"
%
(
str
(
attachment
.
id
),
attachment
.
sudo
()
.
access_token
))
url
=
f
"{base_url}/web/static/lib/pdfjs/web/viewer.html?file={content_url}"
res
[
"data"
]
.
append
({
"id"
:
attachment
.
id
,
"name"
:
name
,
"mimetype"
:
attachment
.
mimetype
,
"type"
:
"url"
,
"data"
:
url
})
else
:
if
attachment
.
index_content
==
'image'
:
url
=
f
"{base_url}/web/image/{attachment.id}?access_token={attachment.access_token}"
\
f
"&unique={str(fields.Datetime.now().timestamp())}"
res
[
"data"
]
.
append
({
"id"
:
attachment
.
id
,
"name"
:
name
,
"mimetype"
:
attachment
.
mimetype
,
"type"
:
"url"
,
"data"
:
url
})
else
:
url
=
f
"{base_url}/web/content/{attachment.id}?access_token={attachment.access_token}"
\
f
"&unique={str(fields.Datetime.now().timestamp())}"
res
[
"data"
]
.
append
({
"id"
:
attachment
.
id
,
"name"
:
name
,
"mimetype"
:
attachment
.
mimetype
,
"type"
:
"url"
,
"data"
:
url
,
})
return
res
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment