Compare commits

...

73 Commits

Author SHA1 Message Date
liaodanlong
284234adf2 合并代码部分还原 2025-01-08 13:37:48 +08:00
liaodanlong
3ba79d88b5 修改错误提示 2025-01-08 11:36:28 +08:00
liaodanlong
c5755c318c Merge branch 'refs/heads/release/release_2.7' into feature/part_number
# Conflicts:
#	sf_manufacturing/models/mrp_workorder.py
2025-01-08 11:26:16 +08:00
liaodanlong
dcaca89c6f 外协工单关联采购单数量计算 2025-01-08 10:47:31 +08:00
liaodanlong
5774f241a0 外协工艺合并采购单处理 2025-01-08 09:36:38 +08:00
liaodanlong
ad02cbf8cb sf-制造订单-工单添加外协工序,制造订单状态变成已完成,销售订单的收货中没有该产品的调拨 2025-01-07 13:40:17 +08:00
liaodanlong
196b427867 状态计算 2025-01-06 13:39:21 +08:00
liaodanlong
b6f3382e5d 状态计算 2025-01-06 13:34:57 +08:00
liaodanlong
f2ee382205 状态计算 2025-01-06 13:33:02 +08:00
liaodanlong
081880b4bb 状态计算 2025-01-06 13:20:10 +08:00
yuxianghui
bc475441a2 1、去除工单开始按钮的二次确认;2、优化托盘入库后夹具物料查询中的状态还是未入库的问题 2025-01-06 13:11:22 +08:00
liaodanlong
a7c3a604a6 Merge remote-tracking branch 'origin/release/release_2.7' into release/release_2.7 2025-01-06 13:03:30 +08:00
liaodanlong
0bd65b5da8 状态计算 2025-01-06 13:03:15 +08:00
liaodanlong
79d561ba68 状态计算 2025-01-06 13:01:58 +08:00
guanhuan
63d9b4bf39 Merge branch 'refs/heads/develop' into release/release_2.7 2025-01-06 12:51:14 +08:00
管欢
2619953be1 Accept Merge Request #1710: (feature/消息提醒优化 -> develop)
Merge Request: 修复销售单号和追溯参考为空问题

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1710
2025-01-06 12:49:14 +08:00
liaodanlong
6e46d1d8dc Merge branch 'refs/heads/release/release_2.7' into feature/part_number 2025-01-06 11:20:44 +08:00
liaodanlong
403e64a957 表面工艺外协关联采购单查询条件修改 2025-01-06 11:09:22 +08:00
mgw
aaded331cd 解除装夹方法增加前置判断 2025-01-06 10:11:44 +08:00
liaodanlong
5d2ddfb510 Merge branch 'refs/heads/develop' into feature/part_number 2025-01-06 08:46:19 +08:00
mgw
f68453a0c6 Merge branch 'release/release_2.7' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into release/release_2.7 2025-01-03 15:26:20 +08:00
mgw
5cff411aaf r环境审批问题 2025-01-03 15:25:47 +08:00
guanhuan
ef5a3decd4 Merge remote-tracking branch 'origin/release/release_2.7' into release/release_2.7 2025-01-03 15:17:26 +08:00
guanhuan
ce1860b283 Merge branch 'refs/heads/develop' into release/release_2.7 2025-01-03 15:16:57 +08:00
mgw
b3f56754cd 修改翻译 2025-01-03 15:09:03 +08:00
管欢
202db10cea Accept Merge Request #1709: (feature/消息提醒优化 -> develop)
Merge Request: 工序外协发料通知跳转

Created By: @管欢
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1709
2025-01-03 15:06:29 +08:00
guanhuan
1cac579a1f Merge remote-tracking branch 'origin/develop' into release/release_2.7 2025-01-03 12:59:19 +08:00
管欢
53ca78a6a3 Accept Merge Request #1708: (feature/消息提醒优化 -> develop)
Merge Request: 外购订单采购单提醒

Created By: @管欢
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1708
2025-01-03 12:54:37 +08:00
mgw
0d28df0415 适配多层审批 2025-01-03 12:52:27 +08:00
马广威
7789c901b2 Accept Merge Request #1707: (feature/制造功能优化 -> develop)
Merge Request: 调整状态字段名称

Created By: @马广威
Accepted By: @马广威
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1707?initial=true
2025-01-03 11:43:55 +08:00
mgw
aa4b73e406 调整状态字段名称 2025-01-03 11:43:27 +08:00
马广威
1ca8ebe3cc Accept Merge Request #1706: (feature/制造功能优化 -> develop)
Merge Request: Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化

Created By: @马广威
Accepted By: @马广威
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1706?initial=true
2025-01-03 11:33:28 +08:00
mgw
c34cdd595d Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化 2025-01-03 11:32:48 +08:00
mgw
1936b512c2 调整多层审批需求 2025-01-03 11:32:24 +08:00
胡尧
3c470093d3 Merge branch 'develop' into release/release_2.7 2025-01-03 10:24:24 +08:00
管欢
b483097907 Accept Merge Request #1705: (feature/消息提醒优化 -> develop)
Merge Request: 待质检提醒

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1705?initial=true
2025-01-03 10:21:33 +08:00
胡尧
170309b3c0 修改依赖 2025-01-03 10:01:52 +08:00
liaodanlong
58acdc4913 工艺确认重置表面工艺工单的关联采购单代码还原 2025-01-02 16:38:26 +08:00
管欢
d4537fe73d Accept Merge Request #1704: (feature/消息提醒优化 -> develop)
Merge Request: 待质检提醒

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1704
2025-01-02 14:24:53 +08:00
廖丹龙
5f3957864a Accept Merge Request #1703: (feature/part_number -> develop)
Merge Request: 工艺确认重置表面工艺工单的关联采购单为草稿

Created By: @廖丹龙
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @廖丹龙
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1703
2025-01-02 13:43:03 +08:00
liaodanlong
f884963abc 工艺确认重置表面工艺工单的关联采购单为草稿 2025-01-02 13:34:09 +08:00
廖丹龙
1e17ac07a9 Accept Merge Request #1702: (feature/part_number -> develop)
Merge Request: 表面工艺采购单确认订单限制,自动化产线加工路线逻辑矫正

Created By: @廖丹龙
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @廖丹龙
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1702
2025-01-02 12:52:02 +08:00
liaodanlong
2f3e12e3af 表面工艺采购单确认订单限制,自动化产线加工路线逻辑矫正 2025-01-02 12:50:39 +08:00
liaodanlong
0ce51a4a66 添加人工线下加工工单排序 2025-01-02 12:49:46 +08:00
liaodanlong
a1bf997d51 采购岗与采购总监岗位添加工单操作权限 2025-01-02 12:49:05 +08:00
马广威
e6c125cae6 Accept Merge Request #1701: (feature/制造功能优化 -> develop)
Merge Request: Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化

Created By: @马广威
Accepted By: @马广威
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1701?initial=true
2025-01-02 11:34:28 +08:00
mgw
ac968b0d6e Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化 2025-01-02 10:59:27 +08:00
mgw
81bebf836d sf-采购-询价单状态流转多余按钮影响现有按钮功能 2025-01-02 10:59:03 +08:00
黄焱
d47d3f1638 Accept Merge Request #1700: (feature/前端样式修改 -> develop)
Merge Request: 解开屏蔽的方法

Created By: @黄焱
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @黄焱
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1700?initial=true
2025-01-02 10:31:33 +08:00
hy
614447d56e 解开屏蔽的方法 2025-01-02 10:28:40 +08:00
廖丹龙
bf13edc1be Accept Merge Request #1699: (feature/part_number -> develop)
Merge Request: 表面工艺采购单确认订单进行限制

Created By: @廖丹龙
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @廖丹龙
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1699
2025-01-02 09:08:27 +08:00
liaodanlong
e99b8692ea Merge branch 'refs/heads/develop' into feature/part_number 2025-01-02 09:06:41 +08:00
liaodanlong
701decb38f 表面工艺采购单确认订单进行限制 2024-12-31 17:08:38 +08:00
管欢
3c61726fd3 Accept Merge Request #1698: (feature/消息提醒优化 -> develop)
Merge Request: 询价单审批

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1698?initial=true
2024-12-31 16:42:34 +08:00
胡尧
c3ceda2ba9 Accept Merge Request #1697: (feature/sale_order_route_pick -> develop)
Merge Request: 特殊表面工艺外协采购单发起人修改为供应商的采购员

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1697?initial=true
2024-12-31 16:01:03 +08:00
胡尧
281f3c67c3 特殊表面工艺外协采购单发起人修改为供应商的采购员 2024-12-31 16:00:24 +08:00
禹翔辉
641a669f46 Accept Merge Request #1696: (feature/关闭报废入口 -> develop)
Merge Request: 关闭报废入口

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1696
2024-12-31 15:53:53 +08:00
yuxianghui
94b1c7d258 关闭报废入口 2024-12-31 15:50:51 +08:00
廖丹龙
b06b690ae9 Accept Merge Request #1695: (feature/part_number -> develop)
Merge Request: 回退代码

Created By: @廖丹龙
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @廖丹龙
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1695
2024-12-31 14:05:55 +08:00
liaodanlong
37476bcc88 回退代码 2024-12-31 14:03:15 +08:00
管欢
af7eeb55f1 Accept Merge Request #1694: (feature/消息提醒优化 -> develop)
Merge Request: 修复成品调拨出库订单的状态没变

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1694
2024-12-31 13:32:34 +08:00
廖丹龙
79ec60bd6b Accept Merge Request #1693: (feature/part_number -> develop)
Merge Request: sf-制造-外协工单-调拨单已取消问题

Created By: @廖丹龙
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @廖丹龙
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1693
2024-12-31 12:55:17 +08:00
liaodanlong
4b7308fdcd sf-制造-外协工单-调拨单已取消问题 2024-12-31 12:54:16 +08:00
胡尧
198f1145d7 Accept Merge Request #1692: (feature/sale_order_route_pick -> develop)
Merge Request: 修改退回工艺设计后再确认,采购单编程草稿状态

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1692?initial=true
2024-12-31 11:40:03 +08:00
胡尧
64eb66c334 修改退回工艺设计后再确认,采购单编程草稿状态 2024-12-31 11:39:36 +08:00
禹翔辉
cff21a4bcc Accept Merge Request #1691: (feature/采购单链接销售单 -> develop)
Merge Request: 采购单源单据为入库单时,自动计算对应参考销售订单的值

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1691?initial=true
2024-12-31 11:35:30 +08:00
yuxianghui
2373f33315 采购单源单据为入库单时,自动计算对应参考销售订单的值 2024-12-31 11:34:21 +08:00
禹翔辉
d6e2e554a8 Accept Merge Request #1690: (feature/采购单链接销售单 -> develop)
Merge Request: 采购订单的关联销售订单字段从销售模块搬迁到制造模块,并新增一个many2many类型字段,且对字段的自动计算方法进行优化。

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1690
2024-12-31 10:58:54 +08:00
yuxianghui
6c45a0bf4a Merge branch 'feature/入库单优化' into feature/采购单链接销售单 2024-12-31 10:57:09 +08:00
yuxianghui
4902fc5d9a 1、采购订单的关联销售订单字段从销售模块搬迁到制造模块,并新增一个many2many类型字段,且对字段的自动计算方法进行优化。 2024-12-31 10:56:07 +08:00
黄焱
9e5dbc0104 Accept Merge Request #1688: (feature/前端样式修改 -> develop)
Merge Request: 修复表格对不齐问题

Created By: @黄焱
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @黄焱
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1688?initial=true
2024-12-31 10:00:18 +08:00
管欢
c57918736d Accept Merge Request #1689: (feature/消息提醒优化 -> develop)
Merge Request: 修复成品调拨出库订单的状态没变

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1689
2024-12-31 10:00:01 +08:00
hy
1816f1a497 修复表格对不齐问题 2024-12-31 09:45:56 +08:00
19 changed files with 180 additions and 326 deletions

View File

@@ -139,7 +139,7 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
owl.onMounted(() => { owl.onMounted(() => {
this.activeElement = this.uiService.activeElement; this.activeElement = this.uiService.activeElement;
this.setRequired() this.setRequired()
// this.listherHeaderBodyNum() this.listherHeaderBodyNum()
}) })
return this._super(...arguments); return this._super(...arguments);
}, },
@@ -177,9 +177,10 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
const thead_th_num = thead_tr.children().length const thead_th_num = thead_tr.children().length
const tbody_tr_num = tbody_tr.children().length const tbody_tr_num = tbody_tr.children().length
const num = thead_th_num - tbody_tr_num const num = thead_th_num - tbody_tr_num
console.log('num', num);
if(num == -1) { if(num == -1) {
thead_tr.prepend('<td>序号</td>') tbody.children('tr').each(function () {
$(this).children('td').eq(0).remove()
})
} }
} catch (e) { } catch (e) {

View File

@@ -20,7 +20,7 @@
'version': '0.1', 'version': '0.1',
# any module necessary for this one to work correctly # any module necessary for this one to work correctly
'depends': ['purchase', 'base_tier_validation', 'documents', 'purchase_request', 'account'], 'depends': ['purchase', 'purchase_tier_validation', 'documents', 'purchase_request', 'account', 'purchase_order_approved'],
# always loaded # always loaded
'data': [ 'data': [

View File

@@ -23,6 +23,10 @@ class jikimo_purchase_tier_validation(models.Model):
for record in self: for record in self:
if record.need_validation and record.validation_status != 'validated': if record.need_validation and record.validation_status != 'validated':
raise ValidationError(_('此操作需要至少对一条记录进行审批。\n请发起审批申请。')) raise ValidationError(_('此操作需要至少对一条记录进行审批。\n请发起审批申请。'))
if record.state in ['to approve']:
raise ValidationError(_('请先完成审批。'))
if record.state == 'approved':
record.state = 'purchase'
return super().button_confirm() return super().button_confirm()
# def button_confirm(self): # def button_confirm(self):
@@ -83,7 +87,17 @@ class jikimo_purchase_tier_validation(models.Model):
def _validate_tier(self, tiers=False): def _validate_tier(self, tiers=False):
res = super(jikimo_purchase_tier_validation, self)._validate_tier(tiers) res = super(jikimo_purchase_tier_validation, self)._validate_tier(tiers)
self.state = 'approved' tier_reviews = tiers or self.review_ids
# 检查是否所有审批都已通过
all_approved = all(
tier_review.status == 'approved'
for tier_review in tier_reviews
)
if all_approved and tier_reviews: # 确保有审批记录
self.state = 'approved'
return res return res
def _rejected_tier(self, tiers=False): def _rejected_tier(self, tiers=False):

View File

@@ -1,11 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<odoo> <odoo>
<data> <data>
<record model="ir.ui.view" id="tier_validation_view_approved_purchase_order_form_inherit">
<field name="name">tier_validation_view_approved_purchase_order_form_inherit</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase_order_approved.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='button_release']" position="replace">
</xpath>
</field>
</record>
<record model="ir.ui.view" id="tier_validation_view_purchase_order_form_inherit"> <record model="ir.ui.view" id="tier_validation_view_purchase_order_form_inherit">
<field name="name">tier_validation_view_purchase_order_form_inherit</field> <field name="name">tier_validation_view_purchase_order_form_inherit</field>
<field name="model">purchase.order</field> <field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/> <field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//header/button[@name='button_approve']" position="replace">
</xpath>
<xpath expr="//header/button[@name='button_cancel']" position="replace"> <xpath expr="//header/button[@name='button_cancel']" position="replace">
</xpath> </xpath>
<xpath expr="//header/field[@name='state']" position="replace"> <xpath expr="//header/field[@name='state']" position="replace">

View File

@@ -1 +1,2 @@
from . import upload_file_wizard from . import upload_file_wizard
from . import comment_wizard

View File

@@ -0,0 +1,15 @@
from odoo import models, fields
class CommentWizard(models.TransientModel):
_inherit = "comment.wizard"
def add_comment(self):
rec = self.env[self.res_model].browse(self.res_id)
self.review_ids = rec.review_ids
result = super(CommentWizard, self).add_comment()
return result

View File

@@ -459,7 +459,7 @@ class MrpProduction(models.Model):
process_parameters.append(special.process_parameters_id.display_name) process_parameters.append(special.process_parameters_id.display_name)
if account_moves: if account_moves:
raise UserError(_("请联系工厂生产经理对采购订单%s生成的账单进行取消", ", ".join(account_moves))) raise UserError(_("请联系工厂生产经理对会计凭证%s生成的账单进行取消", ", ".join([move.name for move in account_moves])))
if parameters_not: if parameters_not:
raise UserError(_("【工艺设计】-【工序】为%s未选择参数,请选择", ", ".join(parameters_not))) raise UserError(_("【工艺设计】-【工序】为%s未选择参数,请选择", ", ".join(parameters_not)))
if process_parameters: if process_parameters:
@@ -802,46 +802,7 @@ class MrpProduction(models.Model):
workorder._get_surface_technics_purchase_ids().write({'state': 'cancel'}) workorder._get_surface_technics_purchase_ids().write({'state': 'cancel'})
workorder.move_subcontract_workorder_ids.write({'state': 'cancel'}) workorder.move_subcontract_workorder_ids.write({'state': 'cancel'})
workorder.move_subcontract_workorder_ids.picking_id.write({'state': 'cancel'}) workorder.move_subcontract_workorder_ids.picking_id.write({'state': 'cancel'})
consecutive_workorders = []
sorted_workorders = sorted(process_parameter_workorder, key=lambda w: w.sequence) sorted_workorders = sorted(process_parameter_workorder, key=lambda w: w.sequence)
# for i, workorder in enumerate(sorted_workorders):
# # 检查当前工作订单和下一个工作订单是否连续,并且供应商相同
# if i == 0:
# consecutive_workorders.append(workorder)
# elif workorder.sequence == sorted_workorders[
# i - 1].sequence + 1 and workorder.supplier_id.id == sorted_workorders[i - 1].supplier_id.id:
# consecutive_workorders.append(workorder)
# else:
# # 处理连续组,如果它不为空
# if consecutive_workorders:
# proc_workorders.append(consecutive_workorders)
# # 创建外协出入库单和采购订单
# # self.env['stock.picking'].create_outcontract_picking(consecutive_workorders, production, sorted_workorders)
# # self.env['purchase.order'].get_purchase_order(consecutive_workorders, production,
# # product_id_to_production_names)
# if i < len(sorted_workorders) - 1:
# # 重置连续组,并添加当前工作订单
# consecutive_workorders = [workorder]
# else:
# # 判断最后一笔:
# if workorder.sequence == sorted_workorders[
# i - 1].sequence and workorder.supplier_id.id == sorted_workorders[
# i - 1].supplier_id.id:
# consecutive_workorders = [workorder]
# else:
# proc_workorders.append([workorder])
# # 立即创建外协出入库单和采购订单
# # self.env['stock.picking'].create_outcontract_picking(workorder, production)
# # self.env['purchase.order'].get_purchase_order(workorder, production,
# # product_id_to_production_names)
# consecutive_workorders = []
#
# # 处理最后一个组,即使它可能只有一个工作订单
# if consecutive_workorders:
# proc_workorders.append(consecutive_workorders)
# self.env['stock.picking'].create_outcontract_picking(consecutive_workorders, production)
# self.env['purchase.order'].get_purchase_order(consecutive_workorders, production,
# product_id_to_production_names)
if not sorted_workorders: if not sorted_workorders:
return return
for workorders in reversed(sorted_workorders): for workorders in reversed(sorted_workorders):
@@ -980,6 +941,8 @@ class MrpProduction(models.Model):
and item.process_parameters_id == work.surface_technics_parameters_id) or and item.process_parameters_id == work.surface_technics_parameters_id) or
(item.route_id.name == work.name and item.panel (item.route_id.name == work.name and item.panel
and item.panel == work.processing_panel)) and item.panel == work.processing_panel))
if work.name == '人工线下加工':
td_ids = technology_design_ids.filtered(lambda item: (item.route_id.name in work.name))
if td_ids: if td_ids:
work.sequence = td_ids[0].sequence work.sequence = td_ids[0].sequence
cancel_work_ids = workorder_ids.filtered(lambda item: item.state in ('已取消', 'cancel')) cancel_work_ids = workorder_ids.filtered(lambda item: item.state in ('已取消', 'cancel'))

View File

@@ -17,6 +17,7 @@ from odoo.exceptions import UserError, ValidationError
from odoo.addons.sf_mrs_connect.models.ftp_operate import FtpController from odoo.addons.sf_mrs_connect.models.ftp_operate import FtpController
class ResMrpWorkOrder(models.Model): class ResMrpWorkOrder(models.Model):
_inherit = 'mrp.workorder' _inherit = 'mrp.workorder'
_order = 'sequence asc' _order = 'sequence asc'
@@ -129,7 +130,7 @@ class ResMrpWorkOrder(models.Model):
Y10_axis = fields.Float(default=0) Y10_axis = fields.Float(default=0)
Z10_axis = fields.Float(default=0) Z10_axis = fields.Float(default=0)
X_deviation_angle = fields.Integer(string="X轴偏差度", default=0) X_deviation_angle = fields.Integer(string="X轴偏差度", default=0)
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], default='合格', test_results = fields.Selection([("合格", "合格"), ("返工", "返工")], default='合格',
string="检测结果", tracking=True) string="检测结果", tracking=True)
cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工程序") cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工程序")
cmm_ids = fields.One2many("sf.cmm.program", 'workorder_id', string="CMM程序") cmm_ids = fields.One2many("sf.cmm.program", 'workorder_id', string="CMM程序")
@@ -274,31 +275,18 @@ class ResMrpWorkOrder(models.Model):
def _compute_surface_technics_purchase_ids(self): def _compute_surface_technics_purchase_ids(self):
for order in self: for order in self:
if order.routing_type == '表面工艺' and order.state not in ['cancel']: if order.routing_type == '表面工艺' and order.state not in ['cancel']:
# if order.production_id.production_type == '自动化产线加工': domain = [('purchase_type', '=', 'consignment'),
# domain = [('programming_no', '=', order.production_id.programming_no)] ('origin', 'like', '%' + self.production_id.name + '%'),
# else:buzhdiao
# domain = [('origin', '=', order.production_id.origin)]
# production_programming = self.env['mrp.production'].search(domain, order='name asc')
# production_list = [production.name for production in production_programming]
# production_no_remanufacture = production_programming.filtered(lambda a: a.is_remanufacture is False)
# technology_design = self.env['sf.technology.design'].search(
# [('process_parameters_id', '=', order.surface_technics_parameters_id.id),
# ('production_id', '=', order.production_id.id)])
# if technology_design.is_auto is False:
# domain = [('origin', '=', order.production_id.name)]
# else:
domain = [('purchase_type', '=', 'consignment'), ('origin', '=', order.production_id.name),
('state', '!=', 'cancel')] ('state', '!=', 'cancel')]
purchase = self.env['purchase.order'].search(domain) purchase = self.env['purchase.order'].search(domain)
purchase_num = 0 order.surface_technics_purchase_count = 0
if not purchase: if not purchase:
order.surface_technics_purchase_count = 0 order.surface_technics_purchase_count = 0
for po in purchase: for po in purchase:
for line in po.order_line: if any(
if line.product_id.server_product_process_parameters_id == order.surface_technics_parameters_id: line.product_id and line.product_id.server_product_process_parameters_id == order.surface_technics_parameters_id
if line.product_qty == 1: for line in po.order_line):
purchase_num += 1 order.surface_technics_purchase_count = 1
order.surface_technics_purchase_count = purchase_num
else: else:
order.surface_technics_purchase_count = 0 order.surface_technics_purchase_count = 0
@@ -330,7 +318,7 @@ class ResMrpWorkOrder(models.Model):
return result return result
def _get_surface_technics_purchase_ids(self): def _get_surface_technics_purchase_ids(self):
domain = [('origin', '=', self.production_id.name), ('purchase_type', '=', 'consignment')] domain = [('origin', 'like', '%' + self.production_id.name + '%'), ('purchase_type', '=', 'consignment')]
purchase_orders = self.env['purchase.order'].search(domain) purchase_orders = self.env['purchase.order'].search(domain)
purchase_orders_id = self.env['purchase.order'] purchase_orders_id = self.env['purchase.order']
for po in purchase_orders: for po in purchase_orders:
@@ -1035,49 +1023,6 @@ class ResMrpWorkOrder(models.Model):
'production_id.tool_state', 'production_id.schedule_state', 'sequence', 'production_id.tool_state', 'production_id.schedule_state', 'sequence',
'production_id.programming_state') 'production_id.programming_state')
def _compute_state(self): def _compute_state(self):
# super()._compute_state()
# for workorder in self:
# if workorder.sequence != 1:
# previous_workorder = self.env['mrp.workorder'].search(
# [('production_id', '=', workorder.production_id.id),
# ('sequence', '=', workorder.sequence - 1)])
# if workorder.state == 'pending':
# if all([wo.state in ('done', 'cancel') for wo in workorder.blocked_by_workorder_ids]):
# if workorder.production_id.reservation_state == 'assigned' and workorder.production_id.schedule_state == '已排':
# if ((workorder.sequence == 1 and not workorder.blocked_by_workorder_ids)
# or (workorder.blocked_by_workorder_ids.state in ('done', 'cancel')
# and workorder.blocked_by_workorder_ids.test_results not in ['报废', '返工'])
# or (previous_workorder.state in ('done', 'cancel')
# and not workorder.blocked_by_workorder_ids
# and previous_workorder.test_results not in ['报废', '返工'])
# ):
# workorder.state = 'ready'
# continue
# if workorder.production_id.schedule_state == '未排' and workorder.state in ('waiting', 'ready'):
# if workorder.sequence != 1:
# workorder.state = 'pending'
# continue
# if workorder.state not in ('waiting', 'ready'):
# continue
# if workorder.state in (
# 'waiting') and workorder.sequence == 1 and workorder.production_id.schedule_state == '已排':
# workorder.state = 'ready'
# continue
# if not all([wo.state in ('done', 'cancel') for wo in workorder.blocked_by_workorder_ids]):
# workorder.state = 'pending'
# if workorder.state in ['waiting']:
# if previous_workorder.state == 'waiting':
# workorder.state = 'pending'
# if workorder.sequence == 1 and workorder.state == 'pending':
# workorder.state = 'waiting'
# continue
# if workorder.production_id.reservation_state not in ('waiting', 'confirmed', 'assigned'):
# continue
# if workorder.production_id.reservation_state == 'assigned' and workorder.state == 'waiting' and workorder.production_id.schedule_state == '已排':
# workorder.state = 'ready'
# elif workorder.production_id.reservation_state != 'assigned' and workorder.state == 'ready':
# workorder.state = 'waiting'
for workorder in self: for workorder in self:
# 如果工单的工序没有进行排序则跳出循环 # 如果工单的工序没有进行排序则跳出循环
if workorder.production_id.workorder_ids.filtered(lambda wk: wk.sequence == 0): if workorder.production_id.workorder_ids.filtered(lambda wk: wk.sequence == 0):
@@ -1105,13 +1050,20 @@ class ResMrpWorkOrder(models.Model):
purchase_orders_id = self._get_surface_technics_purchase_ids() purchase_orders_id = self._get_surface_technics_purchase_ids()
if purchase_orders_id.state == 'purchase': if purchase_orders_id.state == 'purchase':
workorder.state = 'ready' workorder.state = 'ready'
move_out = workorder.move_subcontract_workorder_ids[1]
for mo in move_out:
if mo.state != 'done':
mo.write({'state': 'assigned', 'production_id': False})
if not mo.move_line_ids:
self.env['stock.move.line'].create(
mo.get_move_line(workorder.production_id, workorder))
continue continue
else: else:
workorder.state = 'waiting' workorder.state = 'waiting'
continue continue
else: else:
workorder.state = 'ready' workorder.state = 'ready'
continue continue
# ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]========================== # ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]==========================
if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework' if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework'
or workorder.production_id.schedule_state != '已排' or workorder.production_id.schedule_state != '已排'
@@ -1134,86 +1086,22 @@ class ResMrpWorkOrder(models.Model):
if workorder.is_subcontract is False: if workorder.is_subcontract is False:
workorder.state = 'ready' workorder.state = 'ready'
else: else:
# production_programming = self.env['mrp.production'].search( if len(workorder.production_id.picking_ids.filtered(
# [('origin', '=', self.production_id.origin)], order='name asc') lambda w: w.state not in ['done',
# production_no_remanufacture = production_programming.filtered( 'cancel'])) == 0 and workorder.production_id.programming_state == '已编程':
# lambda a: a.is_remanufacture is False) purchase_orders_id = self._get_surface_technics_purchase_ids()
# production_list = [production.name for production in production_programming] if purchase_orders_id:
# purchase_orders = self.env['purchase.order'].search( if purchase_orders_id.state == 'purchase':
# [('origin', 'ilike', ','.join(production_list))]) workorder.state = 'ready'
# for line in purchase_orders.order_line: move_out = workorder.move_subcontract_workorder_ids[1]
# if ( for mo in move_out:
# line.product_id.server_product_process_parameters_id == workorder.surface_technics_parameters_id if mo.state != 'done':
# and line.product_qty == len(production_no_remanufacture)): mo.write({'state': 'assigned', 'production_id': False})
# if all(pur_order.state == 'purchase' for pur_order in purchase_orders): if not mo.move_line_ids:
# workorder.state = 'ready' self.env['stock.move.line'].create(
# else: mo.get_move_line(workorder.production_id, workorder))
# workorder.state = 'waiting' else:
purchase_orders_id = self._get_surface_technics_purchase_ids() workorder.state = 'waiting'
if purchase_orders_id:
workorder.state = 'ready' if purchase_orders_id.state == 'purchase' else 'waiting'
else:
workorder.state = 'waiting'
# re_work = self.env['mrp.workorder'].search([('production_id', '=', workorder.production_id.id),
# ('processing_panel', '=', workorder.processing_panel),
# ('is_rework', '=', True), ('state', 'in', ['done', 'rework'])])
# cnc_workorder = self.env['mrp.workorder'].search(
# [('production_id', '=', workorder.production_id.id),
# ('processing_panel', '=', workorder.processing_panel),
# ('routing_type', '=', 'CNC加工'), ('state', 'in', ['done', 'rework']),
# ('test_results', '=', '返工')])
# cnc_workorder_pending = self.env['mrp.workorder'].search(
# [('production_id', '=', workorder.production_id.id),
# ('processing_panel', '=', workorder.processing_panel),
# ('routing_type', '=', 'CNC加工'), ('state', 'in', ['pending'])])
# unclamp_workorder = self.env['mrp.workorder'].search(
# [('production_id', '=', workorder.production_id.id),
# ('sequence', '=', workorder.sequence - 1),
# ('state', 'in', ['done'])])
# if workorder.state not in ['cancel', 'progress', 'rework']:
# if workorder.production_id.state == 'rework':
# if workorder.routing_type == '装夹预调':
# # # 有返工工单
# # if re_work:
# # 新工单
# if workorder.is_rework is False:
# if (workorder.production_id.programming_state == '已编程'
# and workorder.production_id.is_rework is False):
# if re_work or cnc_workorder:
# workorder.state = 'ready'
# else:
# if workorder.production_id.is_rework is True:
# if re_work or cnc_workorder:
# workorder.state = 'waiting'
#
# elif workorder.routing_type == 'CNC加工':
# pre_workorder = self.env['mrp.workorder'].search(
# [('production_id', '=', workorder.production_id.id),
# ('processing_panel', '=', workorder.processing_panel),
# ('routing_type', '=', '装夹预调'), ('state', '=', 'done')])
# if pre_workorder:
# if re_work:
# workorder.state = 'waiting'
# elif workorder.routing_type == '解除装夹':
# if cnc_workorder:
# if not cnc_workorder_pending or unclamp_workorder.test_results == '报废':
# workorder.state = 'waiting'
# # else:
# # if workorder.production_id.is_rework is True:
# # workorder.state = 'waiting'
# elif workorder.production_id.state == 'progress':
# if (workorder.routing_type == '装夹预调' and workorder.production_id.programming_state == '已编程'
# and workorder.is_rework is False and workorder.state not in ['done', 'rework', 'cancel']):
# if workorder.production_id.is_rework is False:
# if re_work or cnc_workorder or unclamp_workorder:
# workorder.state = 'ready'
# # if (re_work or cnc_workorder) and workorder.production_id.is_rework is False:
# # workorder.state = 'ready'
# elif workorder.production_id.state == 'scrap':
# if workorder.routing_type == '解除装夹' and unclamp_workorder.test_results == '报废':
# workorder.state = 'waiting'
# 重写工单开始按钮方法 # 重写工单开始按钮方法
def button_start(self): def button_start(self):
# 判断工单状态是否为等待组件 # 判断工单状态是否为等待组件
@@ -1396,7 +1284,7 @@ class ResMrpWorkOrder(models.Model):
raise UserError('请先完成该工单的工艺外协再进行操作') raise UserError('请先完成该工单的工艺外协再进行操作')
# 表面工艺外协,最后一张工单 # 表面工艺外协,最后一张工单
workorders = self.production_id.workorder_ids workorders = self.production_id.workorder_ids
subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True).sorted('sequence') subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True and wo.state != 'cancel').sorted('sequence')
if self == subcontract_workorders[-1]: if self == subcontract_workorders[-1]:
# 给下一个库存移动就绪 # 给下一个库存移动就绪
self.move_subcontract_workorder_ids[0].move_dest_ids._action_done() self.move_subcontract_workorder_ids[0].move_dest_ids._action_done()
@@ -1420,8 +1308,10 @@ class ResMrpWorkOrder(models.Model):
is_production_id = False is_production_id = False
rework_workorder = record.production_id.workorder_ids.filtered(lambda p: p.state == 'rework') rework_workorder = record.production_id.workorder_ids.filtered(lambda p: p.state == 'rework')
done_workorder = record.production_id.workorder_ids.filtered(lambda p1: p1.state in ['done']) done_workorder = record.production_id.workorder_ids.filtered(lambda p1: p1.state in ['done'])
if (len(rework_workorder) + len(done_workorder) == len(record.production_id.workorder_ids)) or ( if (len(rework_workorder) + len(done_workorder) == len(
len(done_workorder) == len(record.production_id.workorder_ids)): record.production_id.workorder_ids.filtered(lambda wo: wo.state != 'cancel'))) or (
len(done_workorder) == len(
record.production_id.workorder_ids.filtered(lambda wo: wo.state != 'cancel'))):
is_production_id = True is_production_id = True
if record.routing_type in ['解除装夹'] or ( if record.routing_type in ['解除装夹'] or (
record.is_rework is True and record.routing_type in ['装夹预调']): record.is_rework is True and record.routing_type in ['装夹预调']):

View File

@@ -10,10 +10,11 @@ from odoo.tools import OrderedSet
# _get_surface_technics_purchase_ids # _get_surface_technics_purchase_ids
class PurchaseOrder(models.Model): class PurchaseOrder(models.Model):
_inherit = 'purchase.order' _inherit = 'purchase.order'
production_count = fields.Integer( production_count = fields.Integer(
"关联制造订单", "关联制造订单",
compute='_compute_workorder_count', compute='_compute_workorder_count',
) )
def action_view_production(self): def action_view_production(self):
origins = [order.name for order in self.picking_ids] origins = [order.name for order in self.picking_ids]
@@ -37,34 +38,65 @@ class PurchaseOrder(models.Model):
}) })
return action return action
def _compute_workorder_count(self): def _compute_workorder_count(self):
for purchase in self: for purchase in self:
origins = [order.name for order in purchase.picking_ids] origins = [order.name for order in purchase.picking_ids]
production_id = self.env['mrp.production'].search([('origin', 'in', origins)]) production_id = self.env['mrp.production'].search([('origin', 'in', origins)])
purchase.production_count = len(production_id) purchase.production_count = len(production_id)
def button_confirm(self):
super().button_confirm() # def button_confirm(self):
workorders = self.env['mrp.workorder'].search([('purchase_id', '=', self.id),('state', '!=', 'cancel')]) # super().button_confirm()
for workorder in workorders: # workorders = self.env['mrp.workorder'].search([('purchase_id', '=', self.id), ('state', '!=', 'cancel')])
if workorder.routing_type == '表面工艺' and workorder.is_subcontract is True: # for workorder in workorders:
move_out = workorder.move_subcontract_workorder_ids[1] # if workorder.routing_type == '表面工艺' and workorder.is_subcontract is True:
# move_out = self.env['stock.move'].search( # move_out = workorder.move_subcontract_workorder_ids[1]
# [('location_id', '=', self.env['stock.location'].search( # for mo in move_out:
# [('barcode', 'ilike', 'WH-PREPRODUCTION')]).id), # if mo.state != 'done':
# ('location_dest_id', '=', self.env['stock.location'].search( # mo.write({'state': 'assigned', 'production_id': False})
# [('barcode', 'ilike', 'VL-SPOC')]).id), # if not mo.move_line_ids:
# ('origin', '=', self.production_id.name), ('state', 'not in', ['cancel', 'done'])]) # self.env['stock.move.line'].create(mo.get_move_line(workorder.production_id, workorder))
for mo in move_out: # return True
if mo.state != 'done':
mo.write({'state': 'assigned', 'production_id': False}) origin_sale_id = fields.Many2one('sale.order', string='销售订单号', store=True, compute='_compute_origin_sale_id')
if not mo.move_line_ids: origin_sale_ids = fields.Many2many('sale.order', string='销售订单号(多个)', store=True,
self.env['stock.move.line'].create(mo.get_move_line(workorder.production_id, workorder)) compute='_compute_origin_sale_id')
return True
@api.depends('origin')
def _compute_origin_sale_id(self):
for purchase in self:
if not purchase.origin:
continue
elif 'MO' in purchase.origin:
mp_name_list = [name.strip() for name in purchase['origin'].split(',')]
os_ids = list({mp_id.sale_order_id.id for mp_id in self.env['mrp.production'].sudo().search([
('name', 'in', mp_name_list)])})
if len(os_ids) == 1:
purchase.origin_sale_id = os_ids[0]
elif len(os_ids) >= 2:
purchase.origin_sale_ids = os_ids
elif 'S' in purchase.origin:
os_name_list = [name.strip() for name in purchase['origin'].split(',')]
os_ids = self.env['sale.order'].sudo().search([('name', 'in', os_name_list)])
if len(os_ids) == 1:
purchase.origin_sale_id = os_ids.id
elif len(os_ids) >= 2:
purchase.origin_sale_ids = os_ids.ids
elif 'IN' in purchase.origin:
sp_name_list = [name.strip() for name in purchase['origin'].split(',')]
os_ids = list({sp_id.sale_order_id.id for sp_id in self.env['stock.picking'].sudo().search([
('name', 'in', sp_name_list)])})
if len(os_ids) == 1:
purchase.origin_sale_id = os_ids[0]
elif len(os_ids) >= 2:
purchase.origin_sale_ids = os_ids
class PurchaseOrderLine(models.Model): class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line' _inherit = 'purchase.order.line'
part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True) part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True)
related_product = fields.Many2one('product.product',compute='_compute_related_product', string='关联产品',help='经此产品工艺加工成的成品') related_product = fields.Many2one('product.product', compute='_compute_related_product', string='关联产品',
help='经此产品工艺加工成的成品')
@api.depends('order_id.origin') @api.depends('order_id.origin')
def _compute_related_product(self): def _compute_related_product(self):
for record in self: for record in self:
@@ -73,4 +105,3 @@ class PurchaseOrderLine(models.Model):
record.related_product = production_id.product_id if production_id else False record.related_product = production_id.product_id if production_id else False
else: else:
record.related_product = False record.related_product = False

View File

@@ -637,7 +637,7 @@ class StockPicking(models.Model):
if move_in: if move_in:
workorder = move_in.subcontract_workorder_id workorder = move_in.subcontract_workorder_id
workorders = workorder.production_id.workorder_ids workorders = workorder.production_id.workorder_ids
subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True).sorted('sequence') subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True and wo.state!='cancel').sorted('sequence')
if workorder == subcontract_workorders[-1]: if workorder == subcontract_workorders[-1]:
self.env['stock.quant']._update_reserved_quantity( self.env['stock.quant']._update_reserved_quantity(
move_in.product_id, move_in.location_dest_id, move_in.product_uom_qty, move_in.product_id, move_in.location_dest_id, move_in.product_uom_qty,
@@ -687,7 +687,11 @@ class StockPicking(models.Model):
'sf_manufacturing.outcontract_picking_in').id, 'sf_manufacturing.outcontract_picking_in').id,
outcontract_picking_type_out = self.env.ref( outcontract_picking_type_out = self.env.ref(
'sf_manufacturing.outcontract_picking_out').id, 'sf_manufacturing.outcontract_picking_out').id,
moves_in = self.env['stock.move'].sudo().create( context = dict(self.env.context)
context.update({
'default_production_id': item.id, # 添加额外信息到 context 中
})
moves_in = self.env['stock.move'].sudo().with_context(context).create(
self.env['stock.move']._get_stock_move_values_Res(item, outcontract_picking_type_in, self.env['stock.move']._get_stock_move_values_Res(item, outcontract_picking_type_in,
procurement_group_id.id, move_dest_id)) procurement_group_id.id, move_dest_id))
picking_in = self.create( picking_in = self.create(
@@ -696,7 +700,8 @@ class StockPicking(models.Model):
moves_in.write( moves_in.write(
{'picking_id': picking_in.id, 'state': 'waiting'}) {'picking_id': picking_in.id, 'state': 'waiting'})
moves_in._assign_picking_post_process(new=new_picking) moves_in._assign_picking_post_process(new=new_picking)
moves_out = self.env['stock.move'].sudo().create( # self.env.context.get('default_production_id')
moves_out = self.env['stock.move'].sudo().with_context(context).create(
self.env['stock.move']._get_stock_move_values_Res(item, outcontract_picking_type_out, self.env['stock.move']._get_stock_move_values_Res(item, outcontract_picking_type_out,
procurement_group_id.id, moves_in.id)) procurement_group_id.id, moves_in.id))
workorder.write({'move_subcontract_workorder_ids': [(6, 0, [moves_in.id, moves_out.id])]}) workorder.write({'move_subcontract_workorder_ids': [(6, 0, [moves_in.id, moves_out.id])]})
@@ -773,6 +778,7 @@ class ReStockMove(models.Model):
'origin': item.name, 'origin': item.name,
'group_id': group_id, 'group_id': group_id,
'move_dest_ids': [(6, 0, [move_dest_ids])] if move_dest_ids else False, 'move_dest_ids': [(6, 0, [move_dest_ids])] if move_dest_ids else False,
# 'production_id': item.id,
# 'route_ids': False if not route else [(4, route.id)], # 'route_ids': False if not route else [(4, route.id)],
'date_deadline': datetime.now(), 'date_deadline': datetime.now(),
'picking_type_id': picking_type_id, 'picking_type_id': picking_type_id,

View File

@@ -183,4 +183,7 @@ access_sf_manual_product_model_type_routing_sort_manager,sf_manual_product_model
access_sf_manual_product_model_type_routing_sort_group_plan_dispatch,sf_manual_product_model_type_routing_sort_group_plan_dispatch,model_sf_manual_product_model_type_routing_sort,sf_base.group_plan_dispatch,1,0,0,0 access_sf_manual_product_model_type_routing_sort_group_plan_dispatch,sf_manual_product_model_type_routing_sort_group_plan_dispatch,model_sf_manual_product_model_type_routing_sort,sf_base.group_plan_dispatch,1,0,0,0
access_sf_detection_result_manager,sf_detection_result_manager,model_sf_detection_result,,1,1,1,1 access_sf_detection_result_manager,sf_detection_result_manager,model_sf_detection_result,,1,1,1,1
access_mrp_workorder_batch_replan_wizard_group_plan_dispatch,mrp_workorder_batch_replan_wizard_group_plan_dispatch,model_mrp_workorder_batch_replan_wizard,sf_base.group_plan_dispatch,1,1,1,0 access_mrp_workorder_batch_replan_wizard_group_plan_dispatch,mrp_workorder_batch_replan_wizard_group_plan_dispatch,model_mrp_workorder_batch_replan_wizard,sf_base.group_plan_dispatch,1,1,1,0
access_mrp_workorder_group_purchase_director,mrp_workorder,model_mrp_workorder,sf_base.group_purchase_director,1,1,0,0
access_mrp_workorder_group_purchase,mrp_workorder,model_mrp_workorder,sf_base.group_purchase,1,1,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
183
184
185
186
187
188
189

View File

@@ -22,6 +22,13 @@
</div> </div>
</button> </button>
</xpath> </xpath>
<!-- 添加销售订单号字段-->
<xpath expr="//sheet/group/group[2]/div[@name='date_approve']" position="after">
<field name="origin_sale_id" readonly="1" string="参考销售订单"
attrs="{'invisible': [('origin_sale_id' , '=', False)]}"/>
<field name="origin_sale_ids" readonly="1" string="参考销售订单" widget="many2many_tags"
attrs="{'invisible': [('origin_sale_ids' , '=', [])]}"/>
</xpath>
</field> </field>
</record> </record>
</data> </data>

View File

@@ -25,38 +25,6 @@ class ProductionTechnologyReAdjustWizard(models.TransientModel):
# 该制造订单的其他同一销售订单的制造订单的工艺设计处理 # 该制造订单的其他同一销售订单的制造订单的工艺设计处理
if production_item != self.production_id: if production_item != self.production_id:
self.env['sf.technology.design'].sudo().unified_procedure_multiple_work_orders(technology_designs, production_item) self.env['sf.technology.design'].sudo().unified_procedure_multiple_work_orders(technology_designs, production_item)
# for td_other in production_item.technology_design_ids:
# # if td_other.is_auto is False:
# # td_del = technology_designs.filtered(lambda tdo: tdo.route_id.id == td_other.route_id.id)
# # if not td_del or td_del.active is False:
# # td_other.write({'active': False})
# for td_main in technology_designs:
# route_other = production_item.technology_design_ids.filtered(
# lambda td: td.route_id.id == td_main.route_id.id)
# if not route_other and td_main.active is True:
# production_item.write({'technology_design_ids': [(0, 0, {
# 'route_id': td_main.route_id.id,
# 'process_parameters_id': False if td_main.process_parameters_id is False else
# self.env[
# 'sf.production.process.parameter'].search(
# [('id', '=', td_main.process_parameters_id.id)]).id,
# 'sequence': td_main.sequence,
# 'is_auto': td_main.is_auto})]})
# else:
# for ro in route_other:
# domain = [('production_id', '=', self.production_id.id),
# ('active', 'in', [True, False]),
# ('route_id', '=', ro.route_id.id)]
# if ro.route_id.routing_type == '表面工艺':
# domain += [('process_parameters_id', '=', ro.process_parameters_id.id)]
# elif ro.route_id.routing_tag == 'special' and ro.is_auto is False:
# # display_name = ro.route_id.display_name
# domain += [('id', '=', ro.id)]
# elif ro.panel is not False:
# domain += [('panel', '=', ro.panel)]
# td_upd = self.env['sf.technology.design'].sudo().search(domain)
# if td_upd:
# ro.write({'sequence': td_upd.sequence, 'active': td_upd.active})
special_design = self.env['sf.technology.design'].sudo().search( special_design = self.env['sf.technology.design'].sudo().search(
[('routing_tag', '=', 'special'), ('production_id', '=', production_item.id), [('routing_tag', '=', 'special'), ('production_id', '=', production_item.id),
('is_auto', '=', False), ('active', 'in', [True, False])]) ('is_auto', '=', False), ('active', 'in', [True, False])])
@@ -71,23 +39,6 @@ class ProductionTechnologyReAdjustWizard(models.TransientModel):
else: else:
domain += [('technology_design_id', '=', special.id), ('state', '!=', 'cancel')] domain += [('technology_design_id', '=', special.id), ('state', '!=', 'cancel')]
workorder = self.env['mrp.workorder'].search(domain) workorder = self.env['mrp.workorder'].search(domain)
# previous_workorder = self.env['mrp.workorder'].search(
# [('sequence', '=', workorder.sequence - 1), ('routing_type', '=', '表面工艺'),
# ('production_id', '=', workorder.production_id.id)])
# if previous_workorder:
# if previous_workorder.supplier_id != workorder.supplier_id:
# is_cancel = True
# else:
# is_cancel = True
# if workorder.state != 'cancel' and is_cancel is True:
# workorder.write({'state': 'cancel'})
# workorder.picking_ids.write({'state': 'cancel'})
# workorder.picking_ids.move_ids.write({'state': 'cancel'})
# purchase_order = self.env['purchase.order'].search(
# [('origin', '=', workorder.production_id.name)])
# for line in purchase_order.order_line:
# if line.product_id.server_product_process_parameters_id == workorder.surface_technics_parameters_id:
# purchase_order.write({'state': 'cancel'})
else: else:
workorder = self.env['mrp.workorder'].search( workorder = self.env['mrp.workorder'].search(
[('technology_design_id', '=', special.id), ('production_id', '=', special.production_id.id), ('state', '!=', 'cancel')]) [('technology_design_id', '=', special.id), ('production_id', '=', special.production_id.id), ('state', '!=', 'cancel')])

View File

@@ -27,36 +27,7 @@ class ProductionTechnologyWizard(models.TransientModel):
if production != self.production_id: if production != self.production_id:
self.env['sf.technology.design'].sudo().unified_procedure_multiple_work_orders(technology_designs, self.env['sf.technology.design'].sudo().unified_procedure_multiple_work_orders(technology_designs,
production) production)
# for td_other in production.technology_design_ids: # 特殊表面工艺
# if td_other.is_auto is False:
# td_del = technology_designs.filtered(lambda tdo: tdo.route_id.id == td_other.route_id.id)
# if not td_del or td_del.active is False:
# td_other.write({'active': False})
# for td_main in technology_designs:
# route_other = production.technology_design_ids.filtered(
# lambda td: td.route_id.id == td_main.route_id.id)
# if not route_other and td_main.active is True:
# production.write({'technology_design_ids': [(0, 0, {
# 'route_id': td_main.route_id.id,
# 'process_parameters_id': False if td_main.process_parameters_id is False else self.env[
# 'sf.production.process.parameter'].search(
# [('id', '=', td_main.process_parameters_id.id)]).id,
# 'sequence': td_main.sequence})]})
# else:
# for ro in route_other:
# domain = [('production_id', '=', self.production_id.id),
# ('active', 'in', [True, False]),
# ('route_id', '=', ro.route_id.id)]
# if ro.route_id.routing_type == '表面工艺':
# domain += [('process_parameters_id', '=', ro.process_parameters_id.id)]
# elif ro.route_id.routing_tag == 'special' and ro.is_auto is False:
# # display_name = ro.route_id.display_name
# domain += [('id', '=', ro.id)]
# elif ro.panel is not False:
# domain += [('panel', '=', ro.panel)]
# td_upd = self.env['sf.technology.design'].sudo().search(domain)
# if td_upd:
# ro.write({'sequence': td_upd.sequence, 'active': td_upd.active})
special_design = self.env['sf.technology.design'].sudo().search( special_design = self.env['sf.technology.design'].sudo().search(
[('routing_tag', '=', 'special'), ('production_id', '=', production.id), [('routing_tag', '=', 'special'), ('production_id', '=', production.id),
('is_auto', '=', False), ('active', 'in', [True, False])]) ('is_auto', '=', False), ('active', 'in', [True, False])])

View File

@@ -207,8 +207,9 @@ class WorkpieceDeliveryWizard(models.TransientModel):
workorder.production_line_id.id != self.production_ids[0].production_line_id.id): workorder.production_line_id.id != self.production_ids[0].production_line_id.id):
raise UserError(f'该rfid对应的制造订单号为{workorder.production_id.name}的目的生产线不一致') raise UserError(f'该rfid对应的制造订单号为{workorder.production_id.name}的目的生产线不一致')
# 调用打印成品条码方法 if workorder.routing_type == '解除装夹':
workorder.print_method() # 调用打印成品条码方法
workorder.print_method()
# 将对象添加到对应的同模型且是多对多类型里 # 将对象添加到对应的同模型且是多对多类型里
self.production_ids |= workorder.production_id self.production_ids |= workorder.production_id

View File

@@ -2023,6 +2023,11 @@ msgstr "<span class=\"o_stat_text\">损失</span>"
msgid "<span class=\"o_stat_text\">Maintenance</span>" msgid "<span class=\"o_stat_text\">Maintenance</span>"
msgstr "" msgstr ""
#. module: sf_manufacturing
#: model:ir.model.fields.selection,name:sf_manufacturing.selection__mrp_production__state__confirmed
msgid "待排程"
msgstr "待排程"
#. module: mrp #. module: mrp
#: model_terms:ir.ui.view,arch_db:mrp.product_product_form_view_bom_button #: model_terms:ir.ui.view,arch_db:mrp.product_product_form_view_bom_button
#: model_terms:ir.ui.view,arch_db:mrp.product_template_form_view_bom_button #: model_terms:ir.ui.view,arch_db:mrp.product_template_form_view_bom_button

View File

@@ -25,7 +25,7 @@ class SfQualityCncTest(models.Model):
('pass', '合格'), ('pass', '合格'),
('fail', '不合格')], string='判定结果') ('fail', '不合格')], string='判定结果')
number = fields.Integer('数量', default=1) number = fields.Integer('数量', default=1)
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], string="检测结果") test_results = fields.Selection([("合格", "合格"), ("返工", "返工")], string="检测结果")
reason = fields.Selection( reason = fields.Selection(
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"), ("operate computer", "操机"), [("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"), ("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因") ("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因")

View File

@@ -285,8 +285,6 @@ class RePurchaseOrder(models.Model):
[('standard', '标准采购'), ('consignment', '工序外协'), ('outsourcing', '委外加工'), ('outside', '外购订单')], [('standard', '标准采购'), ('consignment', '工序外协'), ('outsourcing', '委外加工'), ('outside', '外购订单')],
string='采购类型', default='standard', store=True, compute='_compute_purchase_type') string='采购类型', default='standard', store=True, compute='_compute_purchase_type')
origin_sale_id = fields.Many2one('sale.order', string='销售订单号', compute='_compute_origin_sale_id')
# 合同编号 # 合同编号
contract_number = fields.Char(string='合同编号', size=20) contract_number = fields.Char(string='合同编号', size=20)
# 合同概况 # 合同概况
@@ -311,21 +309,6 @@ class RePurchaseOrder(models.Model):
purchase.purchase_type = 'outsourcing' purchase.purchase_type = 'outsourcing'
break break
@api.depends('order_line.move_dest_ids.group_id.mrp_production_ids',
'order_line.move_ids.move_dest_ids.group_id.mrp_production_ids', 'origin')
def _compute_origin_sale_id(self):
for purchase in self:
productions_ids = purchase._get_mrp_productions()
if productions_ids:
if productions_ids[0].sale_order_id:
purchase.origin_sale_id = productions_ids[0].sale_order_id.id
continue
order_id = self.env['sale.order'].sudo().search([('name', '=', purchase.origin)])
if order_id:
purchase.origin_sale_id = order_id.id
continue
purchase.origin_sale_id = False
delivery_warning = fields.Selection([('normal', '正常'), ('warning', '预警'), ('overdue', '已逾期')], delivery_warning = fields.Selection([('normal', '正常'), ('warning', '预警'), ('overdue', '已逾期')],
string='交期状态', default='normal', string='交期状态', default='normal',
tracking=True) tracking=True)
@@ -374,12 +357,16 @@ class RePurchaseOrder(models.Model):
'product_qty': 1, 'product_qty': 1,
'product_uom': server_template.uom_id.id 'product_uom': server_template.uom_id.id
})) }))
# 获取服务商品最后一个供应商的采购员
purchase_user_id = server_template.seller_ids[-1].partner_id.purchase_user_id
purchase_order = self.env['purchase.order'].sudo().create({ purchase_order = self.env['purchase.order'].sudo().create({
'partner_id': server_template.seller_ids[0].partner_id.id, 'partner_id': server_template.seller_ids[0].partner_id.id,
'origin': production.name, 'origin': production.name,
'state': 'draft', 'state': 'draft',
'purchase_type': 'consignment', 'purchase_type': 'consignment',
'order_line': server_product_process}) 'order_line': server_product_process,
'user_id': purchase_user_id.id
})
pp.purchase_id = [(6, 0, [purchase_order.id])] pp.purchase_id = [(6, 0, [purchase_order.id])]
# self.env.cr.commit() # self.env.cr.commit()
@@ -441,6 +428,7 @@ class PurchaseOrderLine(models.Model):
part_name = fields.Char('零件名称', related='product_id.part_name', readonly=True) part_name = fields.Char('零件名称', related='product_id.part_name', readonly=True)
# part_number = fields.Char('零件图号',related='product_id.part_number', readonly=True) # part_number = fields.Char('零件图号',related='product_id.part_number', readonly=True)
class ResPartnerToSale(models.Model): class ResPartnerToSale(models.Model):
_inherit = 'res.partner' _inherit = 'res.partner'

View File

@@ -190,11 +190,6 @@
<field name="partner_ref" string="合同名称"/> <field name="partner_ref" string="合同名称"/>
<field name="contract_number"/> <field name="contract_number"/>
</xpath> </xpath>
<!-- 添加销售订单号字段-->
<xpath expr="//sheet/group/group[2]/div[@name='date_approve']" position="after">
<!-- <field name="origin_sale_id" readonly="1" attrs="{'invisible': [('origin_sale_id', '=', False)]}" string="参考销售订单"/> -->
<field name="origin_sale_id" readonly="1" string="参考销售订单"/>
</xpath>
<xpath expr="//sheet/group/group[2]/field[@name='effective_date']" position="attributes"> <xpath expr="//sheet/group/group[2]/field[@name='effective_date']" position="attributes">
<attribute name="invisible">1</attribute> <attribute name="invisible">1</attribute>
</xpath> </xpath>