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
10d461f6
Commit
10d461f6
authored
Mar 04, 2025
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 玖姿收入表添加客户数据字段
parent
b0760bef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
23 deletions
+58
-23
roke_product_income_expense/controller/main.py
+26
-15
roke_product_income_expense/models/product_income_expense.py
+1
-0
roke_product_income_expense/static/src/js/index.html
+31
-8
No files found.
roke_product_income_expense/controller/main.py
View file @
10d461f6
...
@@ -36,7 +36,8 @@ class ProductIncomeExpenseIframe(http.Controller):
...
@@ -36,7 +36,8 @@ class ProductIncomeExpenseIframe(http.Controller):
"abstract"
:
v
.
get
(
"abstract"
,
False
),
"abstract"
:
v
.
get
(
"abstract"
,
False
),
"income"
:
v
.
get
(
"income"
,
False
),
"income"
:
v
.
get
(
"income"
,
False
),
"machinery_type"
:
v
.
get
(
"machinery_type"
,
"其他"
),
"machinery_type"
:
v
.
get
(
"machinery_type"
,
"其他"
),
"expenditure"
:
v
.
get
(
"expenditure"
,
False
)
"expenditure"
:
v
.
get
(
"expenditure"
,
False
),
"customer"
:
v
.
get
(
"customer"
,
False
)
}
}
_self
.
env
(
user
=
v
.
get
(
"user_id"
))[
"roke.product.income.expense"
]
.
create
(
data
)
_self
.
env
(
user
=
v
.
get
(
"user_id"
))[
"roke.product.income.expense"
]
.
create
(
data
)
return
{
"code"
:
0
,
"message"
:
"创建成功!"
}
return
{
"code"
:
0
,
"message"
:
"创建成功!"
}
...
@@ -49,7 +50,8 @@ class ProductIncomeExpenseIframe(http.Controller):
...
@@ -49,7 +50,8 @@ class ProductIncomeExpenseIframe(http.Controller):
start_date
=
_self
.
jsonrequest
.
get
(
"start_date"
,
""
)
start_date
=
_self
.
jsonrequest
.
get
(
"start_date"
,
""
)
end_date
=
_self
.
jsonrequest
.
get
(
"end_date"
,
""
)
end_date
=
_self
.
jsonrequest
.
get
(
"end_date"
,
""
)
type_str
=
_self
.
jsonrequest
.
get
(
"type_str"
,
False
)
# income收入/expenditure支出
type_str
=
_self
.
jsonrequest
.
get
(
"type_str"
,
False
)
# income收入/expenditure支出
machinery_type
=
_self
.
jsonrequest
.
get
(
"machinery_type"
,
False
)
# income收入/expenditure支出
machinery_type
=
_self
.
jsonrequest
.
get
(
"machinery_type"
,
False
)
customer
=
_self
.
jsonrequest
.
get
(
"customer"
,
False
)
domain
=
[]
domain
=
[]
if
start_date
and
end_date
:
if
start_date
and
end_date
:
domain
.
append
((
"business_date"
,
">="
,
start_date
))
domain
.
append
((
"business_date"
,
">="
,
start_date
))
...
@@ -58,6 +60,8 @@ class ProductIncomeExpenseIframe(http.Controller):
...
@@ -58,6 +60,8 @@ class ProductIncomeExpenseIframe(http.Controller):
domain
.
append
((
type_str
,
">"
,
0
))
domain
.
append
((
type_str
,
">"
,
0
))
if
machinery_type
:
if
machinery_type
:
domain
.
append
((
"machinery_type"
,
"="
,
machinery_type
))
domain
.
append
((
"machinery_type"
,
"="
,
machinery_type
))
if
customer
:
domain
.
append
((
"customer"
,
"ilike"
,
customer
))
data_list
=
_self
.
env
[
"roke.product.income.expense"
]
.
sudo
()
.
search
(
domain
,
limit
=
limit
,
data_list
=
_self
.
env
[
"roke.product.income.expense"
]
.
sudo
()
.
search
(
domain
,
limit
=
limit
,
offset
=
(
page
-
1
)
*
limit
,
offset
=
(
page
-
1
)
*
limit
,
order
=
"business_date desc, create_date desc"
)
order
=
"business_date desc, create_date desc"
)
...
@@ -68,6 +72,7 @@ class ProductIncomeExpenseIframe(http.Controller):
...
@@ -68,6 +72,7 @@ class ProductIncomeExpenseIframe(http.Controller):
"id"
:
v
.
id
,
"id"
:
v
.
id
,
"business_date"
:
v
.
business_date
and
v
.
business_date
.
strftime
(
'
%
Y-
%
m-
%
d'
),
"business_date"
:
v
.
business_date
and
v
.
business_date
.
strftime
(
'
%
Y-
%
m-
%
d'
),
"abstract"
:
v
.
abstract
or
""
,
"abstract"
:
v
.
abstract
or
""
,
"customer"
:
v
.
customer
or
""
,
"income"
:
v
.
income
or
0
,
"income"
:
v
.
income
or
0
,
"machinery_type"
:
v
.
machinery_type
or
"其他"
,
"machinery_type"
:
v
.
machinery_type
or
"其他"
,
"expenditure"
:
v
.
expenditure
or
0
,
"expenditure"
:
v
.
expenditure
or
0
,
...
@@ -95,7 +100,8 @@ class ProductIncomeExpenseIframe(http.Controller):
...
@@ -95,7 +100,8 @@ class ProductIncomeExpenseIframe(http.Controller):
start_date
=
kwargs
.
get
(
"start_date"
,
""
)
start_date
=
kwargs
.
get
(
"start_date"
,
""
)
end_date
=
kwargs
.
get
(
"end_date"
,
""
)
end_date
=
kwargs
.
get
(
"end_date"
,
""
)
type_str
=
kwargs
.
get
(
"type_str"
,
False
)
# income收入/expenditure支出
type_str
=
kwargs
.
get
(
"type_str"
,
False
)
# income收入/expenditure支出
machinery_type
=
kwargs
.
get
(
"machinery_type"
,
False
)
# income收入/expenditure支出
machinery_type
=
kwargs
.
get
(
"machinery_type"
,
False
)
customer
=
kwargs
.
get
(
"customer"
,
False
)
domain
=
[]
domain
=
[]
if
start_date
and
end_date
:
if
start_date
and
end_date
:
domain
.
append
((
"business_date"
,
">="
,
start_date
))
domain
.
append
((
"business_date"
,
">="
,
start_date
))
...
@@ -104,12 +110,15 @@ class ProductIncomeExpenseIframe(http.Controller):
...
@@ -104,12 +110,15 @@ class ProductIncomeExpenseIframe(http.Controller):
domain
.
append
((
type_str
,
">"
,
0.0
))
domain
.
append
((
type_str
,
">"
,
0.0
))
if
machinery_type
:
if
machinery_type
:
domain
.
append
((
"machinery_type"
,
"="
,
machinery_type
))
domain
.
append
((
"machinery_type"
,
"="
,
machinery_type
))
if
customer
:
domain
.
append
((
"customer"
,
"ilike"
,
customer
))
data_list
=
_self
.
env
[
"roke.product.income.expense"
]
.
sudo
()
.
search
(
domain
,
order
=
"business_date desc, create_date desc"
)
data_list
=
_self
.
env
[
"roke.product.income.expense"
]
.
sudo
()
.
search
(
domain
,
order
=
"business_date desc, create_date desc"
)
data
=
[]
data
=
[]
for
v
in
data_list
:
for
v
in
data_list
:
data
.
append
({
data
.
append
({
"business_date"
:
v
.
business_date
,
"business_date"
:
v
.
business_date
,
"abstract"
:
v
.
abstract
or
""
,
"abstract"
:
v
.
abstract
or
""
,
"customer"
:
v
.
customer
or
""
,
"income"
:
v
.
income
or
0
,
"income"
:
v
.
income
or
0
,
"expenditure"
:
v
.
expenditure
or
0
,
"expenditure"
:
v
.
expenditure
or
0
,
"balance"
:
v
.
balance
or
0
,
"balance"
:
v
.
balance
or
0
,
...
@@ -133,22 +142,24 @@ class ProductIncomeExpenseIframe(http.Controller):
...
@@ -133,22 +142,24 @@ class ProductIncomeExpenseIframe(http.Controller):
worksheet
.
write
(
0
,
0
,
"业务日期"
,
header_format
)
worksheet
.
write
(
0
,
0
,
"业务日期"
,
header_format
)
worksheet
.
write
(
0
,
1
,
"摘要"
,
header_format
)
worksheet
.
write
(
0
,
1
,
"摘要"
,
header_format
)
worksheet
.
write
(
0
,
2
,
"收入"
,
header_format
)
worksheet
.
write
(
0
,
2
,
"客户"
,
header_format
)
worksheet
.
write
(
0
,
3
,
"支出"
,
header_format
)
worksheet
.
write
(
0
,
3
,
"收入"
,
header_format
)
worksheet
.
write
(
0
,
4
,
"结余"
,
header_format
)
worksheet
.
write
(
0
,
4
,
"支出"
,
header_format
)
worksheet
.
write
(
0
,
5
,
"类型"
,
header_format
)
worksheet
.
write
(
0
,
5
,
"结余"
,
header_format
)
worksheet
.
write
(
0
,
6
,
"创建人"
,
header_format
)
worksheet
.
write
(
0
,
6
,
"类型"
,
header_format
)
worksheet
.
write
(
0
,
7
,
"创建时间"
,
header_format
)
worksheet
.
write
(
0
,
7
,
"创建人"
,
header_format
)
worksheet
.
write
(
0
,
8
,
"创建时间"
,
header_format
)
for
row_num
,
row_data
in
enumerate
(
data
):
for
row_num
,
row_data
in
enumerate
(
data
):
worksheet
.
write_datetime
(
row_num
+
1
,
0
,
row_data
.
get
(
"business_date"
),
date_format
)
worksheet
.
write_datetime
(
row_num
+
1
,
0
,
row_data
.
get
(
"business_date"
),
date_format
)
worksheet
.
write
(
row_num
+
1
,
1
,
row_data
.
get
(
"abstract"
))
worksheet
.
write
(
row_num
+
1
,
1
,
row_data
.
get
(
"abstract"
))
worksheet
.
write_number
(
row_num
+
1
,
2
,
row_data
.
get
(
"income"
),
currency_format
)
worksheet
.
write
(
row_num
+
1
,
2
,
row_data
.
get
(
"customer"
))
worksheet
.
write_number
(
row_num
+
1
,
3
,
row_data
.
get
(
"expenditure"
),
currency_format
)
worksheet
.
write_number
(
row_num
+
1
,
3
,
row_data
.
get
(
"income"
),
currency_format
)
worksheet
.
write_number
(
row_num
+
1
,
4
,
row_data
.
get
(
"balance"
),
currency_format
)
worksheet
.
write_number
(
row_num
+
1
,
4
,
row_data
.
get
(
"expenditure"
),
currency_format
)
worksheet
.
write
(
row_num
+
1
,
5
,
row_data
.
get
(
"machinery_type"
))
worksheet
.
write_number
(
row_num
+
1
,
5
,
row_data
.
get
(
"balance"
),
currency_format
)
worksheet
.
write
(
row_num
+
1
,
6
,
row_data
.
get
(
"user_name"
))
worksheet
.
write
(
row_num
+
1
,
6
,
row_data
.
get
(
"machinery_type"
))
worksheet
.
write_datetime
(
row_num
+
1
,
7
,
row_data
.
get
(
"create_date"
),
datetime_format
)
worksheet
.
write
(
row_num
+
1
,
7
,
row_data
.
get
(
"user_name"
))
worksheet
.
write_datetime
(
row_num
+
1
,
8
,
row_data
.
get
(
"create_date"
),
datetime_format
)
workbook
.
close
()
workbook
.
close
()
output
.
seek
(
0
)
output
.
seek
(
0
)
...
...
roke_product_income_expense/models/product_income_expense.py
View file @
10d461f6
...
@@ -16,6 +16,7 @@ class ProductIncomeExpense(models.Model):
...
@@ -16,6 +16,7 @@ class ProductIncomeExpense(models.Model):
balance
=
fields
.
Float
(
string
=
"结余"
,
compute
=
"_compute_balance"
)
balance
=
fields
.
Float
(
string
=
"结余"
,
compute
=
"_compute_balance"
)
machinery_type
=
fields
.
Selection
([(
"烘干桶"
,
"烘干桶"
),
(
"钣金"
,
"钣金"
),
(
"颗粒机"
,
"颗粒机"
),
(
"其他"
,
"其他"
)],
machinery_type
=
fields
.
Selection
([(
"烘干桶"
,
"烘干桶"
),
(
"钣金"
,
"钣金"
),
(
"颗粒机"
,
"颗粒机"
),
(
"其他"
,
"其他"
)],
default
=
"其他"
,
string
=
"类型"
)
default
=
"其他"
,
string
=
"类型"
)
customer
=
fields
.
Char
(
string
=
"客户"
)
@api.depends
(
"income"
,
"expenditure"
)
@api.depends
(
"income"
,
"expenditure"
)
def
_compute_balance
(
self
):
def
_compute_balance
(
self
):
...
...
roke_product_income_expense/static/src/js/index.html
View file @
10d461f6
...
@@ -34,6 +34,11 @@
...
@@ -34,6 +34,11 @@
<el-input
v-model=
"scope.row.abstract"
placeholder=
"请输入"
></el-input>
<el-input
v-model=
"scope.row.abstract"
placeholder=
"请输入"
></el-input>
</template>
</template>
</el-table-column>
</el-table-column>
<el-table-column
label=
"客户"
align=
"center"
width=
"180"
>
<template
slot-scope=
"scope"
>
<el-input
v-model=
"scope.row.customer"
placeholder=
"请输入"
></el-input>
</template>
</el-table-column>
<el-table-column
label=
"收入"
align=
"center"
width=
"120"
>
<el-table-column
label=
"收入"
align=
"center"
width=
"120"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<el-input
v-model=
"scope.row.income"
type=
"number"
placeholder=
"请输入"
></el-input>
<el-input
v-model=
"scope.row.income"
type=
"number"
placeholder=
"请输入"
></el-input>
...
@@ -71,20 +76,21 @@
...
@@ -71,20 +76,21 @@
</div>
</div>
<div
style=
"text-align: right; margin-bottom: 5px;"
>
<div
style=
"
display: flex;justify-content: flex-end;
text-align: right; margin-bottom: 5px;"
>
<el-select
v-model=
"select_value"
clearable
placeholder=
"请选择收支类型"
@
change=
"select_change"
>
<el-select
v-model=
"select_value"
clearable
placeholder=
"请选择收支类型"
@
change=
"select_change"
>
<el-option
v-for=
"item in select_options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
<el-option
v-for=
"item in select_options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-option>
</el-select>
</el-select>
<el-select
v-model=
"machinery_type_value"
clearable
placeholder=
"请选择类型"
@
change=
"machinery_type_change"
>
<el-select
class=
"margin_sty"
v-model=
"machinery_type_value"
clearable
placeholder=
"请选择类型"
@
change=
"machinery_type_change"
>
<el-option
v-for=
"item in machinery_type_options"
:key=
"item.value"
:label=
"item.label"
<el-option
v-for=
"item in machinery_type_options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
:value=
"item.value"
>
</el-option>
</el-option>
</el-select>
</el-select>
<el-input
style=
"width: 15%;"
v-model=
"customer_value"
placeholder=
"请填写客户名称"
@
change=
"select_change"
></el-input>
<el-date-picker
v-model=
"datePickerValue"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期"
<el-date-picker
class=
"margin_sty"
v-model=
"datePickerValue"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
format=
"yyyy-MM-dd"
value-format=
"yyyy-MM-dd"
@
change=
"datePickerChange"
>
end-placeholder=
"结束日期"
format=
"yyyy-MM-dd"
value-format=
"yyyy-MM-dd"
@
change=
"datePickerChange"
>
</el-date-picker>
</el-date-picker>
...
@@ -107,6 +113,13 @@
...
@@ -107,6 +113,13 @@
</div>
</div>
</template>
</template>
</el-table-column>
</el-table-column>
<el-table-column
label=
"客户"
align=
"center"
>
<template
slot-scope=
"scope"
>
<div
style=
"text-align: left;"
>
[[ scope.row.customer ]]
</div>
</template>
</el-table-column>
<el-table-column
label=
"收入"
align=
"center"
width=
"120"
>
<el-table-column
label=
"收入"
align=
"center"
width=
"120"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<div
style=
"text-align: right;"
>
<div
style=
"text-align: right;"
>
...
@@ -180,11 +193,12 @@
...
@@ -180,11 +193,12 @@
{
{
business_date
:
''
,
business_date
:
''
,
abstract
:
''
,
abstract
:
''
,
customer
:
''
,
income
:
''
,
income
:
''
,
expenditure
:
''
,
expenditure
:
''
,
user_name
:
''
,
user_name
:
''
,
user_id
:
null
,
user_id
:
null
,
machinery_type
:
''
machinery_type
:
''
}
}
],
],
datePickerValue
:
[
''
,
''
],
datePickerValue
:
[
''
,
''
],
...
@@ -209,7 +223,8 @@
...
@@ -209,7 +223,8 @@
label
:
'其他'
label
:
'其他'
}],
}],
select_value
:
''
,
select_value
:
''
,
machinery_type_value
:
''
machinery_type_value
:
''
,
customer_value
:
''
};
};
},
},
...
@@ -245,7 +260,7 @@
...
@@ -245,7 +260,7 @@
},
},
// 获取列表数据
// 获取列表数据
getDataList
()
{
getDataList
()
{
if
(
!
this
.
datePickerValue
)
{
if
(
!
this
.
datePickerValue
)
{
this
.
datePickerValue
=
[
''
,
''
]
this
.
datePickerValue
=
[
''
,
''
]
}
}
this
.
loading
=
true
;
this
.
loading
=
true
;
...
@@ -255,7 +270,8 @@
...
@@ -255,7 +270,8 @@
start_date
:
this
.
datePickerValue
[
0
],
start_date
:
this
.
datePickerValue
[
0
],
end_date
:
this
.
datePickerValue
[
1
],
end_date
:
this
.
datePickerValue
[
1
],
type_str
:
this
.
select_value
,
type_str
:
this
.
select_value
,
machinery_type
:
this
.
machinery_type_value
machinery_type
:
this
.
machinery_type_value
,
customer
:
this
.
customer_value
}
}
axios
.
request
({
axios
.
request
({
url
:
"/roke/product/product_income_expense/get"
,
url
:
"/roke/product/product_income_expense/get"
,
...
@@ -328,6 +344,7 @@
...
@@ -328,6 +344,7 @@
formData
.
append
(
"end_date"
,
this
.
datePickerValue
[
1
]);
formData
.
append
(
"end_date"
,
this
.
datePickerValue
[
1
]);
formData
.
append
(
"type_str"
,
this
.
select_value
);
formData
.
append
(
"type_str"
,
this
.
select_value
);
formData
.
append
(
"machinery_type"
,
this
.
machinery_type_value
);
formData
.
append
(
"machinery_type"
,
this
.
machinery_type_value
);
formData
.
append
(
"customer"
,
this
.
customer_value
);
axios
.
post
(
"/roke/product/product_income_expense/export"
,
axios
.
post
(
"/roke/product/product_income_expense/export"
,
formData
,
formData
,
_config
,
_config
,
...
@@ -388,14 +405,16 @@
...
@@ -388,14 +405,16 @@
business_date
:
moment
().
format
(
"YYYY-MM-DD"
),
business_date
:
moment
().
format
(
"YYYY-MM-DD"
),
abstract
:
''
,
abstract
:
''
,
income
:
''
,
income
:
''
,
customer
:
''
,
expenditure
:
''
,
expenditure
:
''
,
user_name
:
this
.
user_name
,
user_name
:
this
.
user_name
,
user_id
:
this
.
user_id
,
user_id
:
this
.
user_id
,
machinery_type
:
''
machinery_type
:
''
}
}
]
]
this
.
select_value
=
''
this
.
select_value
=
''
this
.
machinery_type_value
=
''
this
.
machinery_type_value
=
''
this
.
customer_value
=
''
this
.
datePickerValue
=
''
this
.
datePickerValue
=
''
this
.
getDataList
()
this
.
getDataList
()
}
else
{
}
else
{
...
@@ -462,6 +481,9 @@
...
@@ -462,6 +481,9 @@
.el-date-editor.el-input
{
.el-date-editor.el-input
{
width
:
140px
;
width
:
140px
;
}
}
.margin_sty
{
margin
:
0
10px
;
}
</style>
</style>
</html>
</html>
\ No newline at end of file
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