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
9c9e4ec3
Commit
9c9e4ec3
authored
Nov 22, 2024
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 修改问题
parent
4e0f7224
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
2 deletions
+66
-2
jzjx_project/models/inheirt_roke_repair_order.py
+1
-1
jzjx_project/models/inherit_production_task.py
+46
-1
jzjx_project/models/inherit_roke_routing.py
+13
-0
jzjx_project/views/inherit_repair_view.xml
+3
-0
jzjx_project/wizard/inherit_roke_create_work_record_wizard.py
+3
-0
No files found.
jzjx_project/models/inheirt_roke_repair_order.py
View file @
9c9e4ec3
...
...
@@ -16,4 +16,4 @@ class JzjxInheritRepairOrderLine(models.Model):
repair_work_order_id
=
fields
.
Many2one
(
"roke.work.order"
,
string
=
"返修工单"
)
is_refix_auto_work_order
=
fields
.
Boolean
(
string
=
"是否自动生产返修单"
)
reason
_id
=
fields
.
Many2one
(
"roke.scrap.reason"
,
string
=
"报废原因"
,
ondelete
=
'restrict'
)
scrap
_id
=
fields
.
Many2one
(
"roke.scrap.reason"
,
string
=
"报废原因"
,
ondelete
=
'restrict'
)
jzjx_project/models/inherit_production_task.py
View file @
9c9e4ec3
...
...
@@ -3,6 +3,8 @@ import http.client
import
mimetypes
import
math
from
codecs
import
encode
from
datetime
import
timedelta
from
odoo
import
models
,
fields
,
api
,
_
from
odoo.exceptions
import
ValidationError
...
...
@@ -51,6 +53,44 @@ class InheritProductionTask(models.Model):
def
_onchange_routing_id
(
self
):
return
super
(
InheritProductionTask
,
self
)
.
_onchange_routing_id
()
def
change_routing_id_work_order
(
self
):
routing
=
self
.
routing_id
product
=
self
.
product_id
plan_qty
=
self
.
plan_qty
task_type
=
self
.
type
routing_lines
=
self
.
get_create_wo_routing_lines
(
routing
)
work_orders
=
[(
5
,
0
,
0
)]
date_num
=
(
self
.
plan_date
-
self
.
plan_start_date
)
.
days
work_order_num
=
len
(
routing_lines
)
if
date_num
==
0
:
for
routing_line
in
routing_lines
:
date
=
self
.
plan_start_date
work_order_data
=
self
.
_get_new_work_order_data
(
routing_line
,
product
,
plan_qty
,
task_type
)
work_order_data
[
'planned_start_time'
]
=
date
work_order_data
[
'plan_date'
]
=
date
work_orders
.
append
(
(
0
,
0
,
work_order_data
))
else
:
num
=
work_order_num
//
date_num
if
num
<
1
:
num
=
1
day
=
0
circulation_num
=
1
for
routing_line
in
routing_lines
:
date
=
self
.
plan_start_date
+
timedelta
(
days
=
day
)
if
circulation_num
==
num
:
circulation_num
=
1
if
day
+
1
<=
date_num
:
day
+=
1
else
:
circulation_num
+=
1
work_order_data
=
self
.
_get_new_work_order_data
(
routing_line
,
product
,
plan_qty
,
task_type
)
work_order_data
[
'planned_start_time'
]
=
date
work_order_data
[
'plan_date'
]
=
date
work_orders
.
append
(
(
0
,
0
,
work_order_data
))
return
work_orders
def
_create_work_order_get_values
(
self
,
task
,
routing_line
):
"""
任务生成工单获取工单数据
...
...
@@ -106,6 +146,9 @@ class InheritProductionTask(models.Model):
self
.
write
({
"routing_id"
:
routing_id
.
id
,
})
self
.
write
({
"work_order_ids"
:
self
.
change_routing_id_work_order
()
})
elif
not
self
.
routing_id
.
routing_task_id
or
self
.
routing_id
.
routing_task_id
.
id
!=
self
.
id
:
routing_id
=
self
.
routing_id
.
copy
()
routing_id
.
update
({
...
...
@@ -113,7 +156,9 @@ class InheritProductionTask(models.Model):
"routing_task_id"
:
self
.
id
})
self
.
write
({
"routing_id"
:
routing_id
.
id
})
self
.
_onchange_routing_id
()
self
.
write
({
"work_order_ids"
:
self
.
change_routing_id_work_order
()
})
else
:
routing_id
=
self
.
routing_id
return
{
...
...
jzjx_project/models/inherit_roke_routing.py
View file @
9c9e4ec3
...
...
@@ -58,3 +58,16 @@ class InheritRokeRoutingModel(models.Model):
"sequence"
:
standard_item
.
sequence
,
})
return
res
class
InheritRokeRoutingLineModel
(
models
.
Model
):
_inherit
=
"roke.routing.line"
def
write
(
self
,
vals
):
res
=
super
(
InheritRokeRoutingLineModel
,
self
)
.
write
(
vals
)
for
v
in
self
:
if
v
.
routing_id
.
routing_task_id
:
v
.
routing_id
.
routing_task_id
.
write
({
"work_order_ids"
:
v
.
routing_id
.
routing_task_id
.
change_routing_id_work_order
()
})
return
res
jzjx_project/views/inherit_repair_view.xml
View file @
9c9e4ec3
...
...
@@ -7,6 +7,7 @@
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//field[@name='line_ids']/tree//field[@name='wr_id']"
position=
"after"
>
<field
name=
"repair_work_order_id"
options=
"{'no_create': True}"
/>
<field
name=
"scrap_id"
options=
"{'no_create': True}"
/>
</xpath>
<xpath
expr=
"//field[@name='line_ids']/tree//button[@name='execute_repair']"
position=
"replace"
>
<field
name=
"is_refix_auto_work_order"
invisible=
"1"
/>
...
...
@@ -29,6 +30,7 @@
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//field[@name='product_id']"
position=
"after"
>
<field
name=
"repair_work_order_id"
options=
"{'no_create': True}"
/>
<field
name=
"scrap_id"
options=
"{'no_create': True}"
/>
</xpath>
<xpath
expr=
"//button[@name='execute_repair']"
position=
"replace"
>
<field
name=
"is_refix_auto_work_order"
invisible=
"1"
/>
...
...
@@ -44,6 +46,7 @@
<field
name=
"inherit_id"
ref=
"roke_mes_quality.view_roke_repair_order_line_tree"
/>
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//button[@name='execute_repair']"
position=
"replace"
>
<field
name=
"scrap_id"
/>
<field
name=
"is_refix_auto_work_order"
invisible=
"1"
/>
<button
name=
"execute_repair"
type=
"object"
string=
"执行返修"
class=
"oe_highlight"
attrs=
"{'invisible': ['|', ('allow_qty', '<=', 0), ('is_refix_auto_work_order', '=', True)]}"
/>
...
...
jzjx_project/wizard/inherit_roke_create_work_record_wizard.py
View file @
9c9e4ec3
...
...
@@ -49,7 +49,10 @@ class InheritRokeCreateWorkRecordWizard(models.TransientModel):
"repair_line_id"
:
v
.
id
,
"type"
:
"返修"
})
scrap_id
=
self
.
scrap_detail_ids
.
reason_id
.
ids
[
0
]
if
self
.
scrap_detail_ids
and
\
self
.
scrap_detail_ids
.
reason_id
else
False
data
=
{
"scrap_id"
:
scrap_id
,
"repair_work_order_id"
:
repair_work_order_id
,
"is_refix_auto_work_order"
:
refix_params
==
"True"
or
refix_params
is
True
}
...
...
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