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
ce80781f
Commit
ce80781f
authored
Jan 20, 2025
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 工资单导出
parent
1af2c6ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
sdddl_project/controllers/__init__.py
+1
-0
sdddl_project/controllers/salary_excel.py
+38
-0
No files found.
sdddl_project/controllers/__init__.py
View file @
ce80781f
...
...
@@ -2,3 +2,4 @@ from . import roke_work_order
from
.
import
roke_dws_process_design
from
.
import
inherit_production_task
from
.
import
material
from
.
import
salary_excel
sdddl_project/controllers/salary_excel.py
0 → 100644
View file @
ce80781f
import
logging
import
pytz
import
xlwt
from
io
import
BytesIO
import
base64
from
odoo.osv
import
expression
from
odoo
import
models
,
fields
,
api
,
http
,
SUPERUSER_ID
,
_
from
odoo.addons.roke_mes_salary.controller.excel
import
ExcelDownloadController
class
InheritExcelDownloadController
(
ExcelDownloadController
):
def
_data_make_excel
(
self
,
order_line
):
"""
生成 Excel 文件
"""
# 创建DataFrame对象
result
=
[
[
'员工'
,
'产品名称'
,
'型号'
,
'数量'
,
'计件薪酬'
],
]
for
order
in
order_line
:
for
v
in
order
.
confirm_order_line_ids
:
result
.
append
([
order
.
employee_id
.
name
or
''
,
v
.
product_id
.
name
or
''
,
v
.
product_id
.
model
or
''
,
v
.
finish_qty
or
0
,
v
.
salary
or
0
])
wbk
=
xlwt
.
Workbook
()
sheet
=
wbk
.
add_sheet
(
'Sheet1'
,
cell_overwrite_ok
=
True
)
for
i
in
range
(
len
(
result
)):
for
j
in
range
(
len
(
result
[
i
])):
sheet
.
write
(
i
,
j
,
result
[
i
][
j
])
buffer
=
BytesIO
()
wbk
.
save
(
buffer
)
data
=
base64
.
encodebytes
(
buffer
.
getvalue
())
return
data
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