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
feae40d8
Commit
feae40d8
authored
Jan 11, 2025
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 修改需求
parent
9369d724
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
1 deletions
+64
-1
sdddl_project/models/__init__.py
+1
-1
sdddl_project/models/inherit_production_task.py
+35
-0
sdddl_project/models/inherit_roke_routing.py
+16
-0
sdddl_project/views/inherit_roke_production_task.xml
+12
-0
No files found.
sdddl_project/models/__init__.py
View file @
feae40d8
from
.
import
inherit_roke_work_order
from
.
import
inherit_production_task
from
.
import
inherit_roke_routing
_line
from
.
import
inherit_roke_routing
from
.
import
inherit_roke_product
sdddl_project/models/inherit_production_task.py
View file @
feae40d8
...
...
@@ -11,16 +11,51 @@ from odoo.exceptions import ValidationError
class
InheritProductionTask
(
models
.
Model
):
_inherit
=
"roke.production.task"
_order
=
"main_task_code desc, id"
file_ids
=
fields
.
Many2many
(
"ir.attachment"
,
"roke_production_task_ir_attachment"
,
"pro_id"
,
"att_id"
)
work_order_hours
=
fields
.
Float
(
string
=
"总报工时"
,
compute
=
"_compute_work_order_hours"
)
task_type
=
fields
.
Selection
([
(
'main'
,
'主任务'
),
(
'sub'
,
'子任务'
),
(
'repair'
,
'返修任务'
),
(
'replenish'
,
'补件任务'
)
],
string
=
'任务类型'
,
compute
=
'_compute_task_type'
,
store
=
True
)
main_task_code
=
fields
.
Char
(
string
=
'主任务编号'
,
compute
=
'_compute_main_task_code'
,
store
=
True
,
index
=
True
)
@api.depends
(
'work_order_ids'
)
def
_compute_work_order_hours
(
self
):
for
record
in
self
:
record
.
work_order_hours
=
sum
(
record
.
work_order_ids
.
mapped
(
"work_hours"
))
@api.depends
(
'parent_id'
,
'type'
)
def
_compute_task_type
(
self
):
for
record
in
self
:
if
record
.
type
==
'返修'
:
record
.
task_type
=
'repair'
elif
record
.
type
==
'补件'
:
record
.
task_type
=
'replenish'
elif
record
.
parent_id
:
record
.
task_type
=
'sub'
else
:
record
.
task_type
=
'main'
@api.depends
(
'task_type'
,
'code'
,
'parent_id'
)
def
_compute_main_task_code
(
self
):
for
record
in
self
:
# 对于子任务、返修任务和补件任务,获取主任务的编号
if
record
.
type
==
"返修"
:
record
.
main_task_code
=
record
.
repair_order_id
.
wr_id
.
work_order_id
.
task_id
.
code
elif
record
.
type
==
'补件'
:
record
.
main_task_code
=
record
.
scrap_order_id
.
wr_id
.
work_order_id
.
task_id
.
code
elif
record
.
parent_id
:
record
.
main_task_code
=
record
.
parent_id
.
code
else
:
record
.
main_task_code
=
record
.
code
def
write
(
self
,
vals
):
res
=
super
(
InheritProductionTask
,
self
)
.
write
(
vals
)
if
vals
.
get
(
'file_ids'
):
...
...
sdddl_project/models/inherit_roke_routing
_line
.py
→
sdddl_project/models/inherit_roke_routing.py
View file @
feae40d8
...
...
@@ -8,6 +8,22 @@ class InheritRokeRoutingLine(models.Model):
special_process
=
fields
.
Selection
([(
'是'
,
'是'
),
(
'否'
,
'否'
)],
string
=
"特殊工序"
,
default
=
'否'
)
class
InheritRokeRouting
(
models
.
Model
):
_inherit
=
"roke.routing"
def
get_routing_line_value
(
self
,
line
):
"""
获取工艺明细内容
:param process:
:return:
"""
res
=
super
(
InheritRokeRouting
,
self
)
.
get_routing_line_value
(
line
)
res
.
update
({
"special_process"
:
line
.
special_process
})
return
res
class
InheritRokeProcess
(
models
.
Model
):
_inherit
=
"roke.process"
...
...
sdddl_project/views/inherit_roke_production_task.xml
View file @
feae40d8
...
...
@@ -17,4 +17,16 @@
</xpath>
</field>
</record>
<record
id=
"inherit_view_roke_production_task_tree"
model=
"ir.ui.view"
>
<field
name=
"name"
>
inherit.roke.production.tree.view
</field>
<field
name=
"model"
>
roke.production.task
</field>
<field
name=
"inherit_id"
ref=
"roke_mes_production.view_roke_production_task_tree"
/>
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//field[@name='routing_id']"
position=
"after"
>
<field
name=
"task_type"
/>
<field
name=
"main_task_code"
invisible=
"1"
/>
</xpath>
</field>
</record>
</odoo>
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