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
5147cc98
Commit
5147cc98
authored
Jan 13, 2025
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 修改后台委外发料数据
parent
2172067b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
1 deletions
+52
-1
sdddl_project/models/inherit_roke_work_order.py
+52
-1
No files found.
sdddl_project/models/inherit_roke_work_order.py
View file @
5147cc98
from
odoo
import
models
,
fields
,
api
,
_
from
odoo.exceptions
import
ValidationError
from
odoo.exceptions
import
ValidationError
,
UserError
class
InheritWorkOrder
(
models
.
Model
):
...
...
@@ -58,3 +58,54 @@ class InheritWorkOrder(models.Model):
else
:
allow_qty
,
default_qty
=
super
(
InheritWorkOrder
,
self
)
.
_get_wo_allow_qty
()
return
allow_qty
,
default_qty
def
_get_bom_transportation_line_vals
(
self
,
record
,
bom
):
"""
获取BOM发料内容
:return:
"""
return
{
'product_index'
:
record
.
product_id
.
id
,
'partner_id'
:
record
.
entrust_customer
.
id
,
'product_id'
:
bom
.
product_id
.
id
,
"qty"
:
bom
.
qty
*
record
.
entrust_qty
,
'wo_id'
:
record
.
id
,
'origin_work_id'
:
record
.
id
}
def
confirm_transportation_material
(
self
):
product_list
=
[]
# 检验工单是否符合发料条件
for
i
in
self
:
# 检查自由报工
if
i
.
env
.
user
.
company_id
.
freedom_work
!=
"允许"
:
i
.
_check_freedom_work
(
i
.
finish_qty
)
if
not
i
.
entrust_customer
:
raise
UserError
(
'请选择委外客户!'
)
if
i
.
entrust_state
==
'已发料'
:
raise
UserError
(
'存在已发料的委外工单,请重新选择!'
)
# 检测是否含有委外出库的调拨类型
type_id
=
self
.
env
[
'roke.mes.stock.picking.type'
]
.
search
([(
'index'
,
'='
,
'WW/OUT/'
)],
limit
=
1
)
if
not
type_id
:
raise
UserError
(
'请前往仓库管理->作业类型,配置标识为 WW/OUT/ 的出库类型的委外出库!'
)
# 数据创建展示
for
record
in
self
:
for
bom
in
record
.
routing_line_id
.
p_bom_ids
:
product_list
.
append
((
0
,
0
,
self
.
_get_bom_transportation_line_vals
(
record
,
bom
)))
res
=
self
.
env
[
"transportation.product.info.wizard"
]
.
create
({
"picking_type_id"
:
type_id
.
id
,
"src_location_id"
:
type_id
.
src_location_id
.
id
,
"dest_location_id"
:
type_id
.
dest_location_id
.
id
,
"entrust_ids"
:
self
.
ids
,
"move_line_ids"
:
product_list
})
return
{
'name'
:
'发料'
,
'type'
:
'ir.actions.act_window'
,
'res_model'
:
'transportation.product.info.wizard'
,
'view_type'
:
'form'
,
'view_mode'
:
'form'
,
'target'
:
'new'
,
'res_id'
:
res
.
id
,
'context'
:
{}
}
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