Compare commits

...

266 Commits

Author SHA1 Message Date
刘磊
62f0578ce8 Accept Merge Request #2293: (feature/7254_new -> 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/2293
2025-07-18 15:12:05 +08:00
刘磊
b2a0899553 Accept Merge Request #2294: (feature/7230 -> 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/2294
2025-07-18 15:11:41 +08:00
陈赓
e0c1e27344 夹具型号相关数据表的优化 2025-07-18 14:24:33 +08:00
陈赓
8434172fec 夹具型号相关数据表的优化 2025-07-18 11:10:50 +08:00
陈赓
a920d4b4b8 夹具型号相关数据表的优化 2025-07-18 09:58:44 +08:00
陈赓
4609ddfa7a 夹具型号相关数据表的优化 2025-07-18 09:55:21 +08:00
陈赓
e73c0b15ea 夹具型号相关数据表的优化 2025-07-18 09:26:30 +08:00
陈赓
2347ed9cb3 材料型号增加是否磁吸 2025-07-17 14:12:35 +08:00
陈赓
f4829f57a1 还原 2025-07-17 11:08:42 +08:00
胡尧
e4c3435840 Accept Merge Request #2292: (feature/增加模块完整性验证 -> develop)
Merge Request: 去掉多余的js

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2292?initial=true
2025-07-16 15:04:01 +08:00
胡尧
2a7048dafd 去掉多余的js 2025-07-16 15:03:23 +08:00
胡尧
2bb215f9df Accept Merge Request #2291: (feature/增加模块完整性验证 -> develop)
Merge Request: 去掉多余的js文件

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2291?initial=true
2025-07-16 14:33:35 +08:00
胡尧
a2be3a0dbf 去掉多余的js文件 2025-07-16 14:32:37 +08:00
李晓斌
1f4ceab377 Accept Merge Request #2290: (feature/7253 -> develop)
Merge Request: Bug_7262_lxb_commit

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2290?initial=true
2025-07-16 14:10:37 +08:00
lixiaobin@jikimo.com
94d727e8e0 Bug_7262_lxb_commit 2025-07-16 14:06:58 +08:00
陈赓
cdf6a36c30 Redis同步 2025-07-16 11:49:41 +08:00
李晓斌
42d9f894dd Accept Merge Request #2289: (feature/7253 -> develop)
Merge Request: BUG_7276_lxb_commit

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2289
2025-07-16 11:23:08 +08:00
lixiaobin@jikimo.com
9416d1c1a0 BUG_7276_lxb_commit 2025-07-16 11:20:26 +08:00
管欢
7dd44ca12c Accept Merge Request #2288: (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/2288
2025-07-16 09:41:06 +08:00
guanhuan
5a98b20988 下达计划按钮重复点击生成重复数据 2025-07-16 09:32:28 +08:00
李晓斌
2738085a1e Accept Merge Request #2287: (feature/7253 -> develop)
Merge Request: Bug_7276_lxb_commit

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2287?initial=true
2025-07-15 16:56:26 +08:00
lixiaobin@jikimo.com
61c1fdbd05 Bug_7276_lxb_commit 2025-07-15 16:53:52 +08:00
hyyy
7eea5a0ff2 重复点击 2025-07-15 16:25:28 +08:00
李晓斌
714c68c0c1 Accept Merge Request #2286: (feature/7253 -> develop)
Merge Request: BUG_7276_lxb_commit

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2286
2025-07-15 14:35:11 +08:00
lixiaobin@jikimo.com
f3e7ba7f68 BUG_7276_lxb_commit 2025-07-15 14:17:38 +08:00
lixiaobin@jikimo.com
df589b43e7 BUG_7276_lxb_commit 2025-07-15 14:13:01 +08:00
lixiaobin@jikimo.com
8bdc65c626 BUG_7276_lxb_commit 2025-07-15 14:09:14 +08:00
guanhuan
0c3407572f 需求计划详情 2025-07-15 11:51:14 +08:00
hyyy
e5404efb60 批量下达计划禁用 2025-07-15 11:39:20 +08:00
陈赓
8e8f5eb8be feat: 新增 Redis 缓存同步相关模块与控制器 2025-07-15 11:29:18 +08:00
陈赓
cdbc277a94 feat: 新增 Redis 工具与控制器,更新同步逻辑相关文件 2025-07-15 11:28:12 +08:00
guanhuan
46f60028aa 需求位置修改 2025-07-15 10:40:19 +08:00
guanhuan
bfc071debd 需求位置修改 2025-07-15 10:34:28 +08:00
李晓斌
7fca59322e Accept Merge Request #2285: (feature/7253 -> develop)
Merge Request: BUG_7276_lxb_commit

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2285
2025-07-15 09:42:48 +08:00
lixiaobin@jikimo.com
42694c1ac6 BUG_7276_lxb_commit 2025-07-15 09:39:50 +08:00
管欢
e88fc012ec Accept Merge Request #2284: (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/2284
2025-07-14 16:16:20 +08:00
guanhuan
ff7cd9c927 校验修改 2025-07-14 16:13:49 +08:00
guanhuan
588b7d340f Merge branch 'refs/heads/develop' into feature/物料需求计划管理 2025-07-14 15:52:10 +08:00
guanhuan
5902d61f13 新增单件用量显示 2025-07-14 15:39:37 +08:00
陈烨
8cfad007b9 Accept Merge Request #2283: (feature/7249 -> develop)
Merge Request: 合并 develop 分支到 feature/7249

Created By: @陈烨
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @陈烨
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2283
2025-07-14 14:29:24 +08:00
chenye
5008210176 合并 develop 分支到 feature/7249 2025-07-14 14:21:44 +08:00
chenye
f487ab4cce 提交7268,7271等bug修改 2025-07-14 14:15:28 +08:00
guanhuan
0441f345ef 新增单件用量显示 2025-07-14 14:11:28 +08:00
李晓斌
3527105e83 Accept Merge Request #2282: (feature/7253 -> develop)
Merge Request: Debug-7269_lxb_commit

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2282?initial=true
2025-07-14 11:41:47 +08:00
lixiaobin@jikimo.com
88e4cfb541 Debug-7269_lxb_commit 2025-07-14 11:32:29 +08:00
管欢
5a175c078f Accept Merge Request #2281: (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/2281
2025-07-14 10:55:52 +08:00
guanhuan
20980bed9d 修复客供料产品下达计划,第二个计划下达报错 2025-07-14 10:54:17 +08:00
陈烨
9b94357439 Accept Merge Request #2280: (feature/7249 -> develop)
Merge Request: Merge branch 'develop' into feature/7249

Created By: @陈烨
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @陈烨
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2280
2025-07-14 08:50:26 +08:00
chenye
5ae3c5dd47 Merge branch 'develop' into feature/7249 2025-07-11 17:57:31 +08:00
chenye
60be14dda2 修改bug7264和7265 2025-07-11 17:49:05 +08:00
陈烨
f0ff7c4a74 Accept Merge Request #2279: (feature/7249 -> develop)
Merge Request: Merge branch 'develop' into feature/7249

Created By: @陈烨
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @陈烨
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2279
2025-07-11 17:01:05 +08:00
chenye
2b6e2fe31b Merge branch 'develop' into feature/7249 2025-07-11 16:48:24 +08:00
chenye
f1390e47c9 提交7252bug修改内容 2025-07-11 16:36:18 +08:00
李晓斌
c7cd0a6a69 Accept Merge Request #2278: (feature/7253 -> develop)
Merge Request: 7253_BUG修复

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2278
2025-07-11 11:40:18 +08:00
lixiaobin@jikimo.com
fa5307a2ea 7253_BUG修复 2025-07-11 11:13:08 +08:00
陈烨
07e4cdcaa0 Accept Merge Request #2276: (feature/7249 -> develop)
Merge Request: 提交7249和7246需求

Created By: @陈烨
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @陈烨
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2276
2025-07-11 10:19:58 +08:00
陈烨
ff5925eb06 Merge branch refs/heads/develop into refs/heads/feature/7249 2025-07-11 10:10:56 +08:00
chenye
2a7e07b4c0 提交7249和7246需求 2025-07-10 17:44:10 +08:00
guanhuan
4706bfe85e 计划量字段被修改成了别的字段名 2025-07-10 17:36:37 +08:00
李晓斌
2f21c510bd Accept Merge Request #2274: (feature/7231 -> develop)
Merge Request: 7231_lxb_commit--控制物料需求计划在客户位置的计划量不允许超过需求量

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2274
2025-07-10 17:01:05 +08:00
lixiaobin@jikimo.com
7adaa7e79b 7231_lxb_commit 2025-07-10 16:33:43 +08:00
禹翔辉
166d10e7d9 Accept Merge Request #2273: (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/2273
2025-07-10 15:24:52 +08:00
管欢
36d6a3ed4c Accept Merge Request #2275: (feature/物料需求计划管理 -> develop)
Merge Request: 需求计划bug修复

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2275
2025-07-10 15:18:35 +08:00
guanhuan
650ff9b3e2 采购申请状态修复 2025-07-10 15:11:32 +08:00
lixiaobin@jikimo.com
559c6bfb1d 7231_lxb_commit 2025-07-10 14:29:06 +08:00
guanhuan
e83d3f8a1c 修复齐套检查产品制造完成,坯料的状态又变成了未齐套 2025-07-10 14:21:10 +08:00
guanhuan
ac0966f3bf 修复齐套检查产品制造完成,坯料的状态又变成了未齐套 2025-07-10 14:20:15 +08:00
guanhuan
1f93ba3b42 修复未保存需求计划删除明细行问题,打印列表显示 2025-07-10 14:11:31 +08:00
guanhuan
4d2ab82645 修复采购类型根据供货方式来赋值 2025-07-10 08:57:38 +08:00
yuxianghui
7b4499184d 添加禁止负库存功能 2025-07-09 16:58:20 +08:00
guanhuan
d02babaf0a 修复需求计划生成的bom编码时间少8小时 2025-07-09 16:57:20 +08:00
guanhuan
acb6fd42ca 采购明细加需求计划明细字段 2025-07-09 16:46:46 +08:00
guanhuan
c2cb24c60b 需求计划优化 2025-07-09 11:38:40 +08:00
管欢
3be1c4c529 Accept Merge Request #2272: (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/2272
2025-07-09 10:26:45 +08:00
guanhuan
60e7415a27 更新报错 2025-07-09 10:25:19 +08:00
管欢
22763903a4 Accept Merge Request #2271: (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/2271
2025-07-09 10:19:50 +08:00
guanhuan
4c6cf0ba5e 更新报错 2025-07-09 09:54:58 +08:00
管欢
02012b2c52 Accept Merge Request #2270: (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/2270
2025-07-09 09:43:44 +08:00
guanhuan
a2b2efed7d 交货数量修改 2025-07-08 15:46:32 +08:00
guanhuan
925c59e1fe 采购申请添加需求明细字段 2025-07-08 11:25:00 +08:00
胡尧
f86e27b45e Accept Merge Request #2269: (feature/新增plm模块 -> develop)
Merge Request: 删除plm模块代码

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2269?initial=true
2025-07-07 15:00:13 +08:00
胡尧
b704f99a29 删除plm模块代码 2025-07-07 14:59:48 +08:00
胡尧
1ac6314f5f Accept Merge Request #2268: (feature/新增plm模块 -> develop)
Merge Request: 新增

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2268?initial=true
2025-07-07 12:16:56 +08:00
胡尧
8b3eef1256 新增 2025-07-07 11:59:14 +08:00
guanhuan
22ccb095ee 需求计划下达计划 2025-07-07 10:46:27 +08:00
guanhuan
9db4ea745b Merge branch 'refs/heads/develop' into feature/物料需求计划管理 2025-07-04 17:03:23 +08:00
guanhuan
60fd4d4a73 需求计划下达计划 2025-07-04 17:01:56 +08:00
禹翔辉
c6c4331c0b Accept Merge Request #2267: (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/2267
2025-07-04 13:49:35 +08:00
yuxianghui
10c6f59f52 处理 成品出库单创建欠单后生成的调拨单详情页中质量检查智能按钮默认展示为通过状态 问题 2025-07-04 13:48:16 +08:00
guanhuan
df4995fa24 需求计划下达计划 2025-07-04 10:18:28 +08:00
guanhuan
6e877d0449 需求计划下达计划 2025-07-03 17:32:11 +08:00
guanhuan
3822d78f35 需求计划供货方式修改 2025-07-03 14:33:19 +08:00
胡尧
b23e50daa6 Accept Merge Request #2266: (feature/6711 -> develop)
Merge Request: 解决采购申请创建的采购单取消后导致后续单据无法就绪的问题

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2266?initial=true
2025-07-02 17:32:14 +08:00
guanhuan
0350f78710 Merge branch 'refs/heads/develop' into feature/物料需求计划管理
# Conflicts:
#	sf_demand_plan/models/sf_production_demand_plan.py
#	sf_demand_plan/views/demand_plan.xml
2025-07-02 08:57:20 +08:00
胡尧
20df1c0365 Accept Merge Request #2265: (release/release_2.15 -> develop)
Merge Request: 需求计划列表字段位置变动

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2265
2025-07-01 17:57:16 +08:00
胡尧
20069d5336 Merge branch refs/heads/develop into refs/heads/release/release_2.15 2025-07-01 17:57:06 +08:00
guanhuan
b267f2351d 需求计划开发 2025-07-01 14:34:27 +08:00
guanhuan
fe8df494f9 需求计划列表字段位置变动 2025-06-30 17:13:46 +08:00
guanhuan
c31cc868a9 物料需求计划管理 2025-06-30 17:10:25 +08:00
禹翔辉
0e7d6fac4e Accept Merge Request #2264: (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/2264
2025-06-30 15:20:56 +08:00
guanhuan
32cd68e15f 调拨动作中屏蔽验证 2025-06-30 13:36:04 +08:00
guanhuan
334d406c35 需求计划 2025-06-30 11:29:40 +08:00
yuxianghui
70113cb3c5 采购申请批量转采购按钮显示优化 2025-06-30 09:20:09 +08:00
guanhuan
048f07aba4 新增坯料类型 2025-06-27 17:44:32 +08:00
guanhuan
f0e47371ed 新增坯料类型 2025-06-27 15:29:02 +08:00
guanhuan
c03cda8250 物料需求计划管理 2025-06-27 15:23:05 +08:00
yuxianghui
6dde814acc 产品-form页面加工参数 添加坯料类型字段 2025-06-27 15:17:15 +08:00
yuxianghui
71ab241e94 产品添加坯料类型字段,值来着bfm下单 2025-06-27 15:10:15 +08:00
禹翔辉
272e424975 Accept Merge Request #2263: (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/2263
2025-06-27 10:17:42 +08:00
yuxianghui
1fd9900e41 处理 由采购订单-委外加工类型生成的同一个补货组的坯料采购申请单据没有合并 问题 2025-06-27 09:39:11 +08:00
guanhuan
50a066c23a 物料需求计划管理 2025-06-26 17:52:40 +08:00
guanhuan
fe4659987f 物料需求计划管理 2025-06-26 17:18:03 +08:00
yuxianghui
0a13acbb68 修改 销售订单确认时,生成产品BOM时校验单位用量值的提示信息 2025-06-26 17:04:50 +08:00
yuxianghui
a68d6d4d06 处理 采购订单确认时,一补货组的补货单没有合并问题 2025-06-26 16:55:38 +08:00
guanhuan
c14e2c19bf 物料需求计划管理 2025-06-26 11:13:56 +08:00
胡尧
c630074f4a Accept Merge Request #2262: (feature/根据项目组区分sf代码 -> develop)
Merge Request: 撤回_run_manufacturing方法

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2262?initial=true
2025-06-26 10:27:04 +08:00
胡尧
4bea169327 撤回_run_manufacturing方法 2025-06-26 10:26:39 +08:00
禹翔辉
e2ddac4fb0 Accept Merge Request #2261: (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/2261
2025-06-26 10:24:21 +08:00
yuxianghui
e52ec3982f 调拨单验证时,对没有完成通过的质检单不进行出厂检验报告检测 2025-06-26 10:03:19 +08:00
胡尧
160bd117b7 Accept Merge Request #2260: (feature/根据项目组区分sf代码 -> develop)
Merge Request: 没有model_id的制造订单不请求编程

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2260
2025-06-26 09:35:42 +08:00
胡尧
a19cf5d894 解决冲突 2025-06-26 09:35:26 +08:00
胡尧
885064fb12 没有model_id的制造订单不请求编程 2025-06-26 09:29:02 +08:00
胡尧
8f7e785760 Accept Merge Request #2259: (feature/根据项目组区分sf代码 -> develop)
Merge Request: 修复加工面报错的问题

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2259?initial=true
2025-06-25 17:36:14 +08:00
胡尧
8123885c71 修复加工面报错的问题 2025-06-25 17:35:18 +08:00
禹翔辉
c2f346571d Accept Merge Request #2258: (feature/委外加工采购订单 -> develop)
Merge Request: 完成 委外加工采购订单增加BOM内物料的采购申请与采购订单 需求

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2258
2025-06-25 16:13:04 +08:00
yuxianghui
e3494ce8b7 完成 委外加工采购订单增加BOM内物料的采购申请与采购订单 需求 2025-06-25 16:09:32 +08:00
guanhuan
413cf43ea0 物料需求计划管理 2025-06-25 15:33:24 +08:00
guanhuan
deda36a0f9 物料需求计划管理 2025-06-25 15:01:02 +08:00
禹翔辉
d75cff0a5d Accept Merge Request #2257: (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/2257
2025-06-25 14:37:28 +08:00
guanhuan
8a953a1417 Merge branch 'refs/heads/feature/库存路线' into feature/物料需求计划管理
# Conflicts:
#	sf_demand_plan/__manifest__.py
#	sf_demand_plan/models/sf_production_demand_plan.py
#	sf_demand_plan/security/ir.model.access.csv
2025-06-25 14:32:18 +08:00
guanhuan
d046fd5298 移除销售订单供货方式确认 2025-06-25 14:22:27 +08:00
hyyy
4b026535f8 修改固定列tree的传参方式 2025-06-25 14:01:34 +08:00
yuxianghui
28ade4ac72 完成 物料需求计划主数据准备:库存路线 需求 2025-06-25 13:57:56 +08:00
guanhuan
9f00fddc09 物料需求计划管理 2025-06-25 09:57:19 +08:00
hyyy
99ac89f995 需求-字段命名调整 2025-06-25 09:54:37 +08:00
胡尧
372f95d812 Accept Merge Request #2256: (feature/6711 -> develop)
Merge Request: 待完工工单明细,控制时间为大于48小时,小于当前时间

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2256?initial=true
2025-06-25 09:43:11 +08:00
胡尧
4099756d15 Accept Merge Request #2255: (feature/6711 -> develop)
Merge Request: 日计划量对工单id去重

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2255?initial=true
2025-06-25 08:44:32 +08:00
guanhuan
f41d3558d2 物料需求计划管理 2025-06-24 17:46:55 +08:00
禹翔辉
91bad533c3 Accept Merge Request #2254: (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/2254
2025-06-24 17:10:41 +08:00
yuxianghui
f5ed94866b 调拨单需验证质检单数量方法优化 2025-06-24 16:59:38 +08:00
胡尧
b70f280c6e Accept Merge Request #2253: (feature/6711 -> develop)
Merge Request: 修复明细接口bug

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2253?initial=true
2025-06-24 15:56:52 +08:00
胡尧
152657e41b Accept Merge Request #2252: (feature/6711 -> develop)
Merge Request: 修改未完成订单明细的判断逻辑

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2252?initial=true
2025-06-24 15:51:17 +08:00
yuxianghui
35b1d648c3 产品新增单件用量 unit_number 字段,值由bfm下单同步获得;产品生成的BOM中组件数量的值由unit_number 字段提供。 2025-06-24 15:36:23 +08:00
胡尧
174af13a58 Accept Merge Request #2251: (feature/6711 -> develop)
Merge Request: 修改工单状态对应名字

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2251?initial=true
2025-06-24 15:35:42 +08:00
胡尧
832b06be1f Merge branch 'develop' into feature/根据项目组区分sf代码 2025-06-24 15:06:31 +08:00
胡尧
3b60db56de Accept Merge Request #2250: (feature/6711 -> develop)
Merge Request: 修改大屏获取订单详情接口

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2250
2025-06-24 14:52:47 +08:00
yuxianghui
579b7138e7 需求 调拨单关联校验是否完成质量检查时,可先排除欠单量后再校验 开发 2025-06-24 14:41:49 +08:00
yuxianghui
98f8430c45 Revert "需求 调拨单关联校验是否完成质量检查时,可先排除欠单量后再校验 开发"
This reverts commit 912847ae33.
2025-06-24 14:32:40 +08:00
yuxianghui
912847ae33 需求 调拨单关联校验是否完成质量检查时,可先排除欠单量后再校验 开发 2025-06-24 14:32:21 +08:00
管欢
d1f9f8cf8c Accept Merge Request #2249: (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/2249
2025-06-24 11:44:41 +08:00
guanhuan
7d1f7b11eb 坯料尺寸显示修改 2025-06-24 11:39:47 +08:00
guanhuan
fe3492ceb5 坯料尺寸显示修改 2025-06-24 11:32:41 +08:00
guanhuan
02b4f76326 物料需求计划 2025-06-24 11:17:41 +08:00
胡尧
72f737c370 Accept Merge Request #2248: (feature/6711 -> develop)
Merge Request: 解决大屏bug

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2248?initial=true
2025-06-23 17:54:56 +08:00
guanhuan
2f26aee90a 物料需求计划 2025-06-23 17:21:50 +08:00
管欢
98c5b3b013 Accept Merge Request #2247: (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/2247
2025-06-23 14:26:02 +08:00
guanhuan
0d76d1a7d3 需求计划修改 2025-06-23 13:59:37 +08:00
胡尧
b177bd95ff 将fetchCNC移动到sf_mrs_connect模块 2025-06-23 11:04:44 +08:00
胡尧
a5bb686708 Accept Merge Request #2245: (feature/根据项目组区分sf代码 -> develop)
Merge Request: 将sf_manufacturing模块中stock.py的_run_manufacture方法进行拆分

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2245?initial=true
2025-06-23 10:54:27 +08:00
胡尧
c1bafef1aa Merge branch 'develop' into feature/根据项目组区分sf代码 2025-06-23 10:49:47 +08:00
胡尧
46125dc44b Accept Merge Request #2244: (feature/6711 -> develop)
Merge Request: 修复时间显示问题

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2244?initial=true
2025-06-23 09:22:55 +08:00
胡尧
d0d3215bf3 Accept Merge Request #2243: (feature/6711 -> develop)
Merge Request: 修改日产量时间

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2243
2025-06-23 09:11:51 +08:00
禹翔辉
92a0c15708 Accept Merge Request #2242: (feature/委外加工bug修复 -> develop)
Merge Request: Merge branch 'feature/委外加工采购订单原生BUG修复' into feature/委外加工bug修复

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2242
2025-06-23 08:50:21 +08:00
yuxianghui
0013f9f8c9 Merge branch 'feature/委外加工采购订单原生BUG修复' into feature/委外加工bug修复 2025-06-23 08:34:14 +08:00
yuxianghui
4274b9fe99 出厂检验报告-页脚修改回退 2025-06-20 17:53:04 +08:00
禹翔辉
149d8e287b Accept Merge Request #2241: (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/2241
2025-06-20 17:44:00 +08:00
yuxianghui
3f65742add 撤销出厂检验报告模版-页脚优化 2025-06-20 17:42:39 +08:00
管欢
b56e3545a1 Accept Merge Request #2239: (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/2239
2025-06-20 17:37:21 +08:00
禹翔辉
fd7080a332 Accept Merge Request #2240: (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/2240
2025-06-20 17:37:12 +08:00
yuxianghui
85fb64ed55 页脚条件判断条件优化 2025-06-20 17:36:12 +08:00
guanhuan
9ad06b4361 需求计划 2025-06-20 17:34:17 +08:00
guanhuan
f9c13341e6 Merge branch 'refs/heads/develop' into feature/齐套检查与下达生产 2025-06-20 17:33:26 +08:00
guanhuan
d2a61c79d0 需求计划 2025-06-20 17:29:41 +08:00
禹翔辉
5f80b377e5 Accept Merge Request #2238: (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/2238
2025-06-20 17:28:20 +08:00
yuxianghui
ab2e685004 添加页脚页码数据测试 2025-06-20 17:24:48 +08:00
guanhuan
dcc5eef006 需求计划 2025-06-20 17:21:06 +08:00
guanhuan
7e8b2adb3d 需求计划 2025-06-20 17:19:33 +08:00
禹翔辉
9aa870065b Accept Merge Request #2237: (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/2237
2025-06-20 17:03:52 +08:00
yuxianghui
60c39929b2 页脚优化 2025-06-20 17:02:31 +08:00
禹翔辉
9a5b8a2627 Accept Merge Request #2236: (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/2236
2025-06-20 16:56:08 +08:00
yuxianghui
73696eb72c 出厂检验报告-页脚优化 2025-06-20 16:50:59 +08:00
禹翔辉
55babb8a35 Accept Merge Request #2235: (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/2235
2025-06-20 16:42:02 +08:00
yuxianghui
6682dbfb7d 出厂检验报告模版-页脚优化 2025-06-20 16:40:38 +08:00
禹翔辉
e0b8e5fe07 Accept Merge Request #2234: (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/2234
2025-06-20 16:19:18 +08:00
yuxianghui
800f2eb6a7 出厂检验报告-页脚优化 2025-06-20 16:03:13 +08:00
禹翔辉
3cc633131e Accept Merge Request #2233: (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/2233
2025-06-20 15:57:55 +08:00
yuxianghui
e3fb266890 出厂检验报告-页脚修改 2025-06-20 15:55:58 +08:00
胡尧
844f7de1ab Accept Merge Request #2232: (feature/6711 -> develop)
Merge Request: 修改计划量字段为–qty_production

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2232?initial=true
2025-06-20 15:39:28 +08:00
禹翔辉
266601cf84 Accept Merge Request #2231: (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/2231
2025-06-20 15:36:51 +08:00
yuxianghui
2e168a4ba7 出厂检验报告模版-页脚优化 2025-06-20 15:35:07 +08:00
胡尧
68ba47ed70 Accept Merge Request #2230: (feature/7151 -> develop)
Merge Request: 修改依赖

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2230?initial=true
2025-06-20 15:03:57 +08:00
胡尧
5bb6fcd4f7 修改依赖 2025-06-20 15:03:42 +08:00
胡尧
9a05bbd82c Accept Merge Request #2229: (feature/7151 -> develop)
Merge Request: 修改需求计划,下达生成的方法

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2229?initial=true
2025-06-20 14:52:34 +08:00
胡尧
b33c992b25 修改需求计划,下达生成的方法 2025-06-20 14:51:58 +08:00
yuxianghui
5947b3dfe9 回退出厂检验报告模版 2025-06-20 14:26:29 +08:00
禹翔辉
95e43b0fba Accept Merge Request #2228: (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/2228
2025-06-20 14:07:56 +08:00
yuxianghui
e7afc76753 出厂检验报告模版优化 2025-06-20 14:01:56 +08:00
胡尧
788183e239 修改批量大小 2025-06-20 13:52:37 +08:00
禹翔辉
4ddabdefa1 Accept Merge Request #2227: (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/2227
2025-06-20 13:39:42 +08:00
yuxianghui
364127beb3 1 2025-06-20 13:37:42 +08:00
yuxianghui
109ea8729d 优化出厂检验报告模版 2025-06-20 12:03:17 +08:00
禹翔辉
32de726164 Accept Merge Request #2226: (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/2226
2025-06-20 11:49:32 +08:00
yuxianghui
79f89f068b 修改出厂检验报告模版 2025-06-20 11:47:59 +08:00
禹翔辉
52189cff72 Accept Merge Request #2225: (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/2225
2025-06-20 11:37:18 +08:00
yuxianghui
aadccce47e 修改出厂检验报告生成模版 2025-06-20 11:35:23 +08:00
胡尧
abd88fd721 Accept Merge Request #2224: (feature/6711 -> develop)
Merge Request: 修改产量接口bug

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2224?initial=true
2025-06-20 11:27:06 +08:00
胡尧
f38f60a6a8 计划增加队列 2025-06-20 11:24:39 +08:00
胡尧
7d8b7048a8 Accept Merge Request #2223: (feature/6711 -> develop)
Merge Request: 去掉多余代码

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2223?initial=true
2025-06-20 11:15:58 +08:00
禹翔辉
bc641bde3a Accept Merge Request #2222: (feature/平台下单接口优化 -> develop)
Merge Request: 处理bfm下单报错

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2222
2025-06-20 10:30:25 +08:00
yuxianghui
d73ffab9b5 处理bfm下单报错 2025-06-20 10:28:07 +08:00
黄焱
4b1c0bc3b5 Accept Merge Request #2221: (feature/前端样式修改 -> develop)
Merge Request: 质检PDF预览logo移位

Created By: @黄焱
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @黄焱
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2221?initial=true
2025-06-20 09:23:34 +08:00
hyyy
45730e2dd4 质检PDF预览logo移位 2025-06-20 09:09:45 +08:00
禹翔辉
8903f32cf8 Accept Merge Request #2220: (feature/质检按钮隐藏 -> develop)
Merge Request: 处理 bfm内部下单包含坯料尺寸时,生成的产品的加工参数-体积数据不正确问题

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2220
2025-06-19 16:34:32 +08:00
yuxianghui
8bd1c8a095 处理 bfm内部下单包含坯料尺寸时,生成的产品的加工参数-体积数据不正确问题 2025-06-19 16:29:31 +08:00
谷耀东
abf9a0997b Accept Merge Request #2219: (feature/7154 -> 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/2219
2025-06-19 16:28:02 +08:00
guyaodong
aec2d1c516 恢复刀具房样式和编码 2025-06-19 16:18:04 +08:00
禹翔辉
127efb67d7 Accept Merge Request #2218: (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/2218
2025-06-19 15:19:34 +08:00
yuxianghui
78edf1f7eb 质检单按钮隐藏 2025-06-19 15:17:26 +08:00
胡尧
e6e13a5970 Accept Merge Request #2217: (feature/6711 -> develop)
Merge Request: 修改大屏数据接口,日完成量统计,获取产线产量相关,获取工单明细

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2217?initial=true
2025-06-19 15:03:27 +08:00
黄焱
427b548939 Accept Merge Request #2216: (feature/前端样式修改 -> develop)
Merge Request: 修改合格logo位置

Created By: @黄焱
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @黄焱
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2216?initial=true
2025-06-19 14:37:13 +08:00
hyyy
8c9db7e8c8 修改合格logo位置 2025-06-19 14:32:59 +08:00
管欢
990f73ea4e Accept Merge Request #2215: (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/2215
2025-06-19 11:21:12 +08:00
guanhuan
b4ed65a75c 物料需求计划增加字段显示 2025-06-19 10:37:35 +08:00
管欢
53ba2ec589 Accept Merge Request #2214: (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/2214
2025-06-19 09:58:10 +08:00
guanhuan
566bc0e1e2 物料需求计划增加字段显示 2025-06-19 09:40:29 +08:00
黄焱
5f216684f0 Accept Merge Request #2213: (feature/前端样式修改 -> develop)
Merge Request: 修改出厂检验报告合格LOGO移位

Created By: @黄焱
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @黄焱
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2213?initial=true
2025-06-18 18:00:26 +08:00
hyyy
e86bd59a43 修改出厂检验报告合格LOGO移位 2025-06-18 17:56:27 +08:00
禹翔辉
e55625e4b6 Accept Merge Request #2212: (feature/处理sf.t更新报错 -> develop)
Merge Request: bfm内部下单新增坯料长宽高同步到sf产品-加工参数-坯料尺寸的长宽高

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2212
2025-06-18 17:02:57 +08:00
yuxianghui
790dd3dd05 销售订单行的交货截止日期改为客户交期 2025-06-18 17:00:16 +08:00
yuxianghui
84846fb3da bfm内部下单新增坯料长宽高同步到sf产品-加工参数-坯料尺寸的长宽高 2025-06-18 16:54:15 +08:00
禹翔辉
f45a46255b Accept Merge Request #2211: (feature/处理sf.t更新报错 -> develop)
Merge Request: 处理sf.t更新报错

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2211
2025-06-18 16:12:12 +08:00
yuxianghui
fe5b005e45 1 2025-06-18 16:11:49 +08:00
yuxianghui
fc33280509 处理sf.t更新报错 2025-06-18 16:09:44 +08:00
黄焱
60ed04cf77 Accept Merge Request #2208: (feature/前端样式修改 -> develop)
Merge Request: 修改需求计划模块需求与bug

Created By: @黄焱
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @黄焱
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2208
2025-06-18 15:47:36 +08:00
禹翔辉
3439b47b0c Accept Merge Request #2206: (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/2206
2025-06-18 15:45:32 +08:00
管欢
33c5d648b5 Accept Merge Request #2210: (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/2210
2025-06-18 15:41:54 +08:00
谷耀东
c7b50d9706 Accept Merge Request #2209: (feature/7141 -> develop)
Merge Request: 增加kanban悬停tip

Created By: @谷耀东
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @谷耀东
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2209
2025-06-18 15:41:44 +08:00
guanhuan
05caed1d91 批量排程时间修改 2025-06-18 14:49:35 +08:00
guyaodong
8b66fda899 增加kanban悬停tip 2025-06-18 14:26:53 +08:00
hyyy
1456d4303b 修改需求计划模块需求与bug 2025-06-18 14:18:37 +08:00
guanhuan
9d2f23de7c 批量排程时间修改 2025-06-18 14:05:23 +08:00
yuxianghui
9393a48e70 删除客户交期字段 2025-06-18 11:11:51 +08:00
胡尧
749f44d6df Accept Merge Request #2205: (feature/7134 -> develop)
Merge Request: 修改采购申请相关欠单创建报错的问题

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2205?initial=true
2025-06-18 10:56:54 +08:00
胡尧
4f000a6be4 修改采购申请相关欠单创建报错的问题 2025-06-18 10:56:22 +08:00
yuxianghui
71a0f39ec9 新增如果采购订单类型为委外加工,则不进行供应商校验直接生成补给单 2025-06-18 10:50:13 +08:00
胡尧
7af7079a5c Accept Merge Request #2204: (feature/7134 -> develop)
Merge Request: 采购申请按钮按照产品以及bom产品过滤

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2204?initial=true
2025-06-18 10:34:57 +08:00
胡尧
376eb9e56f 采购申请按钮按照产品以及bom产品过滤 2025-06-18 10:34:34 +08:00
管欢
531bc2e090 Accept Merge Request #2203: (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/2203
2025-06-18 09:44:16 +08:00
guanhuan
bc3ab21d75 打印列表程序单数据修改 2025-06-18 09:40:12 +08:00
胡尧
92f591c3e7 将sf_manufacturing模块中stock.py的_run_manufacture方法进行拆分 2025-06-18 09:25:44 +08:00
guanhuan
d1811ea24b 需齐套检查修改 2025-06-17 16:33:01 +08:00
guanhuan
b426d5d505 需求计划排序修改 2025-06-17 14:58:27 +08:00
禹翔辉
1dfa22900d Accept Merge Request #2202: (feature/质检样式修改 -> develop)
Merge Request: 1、质检单类型为出厂检测报告时,隐藏通过状态下的不合格按钮;2、功能刀具组装检测BOM物料时过滤产品的追溯类型为不追溯的产品。

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2202
2025-06-17 11:50:01 +08:00
yuxianghui
0eeebf437a 1、质检单类型为出厂检测报告时,隐藏通过状态下的不合格按钮;2、功能刀具组装检测BOM物料时过滤产品的追溯类型为不追溯的产品。 2025-06-17 11:47:26 +08:00
管欢
397d4f29a1 Accept Merge Request #2201: (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/2201
2025-06-17 11:21:00 +08:00
guanhuan
33205c5d29 不同产品调拨单就绪未过滤产品问题 2025-06-17 10:57:13 +08:00
hyyy
568f3e4f30 修改传参,增加提示,默认展示第一个文件 2025-06-17 09:58:53 +08:00
guanhuan
8c43fc2b76 打印方法修改 2025-06-17 09:41:08 +08:00
guanhuan
8960d3d07c Merge remote-tracking branch 'origin/feature/齐套检查与下达生产' into feature/齐套检查与下达生产 2025-06-16 17:42:40 +08:00
guanhuan
95b5c86242 投料齐套检查修改 2025-06-16 17:42:05 +08:00
hyyy
c2000aa9c5 修改字段名 2025-06-16 17:28:09 +08:00
hyyy
e29456bbf7 选择列表展示图片 2025-06-16 17:25:52 +08:00
禹翔辉
a2f8dc6cec Accept Merge Request #2200: (feature/平台下单优化_1 -> develop)
Merge Request: Merge branch 'feature/平台下单优化' into feature/平台下单优化_1

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2200
2025-06-16 16:06:06 +08:00
yuxianghui
fec095ca6b Merge branch 'feature/平台下单优化' into feature/平台下单优化_1 2025-06-16 16:03:53 +08:00
yuxianghui
aed33dbb35 1、内部下单:行明细增加交期等; 2、处理 bfm平台下单-填写了合同相关字段,未上传合同,合同的相关字段未传到sf销售订单 问题 2025-06-16 16:02:43 +08:00
guanhuan
dbe8c95558 打印页面增加筛选 2025-06-16 15:43:02 +08:00
86 changed files with 3504 additions and 1006 deletions

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
{
'name': '机企猫 需求计划排程队列',
'version': '1.0',
'summary': """ 使用队列进行排程 """,
'author': 'fox',
'website': '',
'category': '',
'depends': ['queue_job_batch', 'sf_demand_plan'],
'data': [
],
'application': True,
'installable': True,
'auto_install': False,
'license': 'LGPL-3',
}

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import production_demand_plan

View File

@@ -0,0 +1,20 @@
from odoo import models, fields
class ProductionDemandPlan(models.Model):
_inherit = 'sf.production.demand.plan'
def _do_production_schedule(self, pro_plan_list):
"""使用队列进行排程"""
batch_size = 10
current_time = fields.Datetime.now().strftime('%Y%m%d%H%M%S')
index = 1
for i in range(0, len(pro_plan_list), batch_size):
batch = self.env['queue.job.batch'].get_new_batch('plan-%s-%s' % (current_time, index))
pro_plans = pro_plan_list[i:i+batch_size]
pro_plans.with_context(
job_batch=batch
).with_delay().do_production_schedule()
index += 1
batch.enqueue()

View File

@@ -521,11 +521,6 @@ div:has(.o_required_modifier) > label::before {
} }
} }
// 设置表格横向滚动
.o_list_renderer.o_renderer {
max-width: 100%;
overflow-x: auto;
}
// 设置表单页面label文本不换行 // 设置表单页面label文本不换行
.o_form_view .o_group .o_wrap_label .o_form_label { .o_form_view .o_group .o_wrap_label .o_form_label {

View File

@@ -10,6 +10,7 @@
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'views/sale_order_view.xml', 'views/sale_order_view.xml',
'views/purchase_order.xml',
'views/mrp_production.xml', 'views/mrp_production.xml',
'views/purchase_request_view.xml', 'views/purchase_request_view.xml',
'wizard/purchase_request_line_make_purchase_order_view.xml', 'wizard/purchase_request_line_make_purchase_order_view.xml',

View File

@@ -6,3 +6,4 @@ from . import mrp_production
from . import purchase_order from . import purchase_order
from . import stock_rule from . import stock_rule
from . import stock_picking from . import stock_picking
from . import product_product

View File

@@ -12,9 +12,7 @@ class MrpProduction(models.Model):
if item.product_id.is_customer_provided: if item.product_id.is_customer_provided:
item.pr_mp_count = 0 item.pr_mp_count = 0
else: else:
# 由于采购申请合并了所有销售订单行的采购,所以不区分产品 pr_ids = item._get_purchase_request()
mrp_names = self.env['mrp.production'].search([('origin', '=', item.origin)]).mapped('name')
pr_ids = self.env['purchase.request'].sudo().search([('origin', 'in', mrp_names)])
item.pr_mp_count = len(pr_ids) item.pr_mp_count = len(pr_ids)
# pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', item.name), ('is_subcontract', '!=', 'True')]) # pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', item.name), ('is_subcontract', '!=', 'True')])
@@ -25,8 +23,7 @@ class MrpProduction(models.Model):
self.ensure_one() self.ensure_one()
# 由于采购申请合并了所有销售订单行的采购,所以不区分产品 # 由于采购申请合并了所有销售订单行的采购,所以不区分产品
mrp_names = self.env['mrp.production'].search([('origin', '=', self.origin)]).mapped('name') pr_ids = self._get_purchase_request()
pr_ids = self.env['purchase.request'].sudo().search([('origin', 'in', mrp_names)])
action = { action = {
'res_model': 'purchase.request', 'res_model': 'purchase.request',
@@ -44,3 +41,12 @@ class MrpProduction(models.Model):
'view_mode': 'tree,form', 'view_mode': 'tree,form',
}) })
return action return action
def _get_purchase_request(self):
"""获取跟制造订单相关的采购申请单(根据采购申请单行项目的产品匹配)"""
mrp_names = self.env['mrp.production'].search([('origin', '=', self.origin)]).mapped('name')
pr_ids = self.env['purchase.request'].sudo().search([('origin', 'in', mrp_names)])
product_list = self.product_id._get_product_include_bom()
pr_line_ids = pr_ids.line_ids.filtered(lambda l: l.product_id in product_list)
return pr_line_ids.mapped('request_id')

View File

@@ -0,0 +1,17 @@
from odoo import models
class ProductProduct(models.Model):
_inherit = 'product.product'
def _get_product_include_bom(self):
"""获取产品列表包括所有bom"""
self.ensure_one()
product_list = [self]
bom_ids = self.bom_ids
while (bom_ids):
bom_product_ids = bom_ids.bom_line_ids.mapped('product_id')
product_list.append(bom_product_ids)
bom_ids = bom_product_ids.bom_ids
return product_list

View File

@@ -16,6 +16,69 @@ class PurchaseOrder(models.Model):
('rejected', '已驳回') ('rejected', '已驳回')
], string='Status', readonly=True, index=True, copy=False, default='draft', tracking=True) ], string='Status', readonly=True, index=True, copy=False, default='draft', tracking=True)
# 成品采购订单对应的坯料采购申请单和采购订单数量
purchase_request_count = fields.Integer('子·采购申请数量', compute='_compute_purchase_request')
purchase_order_count = fields.Integer('子·采购订单数量', compute='_compute_purchase_request')
@api.depends('state')
def _compute_purchase_request(self):
for record in self:
purchase_request_ids, purchase_order_ids = record.get_purchase_request_order()
record.purchase_request_count = len(purchase_request_ids)
record.purchase_order_count = len(purchase_order_ids)
def action_view_preform_body_purchase_request(self):
self.ensure_one()
name_list = self._get_pinking_name()
purchase_request_ids = self.env['purchase.request'].search([('origin', 'in', name_list)])
action = {
'res_model': 'purchase.request',
'type': 'ir.actions.act_window',
}
if len(purchase_request_ids) == 1:
action.update({
'view_mode': 'form',
'res_id': purchase_request_ids[0].id,
})
else:
action.update({
'name': _("子·采购申请"),
'domain': [('id', 'in', purchase_request_ids.ids)],
'view_mode': 'tree,form',
})
return action
def action_view_preform_body_purchase_order(self):
self.ensure_one()
name_list = self._get_pinking_name()
purchase_order_ids = self.env['purchase.order'].search([('origin', 'in', name_list)])
action = {
'res_model': 'purchase.order',
'type': 'ir.actions.act_window',
}
if len(purchase_order_ids) == 1:
action.update({
'view_mode': 'form',
'res_id': purchase_order_ids[0].id,
})
else:
action.update({
'name': _("子·采购订单"),
'domain': [('id', 'in', purchase_order_ids.ids)],
'view_mode': 'tree,form',
})
return action
def get_purchase_request_order(self):
name_list = self._get_pinking_name()
purchase_request_ids = self.env['purchase.request'].search([('origin', 'in', name_list)])
purchase_order_ids = self.env['purchase.order'].search([('origin', 'in', name_list)])
return purchase_request_ids, purchase_order_ids
def _get_pinking_name(self):
return [picking_id.name for picking_id in self.picking_ids if picking_id.name]
def button_confirm(self): def button_confirm(self):
res = super(PurchaseOrder, self).button_confirm() res = super(PurchaseOrder, self).button_confirm()

View File

@@ -16,6 +16,7 @@ class PurchaseRequest(models.Model):
) )
rule_new_add = fields.Boolean('采购请求为规则创建', default=False, compute='_compute_state', store=True) rule_new_add = fields.Boolean('采购请求为规则创建', default=False, compute='_compute_state', store=True)
rule_purchase_to_request = fields.Boolean('采购单根据规则创建坯料采购申请', default=False)
@api.depends('state') @api.depends('state')
def _compute_state(self): def _compute_state(self):

View File

@@ -44,7 +44,7 @@ class StatusChange(models.Model):
else: else:
action.update({ action.update({
'name': _("%s生成采购请求单", self.name), 'name': _("%s生成采购请求单", self.name),
'domain': [('id', 'in', pr_ids)], 'domain': [('id', 'in', pr_ids.ids)],
'view_mode': 'tree,form', 'view_mode': 'tree,form',
}) })
return action return action

View File

@@ -41,7 +41,20 @@ class StockPicking(models.Model):
if backorder_ids: if backorder_ids:
purchase_request_lines = self.move_ids.move_orig_ids.purchase_line_id.purchase_request_lines purchase_request_lines = self.move_ids.move_orig_ids.purchase_line_id.purchase_request_lines
if purchase_request_lines: if purchase_request_lines:
purchase_request_lines.move_dest_ids = [ purchase_request_lines.move_dest_ids = [
(4, x.id) for x in backorder_ids.move_ids if x.product_id.id == purchase_request_lines.product_id.id (4, x.id) for x in backorder_ids.move_ids if
x.product_id.id in purchase_request_lines.mapped('product_id.id') and \
not x.created_purchase_request_line_id
] ]
return res return res
def _subcontracted_produce(self, subcontract_details):
super()._subcontracted_produce(subcontract_details)
# 判断是否根据规则生成新的采购申请单据,如果生成则修改状态为 approved
if self:
pr_ids = self.env["purchase.request"].sudo().search(
[('origin', 'like', self.name), ('rule_purchase_to_request', '=', True), ('state', '=', 'draft')])
if pr_ids:
pr_ids.write({'need_validation': False})
pr_ids.write({"state": "approved", 'need_validation': True, 'rule_new_add': False})

View File

@@ -26,7 +26,7 @@ class StockRule(models.Model):
request_data = rule._prepare_purchase_request( request_data = rule._prepare_purchase_request(
procurement.origin, procurement.values procurement.origin, procurement.values
) )
request_data.update({'rule_new_add': True}) request_data = self._update_request_data(procurement, request_data)
pr = purchase_request_model.create(request_data) pr = purchase_request_model.create(request_data)
cache[domain] = pr cache[domain] = pr
elif ( elif (
@@ -44,6 +44,18 @@ class StockRule(models.Model):
request_line_data.update({'origin': procurement.origin}) request_line_data.update({'origin': procurement.origin})
purchase_request_line_model.create(request_line_data) purchase_request_line_model.create(request_line_data)
def _update_request_data(self, procurement, request_data):
sp = self.env['stock.picking'].sudo().search([('name', '=', procurement.origin)])
if len(sp) == 1:
po = self.env['purchase.order'].sudo().search(
[('name', '=', sp.origin), ('purchase_type', '=', 'outsourcing')])
if po:
request_data.update({'rule_purchase_to_request': True})
else:
request_data.update({'rule_new_add': True})
return request_data
def _run_buy(self, procurements): def _run_buy(self, procurements):
# 如果补货组相同,并且产品相同,则合并 # 如果补货组相同,并且产品相同,则合并
procurements_dict = defaultdict() procurements_dict = defaultdict()

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="purchase_order_form_jikimo_purchase_request" model="ir.ui.view">
<field name="name">purchase.order.inherited.form.jikimo.purchase.request</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="mrp_subcontracting_purchase.purchase_order_form_mrp_subcontracting_purchase"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_button_box')]/button[@name='action_view_subcontracting_resupply']" position="before">
<button
class="oe_stat_button" name="action_view_preform_body_purchase_order"
type="object" icon="fa-truck" attrs="{'invisible': [('purchase_order_count', '=', 0)]}" groups="stock.group_stock_user">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value"><field name="purchase_order_count"/></span>
<span class="o_stat_text">子·采购订单</span>
</div>
</button>
<button
class="oe_stat_button" name="action_view_preform_body_purchase_request"
type="object" icon="fa-truck" attrs="{'invisible': [('purchase_request_count', '=', 0)]}" groups="stock.group_stock_user">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value"><field name="purchase_request_count"/></span>
<span class="o_stat_text">子·采购申请</span>
</div>
</button>
</xpath>
</field>
</record>
</odoo>

View File

@@ -67,6 +67,16 @@
<field name="part_number"/> <field name="part_number"/>
<field name="part_name" invisible="1"/> <field name="part_name" invisible="1"/>
</xpath> </xpath>
<xpath expr="//tree" position="inside">
<header>
<button
name="%(purchase_request.action_purchase_request_line_make_purchase_order)d"
string="创建询价单"
type="action"
class="btn-primary"
/>
</header>
</xpath>
</field> </field>
</record> </record>

View File

@@ -4,9 +4,10 @@ class StockRule(models.Model):
_inherit = 'stock.rule' _inherit = 'stock.rule'
def _run_buy(self, procurements): def _run_buy(self, procurements):
res = super(StockRule, self)._run_buy(procurements)
# 判断是否根据规则生成新的采购申请单据,如果生成则修改状态为 approved # 判断是否根据规则生成新的采购申请单据,如果生成则修改状态为 approved
origins = list(set([procurement[0].origin for procurement in procurements])) origins = list(set([procurement[0].origin for procurement in procurements]))
res = super(StockRule, self)._run_buy(procurements)
# origins = list(set([procurement[0].origin for procurement in procurements]))
for origin in origins: for origin in origins:
pr_ids = self.env["purchase.request"].sudo().search( pr_ids = self.env["purchase.request"].sudo().search(
[('origin', 'like', origin), ('rule_new_add', '=', True), ('state', '=', 'draft')]) [('origin', 'like', origin), ('rule_new_add', '=', True), ('state', '=', 'draft')])

View File

@@ -35,7 +35,6 @@
], ],
'web.assets_backend': [ 'web.assets_backend': [
'sf_base/static/src/scss/*.scss', 'sf_base/static/src/scss/*.scss',
'sf_base/static/src/js/*.js',
], ],
}, },

View File

@@ -67,6 +67,52 @@ class BasicParametersFixture(models.Model):
mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2)) mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2))
centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2)) centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2))
# ‘磁吸托盘’ 字段
magnet_tray_length = fields.Float('磁吸托盘长度(mm)', digits=(16, 2))
magnet_tray_width = fields.Float('磁吸托盘宽度(mm)', digits=(16, 2))
magnet_tray_height = fields.Float('磁吸托盘厚度(mm)', digits=(16, 2))
magnet_tray_diameter = fields.Float('磁吸托盘直径(mm)', digits=(16, 2))
magnet_tray_weight = fields.Float('磁吸托盘重量(kg)', digits=(16, 2))
magnet_max_adsorp_length = fields.Float('磁吸托盘最大吸附长度(mm)', digits=(16, 2))
magnet_max_adsorp_width = fields.Float('磁吸托盘最大吸附宽度(mm)', digits=(16, 2))
magnet_max_adsorp_height = fields.Float('磁吸托盘最大吸附厚度(mm)', digits=(16, 2))
magnet_max_adsorp_diameter = fields.Float('磁吸托盘最大吸附直径(mm)', digits=(16, 2))
magnet_max_adsorp_force = fields.Float('磁吸托盘最大吸附力(N)', digits=(16, 2))
magnet_unlocking_method = fields.Selection(
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
string='磁吸托盘锁紧方式'
)
magnet_flatness = fields.Char('磁吸托盘平面精度(mm)', size=20)
magnet_max_load = fields.Float('磁吸托盘最大负载(kg)', digits=(16, 2))
# ‘气吸托盘’ 字段
air_tray_length = fields.Float('气吸托盘长度(mm)', digits=(16, 2))
air_tray_width = fields.Float('气吸托盘宽度(mm)', digits=(16, 2))
air_tray_height = fields.Float('气吸托盘高度(mm)', digits=(16, 2))
air_tray_diameter = fields.Float('气吸托盘直径(mm)', digits=(16, 2))
air_tray_weight = fields.Float('气吸托盘重量(kg)', digits=(16, 2))
air_max_adsorp_length = fields.Float('气吸托盘最大吸附长度(mm)', digits=(16, 2))
air_max_adsorp_width = fields.Float('气吸托盘最大吸附宽度(mm)', digits=(16, 2))
air_max_adsorp_height = fields.Float('气吸托盘最大吸附厚度(mm)', digits=(16, 2))
air_max_adsorp_diameter = fields.Float('气吸托盘最大吸附直径(mm)', digits=(16, 2))
air_max_adsorp_force = fields.Float('气吸托盘最大吸附力(N)', digits=(16, 2))
air_unlocking_method = fields.Selection(
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
string='气吸托盘锁紧方式'
)
air_flatness = fields.Char('气吸托盘平面精度(mm)', size=20)
air_max_load = fields.Float('气吸托盘最大负载(kg)', digits=(16, 2))
air_boolean_chip_blowing_function = fields.Boolean('气吸托盘是否有吹屑功能')
air_way_to_install = fields.Selection(
[('接口式', '接口式'), ('螺栓固定', '螺栓固定'), ('磁吸式', '磁吸式'), ('其他', '其他')],
string='气吸托盘安装方式'
)
code = fields.Char('编码') code = fields.Char('编码')
active = fields.Boolean('有效', default=True) active = fields.Boolean('有效', default=True)
@@ -85,6 +131,10 @@ class BasicParametersFixture(models.Model):
return self._json_adapter_board_fixture_param(fixture_materials_data) return self._json_adapter_board_fixture_param(fixture_materials_data)
elif fixture_materials_name == '三爪卡盘': elif fixture_materials_name == '三爪卡盘':
return self._json_scroll_chuck_param(fixture_materials_data) return self._json_scroll_chuck_param(fixture_materials_data)
elif fixture_materials_name == '磁吸托盘':
return self._json_magnet_tray_param(fixture_materials_data)
elif fixture_materials_name == '气吸托盘':
return self._json_air_tray_param(fixture_materials_data)
return {} return {}
def _json_zero_chuck_param(self, obj): def _json_zero_chuck_param(self, obj):
@@ -284,3 +334,57 @@ class BasicParametersFixture(models.Model):
'centering_diameter': obj['centering_diameter'], 'centering_diameter': obj['centering_diameter'],
'type_of_drive': obj['type_of_drive'], 'type_of_drive': obj['type_of_drive'],
'active': obj['active']} 'active': obj['active']}
def _json_magnet_tray_param(self, obj):
"""磁吸托盘将data数据转换成list数据"""
return {
'code': obj['code'],
'fixture_model_id': self.env['sf.fixture.model'].sudo().search(
[('code', '=', obj.get('fixture_model_code'))]).id,
'name': obj['name'],
'length': obj['length'],
'width': obj['width'],
'height': obj['height'],
'diameter': obj['diameter'],
'weight': obj['weight'],
'max_adsorp_length': obj['max_adsorp_length'],
'max_adsorp_width': obj['max_adsorp_width'],
'max_adsorp_height': obj['max_adsorp_height'],
'max_adsorp_diameter': obj.get('max_adsorp_diameter'),
'max_adsorp_force': obj['max_adsorp_force'],
'flatness': obj.get('flatness'),
'max_load': obj.get('max_load'),
'unlocking_method': obj.get('unlocking_method'),
'materials_model_id': self.env['sf.materials.model'].sudo().search(
[('materials_no', '=', obj['materials_model_id']), ('active', '=', True)]
).id if obj.get('materials_model_id') else False,
'active': obj.get('active', True),
}
def _json_air_tray_param(self, obj):
"""气吸托盘将data数据转换成list数据"""
return {
'code': obj['code'],
'fixture_model_id': self.env['sf.fixture.model'].sudo().search(
[('code', '=', obj.get('fixture_model_code'))]).id,
'name': obj['name'],
'length': obj['length'],
'width': obj['width'],
'height': obj['height'],
'diameter': obj['diameter'],
'weight': obj['weight'],
'max_adsorp_length': obj['max_adsorp_length'],
'max_adsorp_width': obj['max_adsorp_width'],
'max_adsorp_height': obj['max_adsorp_height'],
'max_adsorp_diameter': obj.get('max_adsorp_diameter'),
'max_adsorp_force': obj['max_adsorp_force'],
'flatness': obj.get('flatness'),
'max_load': obj.get('max_load'),
'unlocking_method': obj.get('unlocking_method'),
'boolean_chip_blowing_function': obj.get('blowing_function', False),
'way_to_install': obj.get('way_to_install'),
'materials_model_id': self.env['sf.materials.model'].sudo().search(
[('materials_no', '=', obj['materials_model_id']), ('active', '=', True)]
).id if obj.get('materials_model_id') else False,
'active': obj.get('active', True),
}

View File

@@ -42,6 +42,7 @@ class MrsMaterialModel(models.Model):
materials_num = fields.Char("编码号") materials_num = fields.Char("编码号")
name = fields.Char('型号名') name = fields.Char('型号名')
need_h = fields.Boolean("热处理", default="false") need_h = fields.Boolean("热处理", default="false")
need_m = fields.Boolean("是否磁吸", default="false")
mf_materia_post = fields.Char("热处理后密度") mf_materia_post = fields.Char("热处理后密度")
density = fields.Float("密度(kg/m³)") density = fields.Float("密度(kg/m³)")
materials_id = fields.Many2one('sf.production.materials', "材料名") materials_id = fields.Many2one('sf.production.materials', "材料名")

View File

@@ -35,6 +35,7 @@ class FixtureModel(models.Model):
glb_url = fields.Char(string="图片") glb_url = fields.Char(string="图片")
status = fields.Boolean('状态') status = fields.Boolean('状态')
active = fields.Boolean('有效', default=False) active = fields.Boolean('有效', default=False)
code = fields.Char(string='编码', readonly=True)
zero_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', zero_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
string='零点卡盘基本参数') string='零点卡盘基本参数')
@@ -46,11 +47,14 @@ class FixtureModel(models.Model):
string='虎钳夹具基本参数') string='虎钳夹具基本参数')
magnet_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', magnet_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
string='磁吸夹具基本参数') string='磁吸夹具基本参数')
magnet_tray_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
string='磁吸托盘基本参数')
adapter_board_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', adapter_board_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
string='转接板(锁板)夹具基本参数') string='转接板(锁板)夹具基本参数')
scroll_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', scroll_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
string='三爪卡盘基本参数') string='三爪卡盘基本参数')
code = fields.Char(string='编码', readonly=True) air_tray_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
string='气吸托盘基本参数')
# def _get_code(self, fixture_model_type_code): # def _get_code(self, fixture_model_type_code):
# fixture_model = self.env['sf.fixture.model'].sudo().search( # fixture_model = self.env['sf.fixture.model'].sudo().search(

View File

@@ -1,62 +0,0 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { barcodeGenericHandlers } from '@barcodes/barcode_handlers';
import { patch } from "@web/core/utils/patch";
// 定义新的 clickOnButton 函数
function customClickOnButton(selector) {
console.log("This is the custom clickOnButton function!");
const buttons = document.body.querySelectorAll(selector);
let length = buttons.length;
if (length > 0) {
buttons[length - 1].click();
} else {
console.warn(`Button with selector ${selector} not found`);
}
}
patch(barcodeGenericHandlers, "start", {
start(env, { ui, barcode, notification }) {
// 使用新定义的 clickOnButton 函数
const COMMANDS = {
"O-CMD.EDIT": () => customClickOnButton(".o_form_button_edit"),
"O-CMD.DISCARD": () => customClickOnButton(".o_form_button_cancel"),
"O-CMD.SAVE": () => customClickOnButton(".o_form_button_save"),
"O-CMD.PREV": () => customClickOnButton(".o_pager_previous"),
"O-CMD.NEXT": () => customClickOnButton(".o_pager_next"),
"O-CMD.PAGER-FIRST": () => updatePager("first"),
"O-CMD.PAGER-LAST": () => updatePager("last"),
"O-CMD.CONFIRM": () => customClickOnButton(".jikimo_button_confirm"),
"O-CMD.FLUSHED": () => customClickOnButton(".jikimo_button_flushed"),
};
barcode.bus.addEventListener("barcode_scanned", (ev) => {
const barcode = ev.detail.barcode;
if (barcode.startsWith("O-BTN.")) {
let targets = [];
try {
targets = getVisibleElements(ui.activeElement, `[barcode_trigger=${barcode.slice(6)}]`);
} catch (_e) {
console.warn(`Barcode '${barcode}' is not valid`);
}
for (let elem of targets) {
elem.click();
}
}
if (barcode.startsWith("O-CMD.")) {
const fn = COMMANDS[barcode];
if (fn) {
fn();
} else {
notification.add(env._t("Barcode: ") + `'${barcode}'`, {
title: env._t("Unknown barcode command"),
type: "danger"
});
}
}
});
}
})

View File

@@ -1,42 +0,0 @@
/** @odoo-module **/
import { registry } from '@web/core/registry';
import { formView } from '@web/views/form/form_view';
import { FormController } from '@web/views/form/form_controller';
import { listView } from '@web/views/list/list_view';
import { ListController } from '@web/views/list/list_controller'
import { onRendered, onMounted } from "@odoo/owl";
export class RemoveFocusFormController extends FormController {
setup() {
super.setup();
onMounted(() => {
this.__owl__.bdom.el.querySelectorAll(':focus').forEach(element => element.blur());
})
}
}
registry.category('views').add('remove_focus_form_view', {
...formView,
Controller: RemoveFocusFormController,
});
export class RemoveFocusListController extends ListController {
setup() {
super.setup();
onMounted(() => {
this.__owl__.bdom.el.querySelectorAll(':focus').forEach(element => element.blur());
})
}
}
registry.category('views').add('remove_focus_list_view', {
...listView,
Controller: RemoveFocusListController,
});

View File

@@ -263,6 +263,7 @@
<field name="materials_no" readonly="1" force_save="1"/> <field name="materials_no" readonly="1" force_save="1"/>
<field name="gain_way" required="0"/> <field name="gain_way" required="0"/>
<field name="density" readonly="1" required="1" class="custom_required"/> <field name="density" readonly="1" required="1" class="custom_required"/>
<field name="need_m" default="false" readonly="1"/>
</group> </group>
<group> <group>
<field name="rough_machining" required="1"/> <field name="rough_machining" required="1"/>
@@ -306,6 +307,7 @@
<field name="tensile_strength"/> <field name="tensile_strength"/>
<field name="hardness" optional="show"/> <field name="hardness" optional="show"/>
<field name="need_h"/> <field name="need_h"/>
<field name="need_m"/>
<field name="apply" widget="many2many_tags" optional="show"/> <field name="apply" widget="many2many_tags" optional="show"/>
<field name="density" optional="show"/> <field name="density" optional="show"/>
<field name="rough_machining" optional="hide"/> <field name="rough_machining" optional="hide"/>
@@ -352,6 +354,7 @@
<field name="materials_no"/> <field name="materials_no"/>
<field name="name"/> <field name="name"/>
<field name="need_h"/> <field name="need_h"/>
<field name="need_m"/>
<field name="mf_materia_post"/> <field name="mf_materia_post"/>
<field name="density"/> <field name="density"/>
<field name='materials_id' default="default" invisible="1"/> <field name='materials_id' default="default" invisible="1"/>

View File

@@ -328,6 +328,52 @@
<field name="type_of_drive"/> <field name="type_of_drive"/>
</tree> </tree>
</field> </field>
<field name="air_tray_ids"
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}">
<tree editable="bottom" class="center" delete="0">
<field name="code" invisible="1"/>
<field name="name"/>
<field name="length"/>
<field name="width"/>
<field name="height"/>
<field name="diameter"/>
<field name="weight" string="重量(kg)"/>
<field name="max_adsorp_length"/>
<field name="max_adsorp_width"/>
<field name="max_adsorp_height"/>
<field name="max_adsorp_diameter"/>
<field name="max_adsorp_force"/>
<field name="flatness"/>
<field name="max_load"/>
<field name="unlocking_method"/>
<field name="boolean_chip_blowing_function"/>
<field name="way_to_install"/>
<field name="materials_model_id" options="{'no_create': True}" placeholder="请选择"/>
<field name="active" invisible="1"/>
</tree>
</field>
<field name="magnet_tray_ids"
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}">
<tree editable="bottom" class="center" delete="0">
<field name="code" invisible="1"/>
<field name="name"/>
<field name="length"/>
<field name="width"/>
<field name="height"/>
<field name="diameter"/>
<field name="weight" string="重量(kg)"/>
<field name="max_adsorp_length"/>
<field name="max_adsorp_width"/>
<field name="max_adsorp_height"/>
<field name="max_adsorp_diameter"/>
<field name="max_adsorp_force"/>
<field name="flatness"/>
<field name="max_load"/>
<field name="unlocking_method"/>
<field name="materials_model_id" options="{'no_create': True}" placeholder="请选择"/>
<field name="active" invisible="1"/>
</tree>
</field>
<field name="scroll_chuck_ids" <field name="scroll_chuck_ids"
attrs="{'invisible': [('fixture_material_type', '!=', '三爪卡盘')]}"> attrs="{'invisible': [('fixture_material_type', '!=', '三爪卡盘')]}">
<tree editable="bottom" class="center" delete="0"> <tree editable="bottom" class="center" delete="0">

View File

@@ -2,7 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details. # Part of Odoo. See LICENSE file for full copyright and licensing details.
{ {
'name': '机企猫智能工厂 需求计划', 'name': '机企猫智能工厂 需求计划',
'version': '1.0', 'version': '1.1',
'summary': '智能工厂计划管理', 'summary': '智能工厂计划管理',
'sequence': 1, 'sequence': 1,
'description': """ 'description': """
@@ -10,11 +10,17 @@
""", """,
'category': 'sf', 'category': 'sf',
'website': 'https://www.sf.jikimo.com', 'website': 'https://www.sf.jikimo.com',
'depends': ['sf_plan', 'jikimo_printing'], 'depends': ['sf_plan','jikimo_printing'],
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'data/stock_route_group.xml',
'views/demand_plan_info.xml',
'views/demand_plan.xml', 'views/demand_plan.xml',
'views/stock_route.xml',
'views/sale_order_views.xml',
'wizard/sf_demand_plan_print_wizard_view.xml', 'wizard/sf_demand_plan_print_wizard_view.xml',
'wizard/sf_release_plan_wizard_views.xml',
'views/menu_view.xml',
], ],
'demo': [ 'demo': [
], ],
@@ -23,6 +29,8 @@
], ],
'web.assets_backend': [ 'web.assets_backend': [
'sf_demand_plan/static/src/scss/style.css', 'sf_demand_plan/static/src/scss/style.css',
'sf_demand_plan/static/src/js/print_demand.js',
'sf_demand_plan/static/src/js/custom_button.js',
] ]
}, },
'license': 'LGPL-3', 'license': 'LGPL-3',

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data noupdate="0">
<record id="stock_route_group_automation_sf" model="stock.route.group">
<field name="name">自动化产线加工</field>
<field name="code">automation</field>
</record>
<record id="stock_route_group_manual_sf" model="stock.route.group">
<field name="name">人工线下加工</field>
<field name="code">manual</field>
</record>
<record id="stock_route_group_purchase_sf" model="stock.route.group">
<field name="name">外购</field>
<field name="code">purchase</field>
</record>
<record id="stock_route_group_outsourcing_sf" model="stock.route.group">
<field name="name">委外加工</field>
<field name="code">outsourcing</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,25 @@
# migrations/1.1.0/post-migrate.py
import os
import csv
import logging
from odoo import api, SUPERUSER_ID
_logger = logging.getLogger(__name__)
def migrate(cr, version):
# 获取环境
env = api.Environment(cr, SUPERUSER_ID, {})
ProductionLine = env['sf.production.demand.plan']
DemandPlan = env['sf.demand.plan']
lines = ProductionLine.search([('demand_plan_id', '=', False)])
for line in lines:
vals = {
'sale_order_id': line.sale_order_id.id,
'sale_order_line_id': line.sale_order_line_id.id,
'line_ids': line.ids
}
new_plan = DemandPlan.create(vals)
line.write({'demand_plan_id': new_plan.id})

View File

@@ -1,4 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from . import sf_demand_plan
from . import sf_production_demand_plan from . import sf_production_demand_plan
from . import sale_order from . import sale_order
from . import stock_route
from . import mrp_bom
from . import mrp_production
from . import stock_rule
from . import purchase_request
from . import purchase_order

View File

@@ -0,0 +1,29 @@
from odoo import models, fields
class MrpBom(models.Model):
_inherit = 'mrp.bom'
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品后再次进行创建bom
def bom_create(self, product, bom_type, product_type, code=None):
bom_id = self.env['mrp.bom'].create({
'product_tmpl_id': product.product_tmpl_id.id,
'type': bom_type,
# 'subcontractor_id': '' or subcontract.partner_id.id,
'product_qty': 1,
'product_uom_id': 1,
'code': code
})
if bom_type == 'subcontract' and product_type is not False:
subcontract = self.get_supplier(product.materials_type_id)
bom_id.subcontractor_id = subcontract.partner_id.id
return bom_id
def name_get(self):
"""重写name_get方法只显示BOM编码"""
result = []
for record in self:
# 只显示BOM编码如果编码为空则显示产品名称
display_name = record.code or record.product_tmpl_id.name or f'BOM-{record.id}'
result.append((record.id, display_name))
return result

View File

@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api
class MrpProduction(models.Model):
_inherit = 'mrp.production'
demand_plan_line_id = fields.Many2one(comodel_name="sf.production.demand.plan",
string="需求计划明细", readonly=True)
@api.depends('demand_plan_line_id')
def _compute_production_type(self):
for production in self:
if production.demand_plan_line_id.supply_method == 'automation':
production.production_type = '自动化产线加工'
elif production.demand_plan_line_id.supply_method == 'manual':
production.production_type = '人工线下加工'
else:
production.production_type = None
def _get_purchase_request(self):
"""获取跟制造订单相关的采购申请单(根据采购申请单行项目的产品匹配)"""
pr_ids = self.env['purchase.request'].sudo().search(
[('line_ids.demand_plan_line_id', 'in', self.demand_plan_line_id.ids)])
return pr_ids
@api.depends('procurement_group_id', 'procurement_group_id.stock_move_ids.group_id')
def _compute_picking_ids(self):
for order in self:
if order.product_id.product_tmpl_id.single_manufacturing == True and not order.is_remanufacture:
first_order = self.env['mrp.production'].search(
[('demand_plan_line_id', '=', order.demand_plan_line_id.id), ('product_id', '=', order.product_id.id)], limit=1, order='id asc')
order.picking_ids = self.env['stock.picking'].search([
('group_id', '=', first_order.procurement_group_id.id), ('group_id', '!=', False),
])
order.delivery_count = len(first_order.picking_ids)
else:
order.picking_ids = self.env['stock.picking'].search([
('group_id', '=', order.procurement_group_id.id), ('group_id', '!=', False),
])
order.delivery_count = len(order.picking_ids)

View File

@@ -0,0 +1,48 @@
from odoo import api, fields, models, _
from odoo.tools import float_compare
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
def button_confirm(self):
if self.order_line[0].demand_plan_line_id:
self = self.with_context(
demand_plan_line_id=self.order_line[0].demand_plan_line_id.id
)
res = super(PurchaseOrder, self).button_confirm()
return res
@api.depends('origin')
def _compute_purchase_type(self):
for purchase in self:
if purchase.order_line[0].product_id.categ_id.name == '坯料':
if purchase.order_line[0].product_id.materials_type_id.gain_way == '外协':
purchase.purchase_type = 'outsourcing'
else:
if purchase.order_line[0].demand_plan_line_id.supply_method == 'outsourcing':
purchase.purchase_type = 'outsourcing'
elif purchase.order_line[0].demand_plan_line_id.supply_method == 'purchase':
purchase.purchase_type = 'outside'
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
demand_plan_line_id = fields.Many2one(comodel_name="sf.production.demand.plan",
string="需求计划明细", readonly=True)
@api.model
def create(self, vals):
res = super(PurchaseOrderLine, self).create(vals)
if not res.demand_plan_line_id and res.order_id.origin:
origin = [origin.replace(' ', '') for origin in res.order_id.origin.split(',')]
if self.env.context.get('demand_plan_line_id'):
res.demand_plan_line_id = self.env.context.get('demand_plan_line_id')
elif 'MO' in res.order_id.origin:
# 原单据是制造订单
mp_ids = self.env['mrp.production'].sudo().search([('name', 'in', origin)])
if mp_ids:
res.demand_plan_line_id = mp_ids[0].demand_plan_line_id.id
return res

View File

@@ -0,0 +1,35 @@
from odoo import models, fields, api, _
from odoo.exceptions import UserError, ValidationError
class PurchaseRequestLine(models.Model):
_inherit = 'purchase.request.line'
_description = '采购申请明细'
supply_method = fields.Selection([
('automation', "自动化产线加工"),
('manual', "人工线下加工"),
('purchase', "外购"),
('outsourcing', "委外加工"),
], string='供货方式', readonly=True)
demand_plan_line_id = fields.Many2one(comodel_name="sf.production.demand.plan",
string="需求计划明细", readonly=True)
@api.depends('demand_plan_line_id')
def _compute_supply_method(self):
for prl in self:
if prl.demand_plan_line_id:
prl.supply_method = prl.demand_plan_line_id.supply_method
else:
prl.supply_method = None
class PurchaseRequestLineMakePurchaseOrder(models.TransientModel):
_inherit = "purchase.request.line.make.purchase.order"
@api.model
def _prepare_purchase_order_line(self, po, item):
ret = super(PurchaseRequestLineMakePurchaseOrder, self)._prepare_purchase_order_line(po, item)
ret['demand_plan_line_id'] = item.line_id.demand_plan_line_id.id
return ret

View File

@@ -10,20 +10,65 @@ class ReSaleOrder(models.Model):
string='与此销售订单相关联的制造订单', string='与此销售订单相关联的制造订单',
groups='mrp.group_mrp_user', store=True) groups='mrp.group_mrp_user', store=True)
demand_plan_ids = fields.Many2many(comodel_name="sf.demand.plan",
string="需求计划", readonly=True)
demand_plan_count = fields.Integer(
string="需求计划生成计数",
compute='_compute_demand_plan_count'
)
@api.depends('demand_plan_ids.line_ids.status')
def _compute_purchase_request_count(self):
for so in self:
pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', so.name)])
if pr_ids:
so.purchase_request_purchase_order_count = len(pr_ids)
else:
so.purchase_request_purchase_order_count = 0
@api.depends('demand_plan_ids.line_ids')
def _compute_demand_plan_count(self):
for line in self:
demand_plan = self.env['sf.production.demand.plan'].sudo().search([('sale_order_id', '=', line.id)])
line.demand_plan_count = len(demand_plan)
def sale_order_create_line(self, product, item): def sale_order_create_line(self, product, item):
ret = super(ReSaleOrder, self).sale_order_create_line(product, item) ret = super(ReSaleOrder, self).sale_order_create_line(product, item)
vals = { vals = {
'sale_order_id': ret.order_id.id, 'sale_order_id': ret.order_id.id,
'sale_order_line_id': ret.id, 'sale_order_line_id': ret.id,
} }
demand_plan_info = self.env['sf.demand.plan'].sudo().create(vals)
vals.update({'demand_plan_id': demand_plan_info.id, 'plan_uom_qty': ret.product_uom_qty,
'new_supply_method': 'custom_made', 'custom_made_type': 'manual'})
demand_plan = self.env['sf.production.demand.plan'].sudo().create(vals) demand_plan = self.env['sf.production.demand.plan'].sudo().create(vals)
demand_plan_info.write({'line_ids': demand_plan.ids})
if demand_plan.product_id.machining_drawings_name: if demand_plan.product_id.machining_drawings_name:
filename_url = demand_plan.product_id.machining_drawings_name.rsplit('.', 1)[0] filename_url = demand_plan.product_id.machining_drawings_name.rsplit('.', 1)[0]
wizard_vals = { wizard_vals = {
'demand_plan_id': demand_plan.id,
'model_id': demand_plan.model_id, 'model_id': demand_plan.model_id,
'filename_url': filename_url, 'filename_url': filename_url,
'machining_drawings': product.machining_drawings,
'type': '1', 'type': '1',
} }
self.env['sf.demand.plan.print.wizard'].sudo().create(wizard_vals) self.env['sf.demand.plan.print.wizard'].sudo().create(wizard_vals)
ret.order_id.demand_plan_ids = [(4, demand_plan_info.id)]
return ret return ret
def confirm_to_supply_method(self):
self.state = 'sale'
for line in self.order_line:
if line.product_id.auto_machining:
line.supply_method = 'automation'
def action_view_demand_plan(self):
self.ensure_one()
demand_plan_ids = self.env['sf.production.demand.plan'].sudo().search([('sale_order_id', '=', self.id)]).ids
return {
'res_model': 'sf.production.demand.plan',
'type': 'ir.actions.act_window',
'name': _("需求计划"),
'domain': [('id', 'in', demand_plan_ids)],
'view_mode': 'tree',
}

View File

@@ -0,0 +1,265 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
from odoo.tools import float_compare
from odoo.exceptions import ValidationError
import re
class SfDemandPlan(models.Model):
_name = 'sf.demand.plan'
_description = 'sf_demand_plan'
state = fields.Selection([
('10', '待工艺设计'),
('30', '部分下达'),
('40', '已下达'),
('50', '取消'),
], string='状态', default='10', compute='_compute_state', store=True)
line_ids = fields.One2many(comodel_name='sf.production.demand.plan',
inverse_name='demand_plan_id', string="需求计划", copy=True)
sale_order_id = fields.Many2one(comodel_name="sale.order",
string="销售订单", readonly=True)
sale_order_line_id = fields.Many2one(comodel_name="sale.order.line",
string="销售订单明细", readonly=True)
product_id = fields.Many2one(
comodel_name='product.product',
related='sale_order_line_id.product_id',
string='产品', store=True, index=True)
part_name = fields.Char('零件名称', related='product_id.part_name')
part_number = fields.Char('零件图号', compute='_compute_part_number', store=True)
materials_id = fields.Char('材料', compute='_compute_materials_id', store=True)
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类',
related='product_id.blank_type')
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型',
related='product_id.blank_precision')
manual_quotation = fields.Boolean('人工编程', related='product_id.manual_quotation', default=False)
embryo_long = fields.Char('坯料尺寸(mm)', compute='_compute_embryo_long', store=True)
is_incoming_material = fields.Boolean('客供料', related='sale_order_line_id.is_incoming_material', store=True)
pending_qty = fields.Float(
string="待计划",
compute='_compute_pending_qty', store=True)
planned_qty = fields.Float(
string="已计划",
compute='_compute_planned_qty', store=True)
model_id = fields.Char('模型ID', related='product_id.model_id')
customer_name = fields.Char('客户', related='sale_order_id.customer_name')
product_uom_qty = fields.Float(
string="需求数量",
related='sale_order_line_id.product_uom_qty', store=True)
deadline_of_delivery = fields.Date('客户交期', related='sale_order_line_id.delivery_end_date', store=True)
contract_date = fields.Date('合同日期', related='sale_order_id.contract_date')
contract_code = fields.Char('合同号', related='sale_order_id.contract_code', store=True)
model_process_parameters_ids = fields.Many2many('sf.production.process.parameter',
'demand_plan_process_parameter_rel',
string='表面工艺',
compute='_compute_model_process_parameters_ids'
, store=True
)
model_machining_precision = fields.Selection(related='product_id.model_machining_precision', string='精度')
inventory_quantity_auto_apply = fields.Float(
string="成品库存",
compute='_compute_inventory_quantity_auto_apply'
)
priority = fields.Selection([
('1', '紧急'),
('2', ''),
('3', ''),
('4', ''),
], string='优先级', default='3')
overdelivery_allowed = fields.Boolean('可超量发货', default=False)
hide_button_release_plan = fields.Boolean(
string='显示下达计划按钮',
compute='_compute_hide_button_release_plan',
default=False
)
readonly_custom_made_type = fields.Boolean(
string='字段自制类型只读',
compute='_compute_readonly_custom_made_type',
default=False
)
demand_plan_number = fields.Char('需求计划号', compute='_compute_demand_plan_number', readonly=True, store=True)
origin = fields.Char('来源', related='sale_order_id.name', readonly=True, store=True)
@api.depends('product_id.part_number', 'product_id.model_name')
def _compute_part_number(self):
for line in self:
if line.product_id:
if line.product_id.part_number:
line.part_number = line.product_id.part_number
else:
if line.product_id.model_name:
line.part_number = line.product_id.model_name.rsplit('.', 1)[0]
else:
line.part_number = None
@api.depends('product_id.materials_id')
def _compute_materials_id(self):
for line in self:
if line.product_id:
line.materials_id = f"{line.product_id.materials_id.name}/{line.product_id.materials_type_id.name}"
else:
line.materials_id = None
@api.depends('product_id.model_long', 'product_id.model_width', 'product_id.model_height')
def _compute_embryo_long(self):
for line in self:
if line.product_id:
if line.product_id.blank_type == '圆料':
line.embryo_long = f"Ø{round(line.product_id.model_width, 3)}*{round(line.product_id.model_long, 3)}"
else:
line.embryo_long = f"{round(line.product_id.model_long, 3)}*{round(line.product_id.model_width, 3)}*{round(line.product_id.model_height, 3)}"
else:
line.embryo_long = None
@api.depends('product_id.model_process_parameters_ids')
def _compute_model_process_parameters_ids(self):
for line in self:
if line.product_id and line.product_id.model_process_parameters_ids:
line.model_process_parameters_ids = [(6, 0, line.product_id.model_process_parameters_ids.ids)]
else:
line.model_process_parameters_ids = [(5, 0, 0)]
def _compute_inventory_quantity_auto_apply(self):
location_id = self.env['stock.location'].search([('name', '=', '成品存货区')], limit=1).id
product_ids = self.mapped('product_id').ids
if product_ids:
quant_data = self.env['stock.quant'].read_group(
domain=[
('product_id', 'in', product_ids),
('location_id', '=', location_id)
],
fields=['product_id', 'inventory_quantity_auto_apply'],
groupby=['product_id']
)
quantity_map = {item['product_id'][0]: item['inventory_quantity_auto_apply'] for item in quant_data}
else:
quantity_map = {}
for line in self:
if line.product_id:
line.inventory_quantity_auto_apply = quantity_map.get(line.product_id.id, 0.0)
else:
line.inventory_quantity_auto_apply = 0.0
@api.depends('product_uom_qty', 'line_ids.plan_uom_qty')
def _compute_pending_qty(self):
for line in self:
sum_plan_uom_qty = sum(line.line_ids.mapped('plan_uom_qty'))
pending_qty = line.product_uom_qty - sum_plan_uom_qty
if float_compare(pending_qty, 0,
precision_rounding=line.product_id.uom_id.rounding) == -1:
line.pending_qty = 0
else:
line.pending_qty = pending_qty
@api.depends('line_ids.plan_uom_qty')
def _compute_planned_qty(self):
for line in self:
line.planned_qty = sum(line.line_ids.mapped('plan_uom_qty'))
@api.depends('line_ids.status')
def _compute_hide_button_release_plan(self):
for line in self:
line.hide_button_release_plan = bool(line.line_ids.filtered(
lambda p: p.status == '30'))
@api.depends('line_ids.status', 'sale_order_id.state')
def _compute_state(self):
for line in self:
status_line = line.line_ids.filtered(lambda p: p.status == '60')
if not line.line_ids:
line.state = '10'
elif line.sale_order_id.state == 'cancel':
line.state = '50'
line.line_ids.status = '100'
elif len(line.line_ids) == len(status_line):
line.state = '40'
elif bool(status_line):
line.state = '30'
else:
line.state = '10'
@api.depends('line_ids.status')
def _compute_readonly_custom_made_type(self):
for line in self:
production_demand_plan = line.line_ids.filtered(
lambda p: p.status in ('50', '60') and p.new_supply_method == 'custom_made')
line.readonly_custom_made_type = bool(production_demand_plan)
@api.constrains('line_ids')
def check_line_ids(self):
for item in self:
if not item.line_ids:
raise ValidationError('计划不能为空!')
def write(self, vals):
res = super(SfDemandPlan, self).write(vals)
if 'line_ids' in vals:
for line in self.line_ids:
if not line.sale_order_id:
line.sale_order_id = self.sale_order_id
if not line.sale_order_line_id:
line.sale_order_line_id = self.sale_order_line_id
return res
def name_get(self):
result = []
for plan in self:
result.append((plan.id, plan.demand_plan_number))
return result
def button_production_release_plan(self):
line_ids = self.line_ids.filtered(lambda p: p.status == '30')
sum_product_uom_qty = sum(line_ids.mapped('plan_uom_qty'))
customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers')
check_overdelivery_allowed = False
for line in line_ids:
if line.location_id.id == customer_location_id:
if not self.overdelivery_allowed:
if float_compare(sum_product_uom_qty, self.product_uom_qty,
precision_rounding=line.product_id.uom_id.rounding) == 1:
check_overdelivery_allowed = True
if check_overdelivery_allowed:
raise ValidationError(f"已禁止向合作伙伴/客户超量发货,请更换“补货原因”或将“可超量发货”设置为“是”。")
elif float_compare(sum_product_uom_qty, self.product_uom_qty,
precision_rounding=self.product_id.uom_id.rounding) == 1:
return {
'name': _('需求计划'),
'type': 'ir.actions.act_window',
'views': [(self.env.ref(
'sf_demand_plan.sf_release_plan_wizard_form').id,
'form')],
'res_model': 'sf.release.plan.wizard',
'target': 'new',
'context': {
'default_demand_plan_line_id': line_ids.ids,
'default_release_message': f"您正在下达计划量 {sum_product_uom_qty},需求数量为 {self.product_uom_qty},已超过需求数量,是否继续?",
}}
else:
for demand_plan_line_id in line_ids:
demand_plan_line_id.action_confirm()
# 需求要求取值格式是来源+来源明细行ID,但是来源明细行ID取得就是product_id.name得最后一位所以这里也直接截取product_id.name
@api.depends('product_id.name')
def _compute_demand_plan_number(self):
for line in self:
product_name = line.product_id.name or ''
plan_no = None
if line.product_id:
# 使用正则表达式匹配P-后面的所有字符
match = re.search(r'P-(.*)', product_name)
if match:
plan_no = match.group(1)
line.demand_plan_number = plan_no
else:
line.demand_plan_number = None

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
from odoo import models, fields, api, _
class SfStockRoute(models.Model):
_inherit = 'stock.route'
demand_plan_selectable = fields.Boolean("需求计划行")
stock_route_group_ids = fields.Many2many('stock.route.group', 'route_to_group', string='路线组')
demand_plan_ids = fields.Many2many('sf.production.demand.plan', 'stock_route_demand_plan', 'route_id',
'demand_plan_id', '需求计划', copy=False, compute='_compute_demand_plan_ids',
store=True)
@api.depends('demand_plan_selectable', 'stock_route_group_ids')
def _compute_demand_plan_ids(self):
for sr in self:
if sr.demand_plan_selectable:
stock_route_group = [srg.code for srg in sr.stock_route_group_ids]
demand_plan_ids = self.env['sf.production.demand.plan'].sudo().search(
[('supply_method', 'in', stock_route_group)])
if demand_plan_ids:
sr.demand_plan_ids = demand_plan_ids.ids
continue
sr.demand_plan_ids = None
# def name_get(self):
# res = super().name_get()
# if self.env.context.get('demand_plan_search_stock_route_id'):
# demand_plan_id = self.env['sf.production.demand.plan'].sudo().browse(
# int(self.env.context.get('demand_plan_search_stock_route_id')))
# if demand_plan_id and demand_plan_id.supply_method:
# supply_method = self._set_supply_method(demand_plan_id.supply_method)
# res = [(item[0], f'{item[1]}-{supply_method}') for item in res if len(item) == 2]
# return res
#
# def _set_supply_method(self, supply_method):
# return {
# 'automation': "自动化产线加工",
# 'manual': "人工线下加工",
# 'purchase': "外购",
# 'outsourcing': "委外加工"
# }.get(supply_method)
class SfStockRouteGroup(models.Model):
_name = 'stock.route.group'
_description = '路线组'
name = fields.Char('名称')
code = fields.Char('编码')

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class StockRule(models.Model):
_inherit = 'stock.rule'
def _prepare_mo_vals(self, product_id, product_qty, product_uom, location_id, name, origin, company_id, values,
bom):
res = super()._prepare_mo_vals(product_id, product_qty, product_uom, location_id, name, origin, company_id,
values, bom)
if self.env.context.get('demand_plan_line_id'):
res['demand_plan_line_id'] = self.env.context.get('demand_plan_line_id')
return res
@api.model
def _prepare_purchase_request_line(self, request_id, procurement):
res = super()._prepare_purchase_request_line(request_id, procurement)
if self.env.context.get('demand_plan_line_id'):
res['demand_plan_line_id'] = self.env.context.get('demand_plan_line_id')
return res

View File

@@ -1,6 +1,16 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sf_production_demand_plan,sf.production.demand.plan,model_sf_production_demand_plan,base.group_user,1,0,0,0 access_sf_production_demand_plan,sf.production.demand.plan,model_sf_production_demand_plan,base.group_user,1,0,0,0
access_sf_production_demand_plan_for_dispatch,sf.production.demand.plan for dispatch,model_sf_production_demand_plan,sf_base.group_plan_dispatch,1,1,0,0 access_sf_production_demand_plan_for_dispatch,sf.production.demand.plan for dispatch,model_sf_production_demand_plan,sf_base.group_plan_dispatch,1,1,1,1
access_sf_demand_plan_print_wizard,sf.demand.plan.print.wizard,model_sf_demand_plan_print_wizard,base.group_user,1,0,0,0 access_sf_demand_plan_print_wizard,sf.demand.plan.print.wizard,model_sf_demand_plan_print_wizard,base.group_user,1,0,0,0
access_sf_demand_plan_print_wizard_for_dispatch,sf.demand.plan.print.wizard for dispatch,model_sf_demand_plan_print_wizard,sf_base.group_plan_dispatch,1,1,0,0 access_sf_demand_plan_print_wizard_for_dispatch,sf.demand.plan.print.wizard for dispatch,model_sf_demand_plan_print_wizard,sf_base.group_plan_dispatch,1,1,0,0
access_sf_demand_plan,sf.demand.plan,model_sf_demand_plan,base.group_user,1,0,0,0
access_sf_demand_plan_for_dispatch,sf.demand.plan for dispatch,model_sf_demand_plan,sf_base.group_plan_dispatch,1,1,0,0
access_stock_route_group,stock.route.group,model_stock_route_group,base.group_user,1,0,0,0
access_stock_route_group_dispatch,stock.route.group.dispatch,model_stock_route_group,sf_base.group_plan_dispatch,1,1,0,0
access_sf_release_plan_wizard,sf.release.plan.wizard,model_sf_release_plan_wizard,base.group_user,1,0,0,0
access_sf_release_plan_wizard_for_dispatch,sf.release.plan.wizard for dispatch,model_sf_release_plan_wizard,sf_base.group_plan_dispatch,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_sf_production_demand_plan sf.production.demand.plan model_sf_production_demand_plan base.group_user 1 0 0 0
3 access_sf_production_demand_plan_for_dispatch sf.production.demand.plan for dispatch model_sf_production_demand_plan sf_base.group_plan_dispatch 1 1 0 1 0 1
4 access_sf_demand_plan_print_wizard sf.demand.plan.print.wizard model_sf_demand_plan_print_wizard base.group_user 1 0 0 0
5 access_sf_demand_plan_print_wizard_for_dispatch sf.demand.plan.print.wizard for dispatch model_sf_demand_plan_print_wizard sf_base.group_plan_dispatch 1 1 0 0
6 access_sf_demand_plan sf.demand.plan model_sf_demand_plan base.group_user 1 0 0 0
7 access_sf_demand_plan_for_dispatch sf.demand.plan for dispatch model_sf_demand_plan sf_base.group_plan_dispatch 1 1 0 0
8 access_stock_route_group stock.route.group model_stock_route_group base.group_user 1 0 0 0
9 access_stock_route_group_dispatch stock.route.group.dispatch model_stock_route_group sf_base.group_plan_dispatch 1 1 0 0
10 access_sf_release_plan_wizard sf.release.plan.wizard model_sf_release_plan_wizard base.group_user 1 0 0 0
11 access_sf_release_plan_wizard_for_dispatch sf.release.plan.wizard for dispatch model_sf_release_plan_wizard sf_base.group_plan_dispatch 1 1 1 1
12
13
14
15
16

View File

@@ -0,0 +1,59 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { ListRenderer } from "@web/views/list/list_renderer";
import { useService } from "@web/core/utils/hooks";
import { useEffect } from "@odoo/owl";
export class CustomDemandPlanListRenderer extends ListRenderer {
setup() {
super.setup();
this.orm = useService("orm");
this.notification = useService("notification");
console.log('setup', this.props);
// 监听selection属性的变化
useEffect(() => {
this.updateButtonState();
}, () => [this.props.list.selection]);
}
/**
* 更新按钮状态
*/
async updateButtonState() {
const selectedRecords = this.props.list.selection;
const isStatus30 = selectedRecords.some(record => record.data.status != "30");
const button = $(this.__owl__.parent.bdom.parentEl).find('button[name="button_batch_release_plan"]');
console.log('isStatus30', isStatus30, button);
if (isStatus30) {
// 禁用按钮
button.attr('disabled', true);
} else {
button.attr('disabled', false);
}
}
}
// 使用setTimeout延迟注册避免在模块加载时立即执行
setTimeout(() => {
const registerCustomRenderer = () => {
try {
const listView = registry.category("views").get("list");
if (listView) {
registry.category("views").add("custom_demand_plan_list", {
...listView,
Renderer: CustomDemandPlanListRenderer,
});
console.log("Custom demand plan list renderer registered successfully");
} else {
console.warn("List view not found, retrying...");
// 如果还没找到,再等一段时间
setTimeout(registerCustomRenderer, 1000);
}
} catch (error) {
console.error("Error registering custom renderer:", error);
}
};
registerCustomRenderer();
}, 1000);

View File

@@ -0,0 +1,256 @@
odoo.define('sf_demand.print_demand', function (require) {
"use strict";
var ListController = require('web.ListController');
var ListRenderer = require('web.ListRenderer');
var ListView = require('web.ListView');
var viewRegistry = require('web.view_registry');
var { url } = require("@web/core/utils/urls")
var CustomListRenderer = ListRenderer.extend({
_render: function () {
var self = this;
this.getParent()?.$buttons.hide();
return this._super.apply(this, arguments).then(function () {
if(!self.state.data || !self.state.data.length) return
// 添加图片预览容器到页面左侧
if (!$('.table-image-preview-container').length) {
self.$el.parent().addClass('custom-table-image-container')
self.$el.before(
`<div class="custom-preview-container">
<img class="table-image-preview-container" src="" />
<iframe class="table-image-preview-container" src=""/>
</div>`
);
}
if(!$('.denmand_set').length) {
const checked = self.getParent().radioCheck || 'all'
self.$el.prepend(`
<form class="denmand_set">
<span>更多设置:</span>
<input type="radio" id="male" name="set" value="图纸">
<label for="male">图纸</label>
<input type="radio" id="female" name="set" value="程序单">
<label for="female">程序单</label>
<input type="radio" id="other" name="set" value="all" >
<label for="other">图纸/程序单</label>
</form>
`)
setTimeout(() => {
$(`input[name=set][value=${checked}]`).prop('checked', true)
$('.denmand_set').trigger('click')
}, 100);
self.$el.prepend(`
<div class="print-button-container" style="margin-bottom:10px;">
<button class="btn btn-primary o_print_custom">
<i class="fa fa-print"></i> 打印
</button>
<button class="btn btn-secondary o_cancel_custom">
取消
</button>
</div>
`);
}
});
},
start: function() {
setTimeout(() => {
this.$el.find('.o_data_row').eq(0).trigger('click')
this.getParent().$el?.find('.o_cp_top_right,.o_cp_bottom').hide()
}, 500);
return this._super();
},
events: _.extend({}, ListRenderer.prototype.events, {
'click .o_data_row': '_onCustomRowClick',
'click .o_print_custom': '_onPrintClick',
'click .o_cancel_custom': '_onCancelClick',
'click .denmand_set': '_onDenmandChange',
}),
_onCancelClick() {
this.getParent()?.getParent()?.dialogs.closeAll()
},
_onCustomRowClick: async function (ev) {
var self = this;
var $row = $(ev.currentTarget);
var index = $row.index();
var data = this.state.data[index];
if(data.fileData?.fileUrl) {
} else {
data.fileData = { }
if(data.res_id) {
// 正确获取 ORM 服务的方式
// var orm = this.getParent().getParent().env.services
const key = data.data.type == 1 ? 'machining_drawings' : 'cnc_worksheet'
const attachment = await this._rpc({
model: 'ir.binary',
method: 'attachment_info',
args: [
data.model,
data.res_id,
key
],
})
if (attachment) {
Object.assign(data.fileData, attachment)
this._getTypeInfo(attachment.mimetype, data.fileData)
}
const fileUrl = this.getFileUrl(data.fileData.attachment_type, data, key)
data.fileData.fileUrl = fileUrl
}
}
$('.table-image-preview-container').hide()
if(data.fileData.attachment_type == 'iframe') {
$('iframe.table-image-preview-container').attr('src', decodeURIComponent(data.fileData.fileUrl) ).show()
} else {
$('img.table-image-preview-container').attr('src', data.fileData.fileUrl).show()
}
},
getSelectedIds: function() {
return this.state.data.filter(_ => !_.hide).map(_ => {
return _.data.id
})
},
_onPrintClick(e) {
var print_ids = this.getSelectedIds();
this._rpc({
model: 'sf.demand.plan.print.wizard',
method: 'demand_plan_print',
args: [ print_ids ] ,
// context: this.state.getContext()
}).then((e) => {
this.getParent()?.getParent()?.env.services?.notification.notify( {
type: 'info',
message: e.message,
})
// self.do_notify("成功", "打印任务已发送到打印机");
}).catch(function(error) {
console.error("打印错误:", error);
// self.do_warn("打印失败", error.data.message || "未知错误");
}).finally(e => {
this.getParent().reload()
})
},
_onDenmandChange(e) {
const isChecked = $(e.currentTarget).find('input:checked').val()
this.getParent().radioCheck = isChecked
this.$el.find('tbody').find('.o_data_row').show()
this.state.data.forEach(_ => {
_.hide = false
})
const self = this
if(!isChecked || isChecked == 'all') return
this.$el.find('tbody').children('.o_data_row').each(function() {
if($(this).find('td[name=type]').text() != isChecked) {
const i = $(this).index()
self.state.data[i].hide = true
$(this).hide()
}
})
},
getFileUrl(attachment_type, data, key) {
let fileUrl
switch (attachment_type) {
case 'image':
const timer = +new Date()
fileUrl = url("/web/image", {
model: data.model,
id: data.res_id,
field: key,
unique: '',
timer
});
break;
case 'iframe':
const iframe_file_url = encodeURIComponent(
url("/web/content", {
model: data.model,
id: data.res_id,
field: key,
})
);
fileUrl = `${this.state.attachment_base}?file=${iframe_file_url}`;
case 'unknown':
fileUrl = encodeURIComponent(
url("/web/content", {
model: data.model,
id: data.res_id,
field: key,
})
);
}
return fileUrl
},
_getTypeInfo(type, data) {
switch (type) {
case 'application/pdf':
data.attachment_base = `/web/static/lib/pdfjs/web/viewer.html`;
data.attachment_type = 'iframe'
break;
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
data.attachment_base = `/jikimo_attachment_viewer/static/lib/docxjs/viewer.html`;
data.attachment_type = 'iframe'
break;
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
data.attachment_base = `/jikimo_attachment_viewer/static/lib/exceljs/viewer.html`;
data.attachment_type = 'iframe'
break;
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
data.attachment_base = '';
data.attachment_type = 'unknown'
break;
case 'image/png':
case 'image/jpeg':
case 'image/jpg':
data.attachment_base = ''
data.attachment_type = 'image'
break;
default:
data.attachment_base = ''
data.attachment_type = 'unknown'
break;
}
}
});
var CustomListController = ListController.extend({
// 可以保留或移除,根据是否需要处理自定义事件
// 处理打印操作
// rpc.query({
// model: 'sf.demand.plan.print.wizard',
// method: 'demand_plan_print',
// args: [recordIds]
// }).then(function(result) {
// self.do_notify("成功", "打印任务已发送到打印机");
// // 刷新视图显示最新状态
// self.reload();
// }).catch(function(error) {
// self.do_warn("打印失败", error.data.message || "发生未知错误");
// });
});
var PrintDemand = ListView.extend({
config: _.extend({}, ListView.prototype.config, {
Renderer: CustomListRenderer,
Controller: CustomListController,
}),
});
viewRegistry.add('print_demand', PrintDemand);
return PrintDemand;
});

View File

@@ -9,3 +9,81 @@
.demand_plan_tree .o_list_table_ungrouped { .demand_plan_tree .o_list_table_ungrouped {
min-width: 1900px; min-width: 1900px;
} }
.o_selected_row {
background-color: #e6f7ff !important;
font-weight: bold;
}
.custom-table-image-container {
display: flex;
height: calc(95vh - 254px);
gap: 20px;
position: relative;
th.o_list_record_selector, td.o_list_record_selector{
display: none;
}
.custom-preview-container, .print_demand {
flex: 1;
max-width: 49%;
tbody {
tr:not(.o_data_row) {
display: none;
}
}
tfoot {
display: none;
}
}
.print_demand {
.table-responsive {
width: 100%;
overflow-x: auto!important;
}
}
.custom-preview-container {
background-color: #dadce0;
padding: 20px;
img {
max-width: 100%;
max-height: 100%;
}
iframe {
width: 100%;
height: 100%;
}
}
.o_print_custom, .o_cancel_custom {
position: absolute;
bottom: 20px;
right: 20px;
}
.o_print_custom {
right: 66px;
}
}
.denmand_set {
display: flex;
align-items: center;
height: 50px;
> span {
font-weight: bold;
}
input {
margin-left: 30px;
}
label {
margin-left: 5px;
}
input,label {
cursor: pointer;
}
}
/*.demand_plan_tree th[data-name=planned_start_date] + th::before{*/
/* content: '待执行单据';*/
/* line-height: 38px;*/
/*}*/

View File

@@ -3,31 +3,44 @@
<field name="name">sf.production.demand.plan.tree</field> <field name="name">sf.production.demand.plan.tree</field>
<field name="model">sf.production.demand.plan</field> <field name="model">sf.production.demand.plan</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="需求计划" default_order="sequence desc,create_date desc" editable="bottom" <tree string="需求计划" default_order="sequence desc,id desc" editable="bottom"
class="demand_plan_tree"> class="demand_plan_tree freeze-columns-before-part_number" create="false" delete="false"
js_class="custom_demand_plan_list">
<header> <header>
<button string="打印" name="button_action_print" type="object" <button string="打印" name="button_action_print" type="object"
class="btn-primary"/> class="btn-primary"/>
<button string="下达计划" name="button_batch_release_plan" type="object"
class="btn-primary"
/>
</header> </header>
<field name="sequence" widget="handle"/> <field name="sequence" widget="handle"/>
<field name="id" optional="hide"/> <field name="id" optional="hide"/>
<field name="priority"/>
<field name="status"/> <field name="status"/>
<field name="partner_id"/> <field name="customer_name"/>
<field name="order_remark"/> <field name="order_remark"/>
<field name="glb_url" optional="hide"/> <field name="glb_url" optional="hide"/>
<field name="product_id"/> <field name="product_id"/>
<field name="model_id" optional="hide"/> <field name="model_id" optional="hide"/>
<field name="part_name"/> <field name="part_name"/>
<field name="part_number"/> <field name="part_number"/>
<field name="manual_quotation" optional="hide"/>
<field name="is_incoming_material"/> <field name="is_incoming_material"/>
<field name="supply_method"/> <field name="new_supply_method" attrs="{'readonly': [('status', '!=', '30')]}"/>
<field name="readonly_custom_made_type" invisible="1"/>
<field name="custom_made_type"
attrs="{'readonly': ['|',('status', '!=', '30'),('readonly_custom_made_type', '=', True)],
'required': [('new_supply_method', '=', 'custom_made')]}"/>
<field name="product_uom_qty"/> <field name="product_uom_qty"/>
<field name="plan_uom_qty" attrs="{'readonly': [('status', '!=', '30')]}"/>
<field name="deadline_of_delivery"/> <field name="deadline_of_delivery"/>
<field name="inventory_quantity_auto_apply"/> <field name="inventory_quantity_auto_apply" optional="hide"/>
<field name="qty_delivered"/> <field name="qty_delivered" optional="hide"/>
<field name="qty_to_deliver"/> <field name="qty_to_deliver" optional="hide"/>
<field name="model_long"/> <field name="model_long"/>
<field name="blank_type" optional="hide"/>
<field name="blank_precision"/>
<field name="embryo_long"/>
<field name="unit_number" optional="hide"/>
<field name="materials_id"/> <field name="materials_id"/>
<field name="model_machining_precision"/> <field name="model_machining_precision"/>
<field name="model_process_parameters_ids" widget="many2many_tags"/> <field name="model_process_parameters_ids" widget="many2many_tags"/>
@@ -36,37 +49,49 @@
<field name="sale_order_id" optional="hide"/> <field name="sale_order_id" optional="hide"/>
<field name="sale_order_line_number" optional="hide"/> <field name="sale_order_line_number" optional="hide"/>
<field name="order_state"/> <field name="order_state"/>
<field name="route_id" optional="hide"/> <field name="route_ids" widget="many2many_tags" optional="hide"
context="{'demand_plan_search_stock_route_id': id}"/>
<field name="contract_date"/> <field name="contract_date"/>
<field name="date_order"/> <field name="date_order"/>
<field name="contract_code"/> <field name="contract_code"/>
<field name="plan_remark"/> <field name="plan_remark" attrs="{'readonly': [('status', 'in', ('60','100'))]}"/>
<field name="processing_time"/> <field name="priority" decoration-danger="priority == '1'"
decoration-warning="priority == '2'"
decoration-info="priority == '3'"
decoration-success="priority == '4'"/>
<field name="material_check" optional="hide"/> <field name="material_check" optional="hide"/>
<field name="hide_action_open_mrp_production" invisible="1"/> <!-- <field name="hide_action_open_mrp_production" invisible="1"/>-->
<field name="hide_action_purchase_orders" invisible="1"/> <!-- <field name="hide_action_purchase_orders" invisible="1"/>-->
<field name="hide_action_stock_picking" invisible="1"/> <!-- <field name="hide_action_stock_picking" invisible="1"/>-->
<field name="hide_action_view_programming" invisible="1"/> <!-- <field name="hide_action_view_programming" invisible="1"/>-->
<button name="action_open_sale_order" type="object" string="供货方式待确认" class="btn-secondary" <!-- <button name="action_open_sale_order" type="object" string="供货方式待确认" class="btn-secondary"-->
attrs="{'invisible': [('supply_method', '!=', False)]}"/> <!-- attrs="{'invisible': [('supply_method', '!=', False)]}"/>-->
<button name="action_open_mrp_production" type="object" string="待工艺确认" class="btn-secondary" <!-- <button name="action_open_mrp_production" type="object" string="待工艺确认" class="btn-secondary"-->
attrs="{'invisible': [('hide_action_open_mrp_production', '=', False)]}"/> <!-- attrs="{'invisible': [('hide_action_open_mrp_production', '=', False)]}"/>-->
<button name="action_view_purchase_request" type="object" string="采购申请" class="btn-secondary" <!-- <button name="action_view_purchase_request" type="object" string="采购申请" class="btn-secondary"-->
attrs="{'invisible': [('hide_action_purchase_orders', '=', False)]}"/> <!-- attrs="{'invisible': [('hide_action_purchase_orders', '=', False)]}"/>-->
<button name="action_view_stock_picking" type="object" string="调拨单" class="btn-secondary" <!-- <button name="action_view_stock_picking" type="object" string="调拨单" class="btn-secondary"-->
attrs="{'invisible': [('hide_action_stock_picking', '=', False)]}"/> <!-- attrs="{'invisible': [('hide_action_stock_picking', '=', False)]}"/>-->
<button name="action_view_programming" type="object" string="编程单" class="btn-secondary" <!-- <button name="action_view_programming" type="object" string="编程单" class="btn-secondary"-->
attrs="{'invisible': [('hide_action_view_programming', '=', False)]}"/> <!-- attrs="{'invisible': [('hide_action_view_programming', '=', False)]}"/>-->
<field name="planned_start_date"/> <field name="planned_start_date" attrs="{'readonly': [('status', 'in', ('60','100'))]}"/>
<field name="actual_start_date"/> <field name="actual_start_date"/>
<field name="actual_end_date"/> <field name="actual_end_date"/>
<field name="processing_time"/>
<field name="create_date" optional="hide" string="创建时间"/> <field name="create_date" optional="hide" string="创建时间"/>
<field name="create_uid" optional="hide" string="创建人"/> <field name="create_uid" optional="hide" string="创建人"/>
<field name="write_date" string="更新时间"/> <field name="write_date" string="更新时间"/>
<field name="write_uid" optional="hide" string="更新人"/> <field name="write_uid" optional="hide" string="更新人"/>
<field name="print_count"/> <field name="print_count"/>
<button name="release_production_order" type="object" string="下达生产" class="btn-primary" <field name="hide_release_production_order" invisible="1"/>
attrs="{'invisible': ['|',('status', '!=', '50'), ('supply_method', 'not in', ['automation', 'manual'])]}"/> <button string="下达计划" name="button_release_plan" type="object"
class="btn-primary"
attrs="{'invisible': [('status', 'in', ('50','60','100'))]}"
/>
<button name="button_release_production" type="object" string="下发生产" class="btn-primary"
attrs="{'invisible': [('hide_release_production_order', '=', False)]}"
/>
<button name="edit_button" type="object" string="拆分" class="btn-primary"/>
</tree> </tree>
</field> </field>
</record> </record>
@@ -80,7 +105,7 @@
<field name="product_id"/> <field name="product_id"/>
<field name="part_name"/> <field name="part_name"/>
<field name="part_number"/> <field name="part_number"/>
<field name="partner_id"/> <field name="customer_name"/>
<field name="supply_method"/> <field name="supply_method"/>
<field name="materials_id"/> <field name="materials_id"/>
<field name="model_process_parameters_ids"/> <field name="model_process_parameters_ids"/>
@@ -89,7 +114,8 @@
<group expand="0" string="Group By"> <group expand="0" string="Group By">
<filter name="group_by_priority" string="优先级" domain="[]" context="{'group_by': 'priority'}"/> <filter name="group_by_priority" string="优先级" domain="[]" context="{'group_by': 'priority'}"/>
<filter name="group_by_status" string="状态" domain="[]" context="{'group_by': 'status'}"/> <filter name="group_by_status" string="状态" domain="[]" context="{'group_by': 'status'}"/>
<filter name="group_by_partner_id" string="客户" domain="[]" context="{'group_by': 'partner_id'}"/> <filter name="group_by_customer_name" string="客户" domain="[]"
context="{'group_by': 'customer_name'}"/>
<filter name="group_by_is_incoming_material" string="客供料" domain="[]" <filter name="group_by_is_incoming_material" string="客供料" domain="[]"
context="{'group_by': 'is_incoming_material'}"/> context="{'group_by': 'is_incoming_material'}"/>
<filter name="group_by_supply_method" string="供货方式" domain="[]" <filter name="group_by_supply_method" string="供货方式" domain="[]"
@@ -112,12 +138,4 @@
<field name="view_mode">tree</field> <field name="view_mode">tree</field>
</record> </record>
<menuitem
id="demand_plan_menu"
name="需求计划"
sequence="140"
action="sf_production_demand_plan_action"
parent="sf_plan.sf_production_plan_menu"
/>
</odoo> </odoo>

View File

@@ -0,0 +1,123 @@
<odoo>
<record id="view_sf_demand_plan_form" model="ir.ui.view">
<field name="name">sf.demand.plan.form</field>
<field name="model">sf.demand.plan</field>
<field name="arch" type="xml">
<form>
<header>
<field name="state" widget="statusbar"/>
<field name="hide_button_release_plan" invisible="1"/>
<button string="下达计划" name="button_production_release_plan" type="object"
class="btn-primary"
attrs="{'invisible': [('hide_button_release_plan', '=', False)]}"/>
</header>
<sheet>
<group>
<group>
<field name="demand_plan_number"/>
<field name="product_id"/>
<field name="part_name"/>
<field name="part_number"/>
<field name="materials_id"/>
<field name="blank_type"/>
<field name="blank_precision"/>
<field name="embryo_long"/>
<field name="manual_quotation"/>
<field name="is_incoming_material"/>
<field name="pending_qty"/>
<field name="planned_qty"/>
<field name="model_id"/>
</group>
<group>
<field name="customer_name"/>
<field name="product_uom_qty"/>
<field name="deadline_of_delivery"/>
<field name="contract_date"/>
<field name="contract_code"/>
<field name="model_process_parameters_ids" widget="many2many_tags"/>
<field name="model_machining_precision"/>
<field name="inventory_quantity_auto_apply"/>
<field name="priority" attrs="{'readonly': [('state', 'in', ('40','50'))]}"/>
<field name="overdelivery_allowed"/>
<field name="origin"/>
</group>
</group>
<notebook>
<page string="计划">
<field name="line_ids" attrs="{'invisible': [('state', 'in', ('40','50'))]}">
<tree editable="bottom" create="false" delete="false">
<field name="status"/>
<field name="readonly_custom_made_type" invisible="1"/>
<field name="new_supply_method" attrs="{'readonly': [('status', '!=', '30')]}"/>
<field name="custom_made_type"
attrs="{
'readonly': ['|', '|', ('new_supply_method', '!=', 'custom_made'), ('status', '!=', '30'), ('readonly_custom_made_type', '=', True)],
'required': [('new_supply_method', '=', 'custom_made')]}"/>
<field name="route_ids" widget="many2many_tags" optional="hide"/>
<field name="location_id" optional="hide"/>
<field name="bom_id" optional="hide"/>
<field name="processing_time" optional="hide"/>
<field name="plan_uom_qty" attrs="{'readonly': [('status', '!=', '30')]}"/>
<field name="blank_arrival_date"/>
<field name="finished_product_arrival_date"/>
<field name="planned_start_date"/>
<field name="actual_start_date"/>
<field name="actual_end_date"/>
<field name="plan_remark"/>
<field name="procurement_reason"/>
<field name="write_date" string="更新时间"/>
<field name="hide_release_production_order" invisible="1"/>
<button string="下达计划" name="button_release_plan" type="object"
class="btn-primary"
attrs="{'invisible': [('status', 'in', ('50','60','100'))]}"
/>
<button name="button_release_production" type="object" string="下发生产"
class="btn-primary"
attrs="{'invisible': [('hide_release_production_order', '=', False)]}"
/>
</tree>
</field>
<field name="line_ids" attrs="{'invisible': [('state', 'not in', ('40','50'))]}">
<tree editable="bottom">
<field name="status"/>
<field name="readonly_custom_made_type" invisible="1"/>
<field name="new_supply_method" attrs="{'readonly': [('status', '!=', '30')]}"/>
<field name="custom_made_type"
attrs="{
'readonly': ['|', '|', ('new_supply_method', '!=', 'custom_made'), ('status', '!=', '30'), ('readonly_custom_made_type', '=', True)],
'required': [('new_supply_method', '=', 'custom_made')]}"/>
<field name="route_ids" widget="many2many_tags" optional="hide"/>
<field name="location_id" optional="hide"/>
<field name="bom_id" optional="hide" readonly="1" options="{'no_create': True}"/>
<field name="processing_time" optional="hide"/>
<field name="plan_uom_qty" attrs="{'readonly': [('status', '!=', '30')]}"/>
<field name="blank_arrival_date"/>
<field name="finished_product_arrival_date"/>
<field name="planned_start_date"/>
<field name="actual_start_date"/>
<field name="actual_end_date"/>
<field name="plan_remark"/>
<field name="procurement_reason"/>
<field name="write_date" string="更新时间"/>
<field name="hide_release_production_order" invisible="1"/>
<button string="下达计划" name="button_release_plan" type="object"
class="btn-primary"
attrs="{'invisible': [('status', 'in', ('50','60','100'))]}"
/>
<button name="button_release_production" type="object" string="下发生产"
class="btn-primary"
attrs="{'invisible': [('hide_release_production_order', '=', False)]}"
/>
<button string="详情" name="button_plan_detail" type="object"
class="btn-primary"
/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<menuitem
id="demand_plan_menu"
name="需求计划"
sequence="140"
action="sf_demand_plan.sf_production_demand_plan_action"
parent="sf_plan.sf_production_plan_menu"
/>
<!-- 调拨动作中屏蔽验证-->
<record id="stock.action_validate_picking" model="ir.actions.server">
<field name="binding_model_id" eval="False"/>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_order_form_inherit_plan" model="ir.ui.view">
<field name="name">view.sale.order.form.inherit.plan</field>
<field name="inherit_id" ref="sf_manufacturing.view_order_form_inherit_supply_method"/>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<xpath expr="//header/button[@name='action_confirm'][last()]" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
<xpath expr="//page/field[@name='order_line']/tree/field[@name='supply_method']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
<xpath expr="//div[@name='button_box']" position="inside">
<button class="oe_stat_button" name="action_view_demand_plan" type="object" icon="fa-pencil-square-o"
attrs="{'invisible': [('demand_plan_count', '=', 0)]}">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="demand_plan_count"/>
</span>
<span class="o_stat_text">需求计划</span>
</div>
</button>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="sf_stock_location_route_form_view" model="ir.ui.view">
<field name="name">stock.route.form</field>
<field name="model">stock.route</field>
<field name="inherit_id" ref="stock.stock_location_route_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='packaging_selectable']" position="after">
<field name="demand_plan_selectable"/>
</xpath>
<xpath expr="//group[@name='route_selector']" position="after">
<group name="group_category" string="组类">
<group>
<field name="stock_route_group_ids" options="{'no_create': True}" widget="many2many_tags"/>
<field name="demand_plan_ids" invisible="1" options="{'no_create': True}" widget="many2many_tags"/>
</group>
</group>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1 +1,2 @@
from . import sf_demand_plan_print_wizard from . import sf_demand_plan_print_wizard
from . import sf_release_plan_wizard

View File

@@ -9,11 +9,6 @@ class SfDemandPlanPrintWizard(models.TransientModel):
_name = 'sf.demand.plan.print.wizard' _name = 'sf.demand.plan.print.wizard'
_description = u'打印向导' _description = u'打印向导'
demand_plan_id = fields.Many2one('sf.production.demand.plan', string='需求计划ID')
product_id = fields.Many2one(
comodel_name='product.product',
related='demand_plan_id.product_id',
string='产品', store=True, index=True)
model_id = fields.Char('模型ID') model_id = fields.Char('模型ID')
filename_url = fields.Char('文件名/URL') filename_url = fields.Char('文件名/URL')
type = fields.Selection([ type = fields.Selection([
@@ -25,30 +20,50 @@ class SfDemandPlanPrintWizard(models.TransientModel):
('success', '成功'), ('success', '成功'),
('fail', '失败'), ('fail', '失败'),
], string='状态', default='not_start') ], string='状态', default='not_start')
machining_drawings = fields.Binary('2D加工图纸', related='product_id.machining_drawings', store=True) machining_drawings = fields.Binary('2D加工图纸')
workorder_id = fields.Many2one('mrp.workorder', string='工单')
cnc_worksheet = fields.Binary('程序单') cnc_worksheet = fields.Binary('程序单')
def demand_plan_print(self): @api.model
for record in self: def demand_plan_print(self, print_ids):
plan_print_ids = self.env['sf.demand.plan.print.wizard'].sudo().search(
[('id', 'in', print_ids)])
if not plan_print_ids:
return {'message': '记录不存在'}
success_records = []
failed_records = []
for record in plan_print_ids:
pdf_data = record.machining_drawings if record.type == '1' else record.cnc_worksheet pdf_data = record.machining_drawings if record.type == '1' else record.cnc_worksheet
if pdf_data: if pdf_data:
try: try:
# 执行打印 # 执行打印
self.env['jikimo.printing'].sudo().print_pdf(pdf_data) # self.env['jikimo.printing'].sudo().print_pdf(pdf_data)
record.status = 'success' record.status = 'success'
t_part, c_part = record.demand_plan_id.print_count.split('C') production_demand_plan_id = self.env['sf.production.demand.plan'].sudo().search(
t_num = int(t_part[1:]) [('model_id', '=', record.model_id)])
c_num = int(c_part) for production_demand_plan in production_demand_plan_id:
if record.type == '1': t_part, c_part = production_demand_plan.print_count.split('C')
t_num += 1 t_num = int(t_part[1:])
elif record.type == '2': c_num = int(c_part)
c_num += 1 if record.type == '1':
record.demand_plan_id.print_count = f"T{t_num}C{c_num}" t_num += 1
elif record.type == '2':
c_num += 1
production_demand_plan.print_count = f"T{t_num}C{c_num}"
success_records.append({
'filename_url': record.filename_url,
})
except Exception as e: except Exception as e:
record.status = 'fail' record.status = 'fail'
_logger.error(f"文件{record.filename_url}打印失败: {str(e)}") _logger.error(f"文件{record.filename_url}打印失败: {str(e)}")
failed_records.append({
'filename_url': record.filename_url,
})
if failed_records:
message = f"成功打印 {len(success_records)} 个文件,失败 {len(failed_records)}"
else:
message = f"所有 {len(success_records)} 个文件打印成功"
return {'message': message}
class MrpWorkorder(models.Model): class MrpWorkorder(models.Model):
@@ -59,21 +74,16 @@ class MrpWorkorder(models.Model):
for record in self: for record in self:
if 'cnc_worksheet' in vals: if 'cnc_worksheet' in vals:
demand_plan_print = self.env['sf.demand.plan.print.wizard'].sudo().search( demand_plan_print = self.env['sf.demand.plan.print.wizard'].sudo().search(
[('workorder_id', '=', record.id)]) [('model_id', '=', record.model_id), ('type', '=', '2')])
if demand_plan_print: if demand_plan_print:
self.env['sf.demand.plan.print.wizard'].sudo().write( demand_plan_print.write(
{'cnc_worksheet': record.cnc_worksheet, 'filename_url': record.cnc_worksheet_name}) {'cnc_worksheet': record.cnc_worksheet, 'filename_url': record.cnc_worksheet_name})
else: else:
demand_plan = self.env['sf.production.demand.plan'].sudo().search( wizard_vals = {
[('product_id', '=', record.product_id.id)]) 'model_id': record.model_id,
if demand_plan: 'type': '2',
wizard_vals = { 'cnc_worksheet': record.cnc_worksheet,
'demand_plan_id': demand_plan.id, 'filename_url': record.cnc_worksheet_name
'model_id': demand_plan.model_id, }
'type': '2', self.env['sf.demand.plan.print.wizard'].sudo().create(wizard_vals)
'workorder_id': record.id,
'cnc_worksheet': record.cnc_worksheet,
'filename_url': record.cnc_worksheet_name
}
self.env['sf.demand.plan.print.wizard'].sudo().create(wizard_vals)
return res return res

View File

@@ -4,12 +4,12 @@
<field name="name">sf.demand.plan.print.wizard.tree</field> <field name="name">sf.demand.plan.print.wizard.tree</field>
<field name="model">sf.demand.plan.print.wizard</field> <field name="model">sf.demand.plan.print.wizard</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="打印"> <tree string="打印" class="print_demand" js_class="print_demand">
<field name="model_id"/> <field name="model_id"/>
<field name="filename_url"/> <field name="filename_url"/>
<field name="type"/> <field name="type"/>
<field name="machining_drawings" widget="adaptive_viewer"/> <field name="machining_drawings" attrs="{'column_invisible': True }"/>
<field name="cnc_worksheet" widget="pdf_viewer"/> <field name="cnc_worksheet" attrs="{'column_invisible': True }"/>
<field name="status"/> <field name="status"/>
</tree> </tree>
</field> </field>

View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
import logging
from odoo import models, fields, api, _
from werkzeug.exceptions import InternalServerError
_logger = logging.getLogger(__name__)
class SfReleasePlanWizard(models.TransientModel):
_name = 'sf.release.plan.wizard'
_description = u'下达计划向导'
demand_plan_line_id = fields.Many2many(comodel_name="sf.production.demand.plan",
string="需求计划明细", readonly=True)
release_message = fields.Char(string='提示', readonly=True)
def confirm(self):
if self.demand_plan_line_id:
for demand_plan_line_id in self.demand_plan_line_id:
try:
demand_plan_line_id.action_confirm()
except Exception as e:
self.env.cr.rollback()
demand_plan_line_id.write({'is_processing': False})
self.env.cr.commit()
raise InternalServerError('操作失败', e)

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="sf_release_plan_wizard_form">
<field name="name">sf.release.plan.wizard.form</field>
<field name="model">sf.release.plan.wizard</field>
<field name="arch" type="xml">
<form>
<sheet>
<div>
<div style="white-space: pre-wrap;">
<field name="release_message"/>
</div>
</div>
<footer>
<button string="确认" name="confirm" type="object" class="oe_highlight"/>
<button string="取消" class="btn btn-secondary" special="cancel"/>
</footer>
</sheet>
</form>
</field>
</record>
</odoo>

View File

@@ -3,6 +3,7 @@ import logging
import re import re
from odoo import models, fields, api from odoo import models, fields, api
from odoo.exceptions import ValidationError
class ResProductCategory(models.Model): class ResProductCategory(models.Model):
@@ -47,11 +48,14 @@ class ResMrpBomMo(models.Model):
item.subcontractor_name = '' item.subcontractor_name = ''
def bom_create_line_has(self, embryo): def bom_create_line_has(self, embryo):
product = self.product_tmpl_id
if product.unit_number in (0, None, False):
raise ValidationError(f'产品{product.name}单件用量的值不能为{product.unit_number}')
vals = { vals = {
'bom_id': self.id, 'bom_id': self.id,
'product_id': embryo.id, 'product_id': embryo.id,
'product_tmpl_id': embryo.product_tmpl_id.id, 'product_tmpl_id': embryo.product_tmpl_id.id,
'product_qty': 1, 'product_qty': product.unit_number,
'product_uom_id': 1 'product_uom_id': 1
} }
return self.env['mrp.bom.line'].sudo().create(vals) return self.env['mrp.bom.line'].sudo().create(vals)
@@ -122,7 +126,7 @@ class ResMrpBomMo(models.Model):
# 查bom的原材料 # 查bom的原材料
def get_raw_bom(self, product): def get_raw_bom(self, product):
raw_bom = self.env['product.product'].search( raw_bom = self.env['product.product'].search(
[('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)],limit=1) [('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)], limit=1)
return raw_bom return raw_bom

View File

@@ -10,6 +10,7 @@ class ResProductTemplate(models.Model):
model_name = fields.Char('模型名称') model_name = fields.Char('模型名称')
categ_type = fields.Selection( categ_type = fields.Selection(
[("成品", "成品"), ("胚料", "胚料"), ("原材料", "原材料")], string='产品的类别', related='categ_id.type', store=True) [("成品", "成品"), ("胚料", "胚料"), ("原材料", "原材料")], string='产品的类别', related='categ_id.type', store=True)
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类')
model_long = fields.Float('模型长[mm]', digits=(16, 3)) model_long = fields.Float('模型长[mm]', digits=(16, 3))
model_width = fields.Float('模型宽[mm]', digits=(16, 3)) model_width = fields.Float('模型宽[mm]', digits=(16, 3))
model_height = fields.Float('模型高[mm]', digits=(16, 3)) model_height = fields.Float('模型高[mm]', digits=(16, 3))
@@ -72,14 +73,20 @@ class ResProductTemplate(models.Model):
copy_product_id.product_tmpl_id.active = True copy_product_id.product_tmpl_id.active = True
model_type = self.env['sf.model.type'].search([], limit=1) model_type = self.env['sf.model.type'].search([], limit=1)
attachment = self.attachment_create(item['model_name'], item['model_data']) attachment = self.attachment_create(item['model_name'], item['model_data'])
# 判断参数中是否包含 坯料尺寸(长、宽、高)
blank_bool = any(value is not None and value != 0 for value in (
item.get('blank_length'), item.get('blank_width'), item.get('blank_height'))) if all(
key in item for key in ('blank_length', 'blank_width', 'blank_height')) else False
vals = { vals = {
'name': '%s-%s-%s' % ('P', order_id.name, i), 'name': '%s-%s-%s' % ('P', order_id.name, i),
'model_long': item['model_long'] + model_type.embryo_tolerance, 'blank_type': item.get('blank_type'),
'model_width': item['model_width'] + model_type.embryo_tolerance, 'model_long': item.get('blank_length') if blank_bool else item['model_long'] + model_type.embryo_tolerance,
'model_height': item['model_height'] + model_type.embryo_tolerance, 'model_width': item.get('blank_width') if blank_bool else item['model_width'] + model_type.embryo_tolerance,
'model_volume': (item['model_long'] + model_type.embryo_tolerance) * ( 'model_height': item.get('blank_height') if blank_bool else item['model_height'] + model_type.embryo_tolerance,
item['model_width'] + model_type.embryo_tolerance) * ( 'model_volume': ((item['model_long'] + model_type.embryo_tolerance) *
item['model_height'] + model_type.embryo_tolerance), (item['model_width'] + model_type.embryo_tolerance) *
(item['model_height'] + model_type.embryo_tolerance)) if not blank_bool else (
item.get('blank_length') * item.get('blank_width') * item.get('blank_height')),
'product_model_type_id': model_type.id, 'product_model_type_id': model_type.id,
'model_processing_panel': 'R', 'model_processing_panel': 'R',
'model_machining_precision': item['model_machining_precision'], 'model_machining_precision': item['model_machining_precision'],

View File

@@ -6,50 +6,50 @@ from odoo import models, fields, api, _
class StockRuleInherit(models.Model): class StockRuleInherit(models.Model):
_inherit = 'stock.rule' _inherit = 'stock.rule'
@api.model # @api.model
def _run_buy(self, procurements): # def _run_buy(self, procurements):
# 判断补货组的采购类型 # # 判断补货组的采购类型
procurements_group = {'standard': [], 'outsourcing': []} # procurements_group = {'standard': [], 'outsourcing': []}
for procurement, rule in procurements: # for procurement, rule in procurements:
is_outsourcing = False # is_outsourcing = False
product = procurement.product_id # product = procurement.product_id
# 获取主 BOM # # 获取主 BOM
bom = self.env['mrp.bom'].search([('product_tmpl_id', '=', product.product_tmpl_id.id)], limit=1) # bom = self.env['mrp.bom'].search([('product_tmpl_id', '=', product.product_tmpl_id.id)], limit=1)
#
if bom: # if bom:
# 遍历 BOM 中的组件(即坯料等) # # 遍历 BOM 中的组件(即坯料等)
for line in bom.bom_line_ids: # for line in bom.bom_line_ids:
raw_material = line.product_id # raw_material = line.product_id
# 检查路线 # # 检查路线
for route in raw_material.route_ids: # for route in raw_material.route_ids:
# print('route.name:', route.name) # # print('route.name:', route.name)
if route.name == '按订单补给外包商': # if route.name == '按订单补给外包商':
is_outsourcing = True # is_outsourcing = True
#
if is_outsourcing: # if is_outsourcing:
procurements_group['outsourcing'].append((procurement, rule)) # procurements_group['outsourcing'].append((procurement, rule))
else: # else:
procurements_group['standard'].append((procurement, rule)) # procurements_group['standard'].append((procurement, rule))
#
for key, value in procurements_group.items(): # for key, value in procurements_group.items():
super(StockRuleInherit, self)._run_buy(value) # super(StockRuleInherit, self)._run_buy(value)
#
if key == 'outsourcing': # if key == 'outsourcing':
for procurement, rule in value: # for procurement, rule in value:
supplier = procurement.values.get('supplier') # supplier = procurement.values.get('supplier')
if supplier: # if supplier:
domain = rule._make_po_get_domain(procurement.company_id, procurement.values, # domain = rule._make_po_get_domain(procurement.company_id, procurement.values,
supplier.partner_id) # supplier.partner_id)
logging.info("domain=============: %s", domain) # logging.info("domain=============: %s", domain)
po = self.env['purchase.order'].sudo().search([ # po = self.env['purchase.order'].sudo().search([
('partner_id', '=', supplier.partner_id.id), # ('partner_id', '=', supplier.partner_id.id),
('company_id', '=', procurement.company_id.id), # 保证公司一致 # ('company_id', '=', procurement.company_id.id), # 保证公司一致
('origin', 'like', procurement.origin), # 根据来源匹配 # ('origin', 'like', procurement.origin), # 根据来源匹配
('state', '=', 'draft') # 状态为草稿 # ('state', '=', 'draft') # 状态为草稿
], limit=1) # ], limit=1)
logging.info("po=: %s", po) # logging.info("po=: %s", po)
if po: # if po:
po.write({'purchase_type': 'outsourcing'}) # po.write({'purchase_type': 'outsourcing'})
# # 首先调用父类的 _run_buy 方法,以保留原有逻辑 # # 首先调用父类的 _run_buy 方法,以保留原有逻辑
# super(StockRuleInherit, self)._run_buy(procurements) # super(StockRuleInherit, self)._run_buy(procurements)

View File

@@ -95,7 +95,9 @@
<page string="加工参数"> <page string="加工参数">
<group> <group>
<group string="模型"> <group string="模型">
<label for="model_long" string="尺寸[mm]"/> <field name="blank_type" readonly="1"/>
<field name="blank_precision" readonly="1"/>
<label for="model_long" string="坯料尺寸[mm]"/>
<div class="o_address_format"> <div class="o_address_format">
<label for="model_long" string="长"/> <label for="model_long" string="长"/>
<field name="model_long" class="o_address_zip"/> <field name="model_long" class="o_address_zip"/>
@@ -104,6 +106,7 @@
<label for="model_height" string="高"/> <label for="model_height" string="高"/>
<field name="model_height" class="o_address_zip"/> <field name="model_height" class="o_address_zip"/>
</div> </div>
<field name="unit_number" readonly="1"/>
<field name="model_volume" string="体积[mm³]"/> <field name="model_volume" string="体积[mm³]"/>
<field name="product_model_type_id" string="模型类型"/> <field name="product_model_type_id" string="模型类型"/>
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板" <field name="model_processing_panel" placeholder="例如R,U" string="加工面板"
@@ -510,112 +513,168 @@
</notebook> </notebook>
</page> </page>
<page string="夹具物料参数" attrs="{'invisible': [('categ_type', '!=', '夹具')]}"> <page string="夹具物料参数" attrs="{'invisible': [('categ_type', '!=', '夹具')]}">
<group>
<group> <group>
<field name="brand_id" placeholder="请选择" options="{'no_create': True}"/> <group>
<field name="multi_mounting_type_id" placeholder="请选择" options="{'no_create': True}" <field name="brand_id" placeholder="请选择" options="{'no_create': True}"/>
attrs="{'required': [('categ_type', '=', '夹具')]}"/> <field name="multi_mounting_type_id" placeholder="请选择" options="{'no_create': True}"
<field name="length" string="长度(mm)"/> attrs="{'required': [('categ_type', '=', '夹具')]}"/>
<field name="width" string="度(mm)"/> <field name="length" string="度(mm)"/>
<field name="height" string="度(mm)"/> <field name="width" string="度(mm)"/>
<field name="height_tolerance_value" <field name="height" string="高度(mm)"/>
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/> <field name="height_tolerance_value"
<field name="diameter" attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘', '零点托盘', '三爪卡盘'])]}"/> <field name="diameter"
<field name="weight"/> attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘', '零点托盘', '三爪卡盘', '磁吸托盘', '气吸托盘'])]}"/>
<field name="chucking_power_max" <field name="weight"/>
attrs="{'invisible': [('fixture_material_type', '=','磁吸夹具')]}"/> <field name="chucking_power_max"
<field name="carrying_capacity_max"/> attrs="{'invisible': [('fixture_material_type', '=','磁吸夹具')]}"/>
<field name="rigidity"/> <field name="carrying_capacity_max"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
<field name="rigidity"/>
</group>
<group>
<!-- 夹持工件尺寸 -->
<label for="gripper_length_min" string="夹持工件最小尺寸"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<div class="o_address_format"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
<label for="gripper_length_min" string="长"/>
<field name="gripper_length_min" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="gripper_width_min" string="宽"/>
<field name="gripper_width_min" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="gripper_height_min" string="高"/>
<field name="gripper_height_min" class="o_address_zip"/>
</div>
<label for="gripper_length_max" string="夹持工件最大尺寸"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<div class="o_address_format"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
<label for="gripper_length_max" string="长"/>
<field name="gripper_length_max" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="gripper_width_max" string="宽"/>
<field name="gripper_width_max" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="gripper_height_max" string="高"/>
<field name="gripper_height_max" class="o_address_zip"/>
</div>
<field name="gripper_diameter_min" string="夹持工件最小直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<field name="gripper_diameter_max" string="夹持工件最大直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<field name="clamping_diameter" string="装夹直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
<field name="clamping_num" placeholder="请选择" string="装夹单元数"
attrs="{'invisible': [('fixture_material_type', '!=', '零点卡盘')]}"/>
<field name="repeated_positioning_accuracy" placeholder="请输入重复定位孔精度"
string="重复定位精度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
<field name="orientation_dish_diameter" string="定位盘直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
<field name="boolean_transposing_hole" string="是否有转位孔"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
<field name="connector_diameter" placeholder="请选择" string="连接头直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘'])]}"/>
<field name="way_to_install" placeholder="请选择" string="安装方式"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气吸托盘'])]}"/>
<field name="rated_air_pressure" string="额定气压(Mpa)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具'])]}"/>
<field name="transverse_groove" string="横向配合槽n(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
<field name="longitudinal_fitting_groove" string="纵向配合槽l(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
<field name="rated_adsorption_force" string="额定吸附力(N/cm²)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
<field name="magnetic_field_height" string="磁场高度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
<field name="magnetic_pole_plate_grinding_allowance" string="磁极板磨削余量(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
<!-- 磁吸托盘字段 -->
<field name="magnet_tray_length" string="磁吸托盘长度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_tray_width" string="磁吸托盘宽度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_tray_height" string="磁吸托盘厚度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_tray_diameter" string="磁吸托盘直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_tray_weight" string="磁吸托盘重量(kg)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_max_adsorp_length" string="磁吸托盘最大吸附长度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_max_adsorp_width" string="磁吸托盘最大吸附宽度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_max_adsorp_height" string="磁吸托盘最大吸附厚度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_max_adsorp_diameter" string="磁吸托盘最大吸附直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_max_adsorp_force" string="磁吸托盘最大吸附力(N)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_unlocking_method" string="磁吸托盘锁紧方式"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_flatness" string="磁吸托盘平面精度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<field name="magnet_max_load" string="磁吸托盘最大负载(kg)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
<!-- 气吸托盘字段 -->
<field name="air_tray_length" string="气吸托盘长度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_tray_width" string="气吸托盘宽度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_tray_height" string="气吸托盘高度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_tray_diameter" string="气吸托盘直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_tray_weight" string="气吸托盘重量(kg)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_max_adsorp_length" string="气吸托盘最大吸附长度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_max_adsorp_width" string="气吸托盘最大吸附宽度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_max_adsorp_height" string="气吸托盘最大吸附高度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_max_adsorp_diameter" string="气吸托盘最大吸附直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_max_adsorp_force" string="气吸托盘最大吸附力(N)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_unlocking_method" string="气吸托盘锁紧方式"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_flatness" string="气吸托盘平面精度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_max_load" string="气吸托盘最大负载(kg)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_boolean_chip_blowing_function" string="气吸托盘是否有吹屑功能"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="air_way_to_install" string="气吸托盘安装方式"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
<field name="boolean_chip_blowing_function" string="是否有吹屑功能"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘','气吸托盘'])]}"/>
<field name="materials_model_id" placeholder="请选择" options="{'no_create': True}"/>
<field name="interface_materials_model_id" placeholder="请选择" string="接口类型"
options="{'no_create': True}"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具'])]}"/>
<field name="type_of_drive" placeholder="请选择" string="驱动方式"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<field name="unlocking_method" string="解锁方式" placeholder="请选择"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','气吸托盘', '磁吸托盘'])]}"/>
<field name="machine_tool_type_id" string="适用机床型号" placeholder="请选择"
options="{'no_create': True}"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
</group>
</group> </group>
<group> </page>
<label for="gripper_length_min" string="夹持工件最小尺寸"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<div class="o_address_format"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
<label for="gripper_length_min" string="长"/>
<field name="gripper_length_min" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="gripper_width_min" string="宽"/>
<field name="gripper_width_min" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="gripper_height_min" string="高"/>
<field name="gripper_height_min" class="o_address_zip"/>
</div>
<label for="gripper_length_max" string="夹持工件最大尺寸"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<div class="o_address_format"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
<label for="gripper_length_max" string="长"/>
<field name="gripper_length_max" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="gripper_width_max" string="宽"/>
<field name="gripper_width_max" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="gripper_width_max" string="高"/>
<field name="gripper_width_max" class="o_address_zip"/>
</div>
<field name="gripper_diameter_min" string="夹持工件最小直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<field name="gripper_diameter_max" string="夹持工件最大直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<field name="clamping_diameter" string="装夹直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
<field name="clamping_num" placeholder="请选择" string="装夹单元数"
attrs="{'invisible': [('fixture_material_type', '!=', '零点卡盘')]}"/>
<field name="repeated_positioning_accuracy" placeholder="请输入重复定位孔精度"
string="重复定位精度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
<field name="orientation_dish_diameter" string="定位盘直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
<field name="boolean_transposing_hole" string="是否有转位孔"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
<field name="connector_diameter" placeholder="请选择" string="连接头直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘'])]}"/>
<field name="way_to_install" placeholder="请选择" string="安装方式"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘'])]}"/>
<field name="rated_air_pressure" string="额定气压(Mpa)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具'])]}"/>
<field name="transverse_groove" string="横向配合槽n(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
<field name="longitudinal_fitting_groove" string="纵向配合槽l(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
<field name="rated_adsorption_force" string="额定吸附力(N/cm²)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
<field name="magnetic_field_height" string="磁场高度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
<field name="magnetic_pole_plate_grinding_allowance" string="磁极板磨削余量(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
<field name="screw_size" string="螺牙大小(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['转接板(锁板)夹具'])]}"/>
<field name="via_hole_diameter" string="过孔直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['转接板(锁板)夹具'])]}"/>
<field name="mounting_hole_depth" string="安装孔深度(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['三爪卡盘'])]}"/>
<field name="centering_diameter" string="定心直径(mm)"
attrs="{'invisible': [('fixture_material_type', 'not in', ['三爪卡盘'])]}"/>
<field name="boolean_chip_blowing_function" string="是否有吹屑功能"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
<field name="materials_model_id" placeholder="请选择" options="{'no_create': True}"/>
<field name="interface_materials_model_id" placeholder="请选择" string="接口类型"
options="{'no_create': True}"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具'])]}"/>
<field name="type_of_drive" placeholder="请选择" string="驱动方式"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<field name="unlocking_method" string="解锁方式" placeholder="请选择"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
<field name="machine_tool_type_id" string="适用机床型号" placeholder="请选择"
options="{'no_create': True}"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
</group>
</group>
</page>
</xpath> </xpath>
</field> </field>
</record> </record>

View File

@@ -11,7 +11,7 @@
'category': 'sf', 'category': 'sf',
'website': 'https://www.sf.jikimo.com', 'website': 'https://www.sf.jikimo.com',
'depends': ['sf_base', 'sf_maintenance', 'web_widget_model_viewer', 'sf_warehouse', 'jikimo_attachment_viewer', 'depends': ['sf_base', 'sf_maintenance', 'web_widget_model_viewer', 'sf_warehouse', 'jikimo_attachment_viewer',
'jikimo_sale_multiple_supply_methods', 'product'], 'jikimo_sale_multiple_supply_methods', 'product', 'jikimo_tree_header_buttons_always_visible'],
'data': [ 'data': [
'data/cron_data.xml', 'data/cron_data.xml',
'data/stock_data.xml', 'data/stock_data.xml',

View File

@@ -45,9 +45,8 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
product.product_tmpl_id.is_customer_provided = True if item['embryo_redundancy_id'] else False product.product_tmpl_id.is_customer_provided = True if item['embryo_redundancy_id'] else False
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item) order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
i += 1 i += 1
if kw.get('contract_file_name') and kw.get('contract_file') and kw.get('contract_code'): # BFM 内部下单 新增合同等内容补充
order_id.create_sale_documents(kw.get('contract_file_name'), kw.get('contract_file')) order_id.write_sale_documents(kw)
order_id.write({'contract_code': kw.get('contract_code'), 'contract_date': kw.get('contract_date')})
res['factory_order_no'] = order_id.name res['factory_order_no'] = order_id.name
order_id.confirm_to_supply_method() order_id.confirm_to_supply_method()
except Exception as e: except Exception as e:

View File

@@ -18,4 +18,5 @@ from . import quick_easy_order
from . import purchase_order from . import purchase_order
from . import quality_check from . import quality_check
from . import purchase_request_line from . import purchase_request_line
from . import bom
# from . import stock_warehouse_orderpoint # from . import stock_warehouse_orderpoint

View File

@@ -0,0 +1,16 @@
from odoo import models
from odoo.osv.expression import AND
class MrpBom(models.Model):
_inherit = 'mrp.bom'
def _bom_subcontract_find(self, product, picking_type=None, company_id=False, bom_type='subcontract', subcontractor=False):
domain = self._bom_find_domain(product, picking_type=picking_type, company_id=company_id, bom_type=bom_type)
if self.env.context.get('stock_picking') == 'outsourcing':
return self.search(domain, order='sequence, product_id, id', limit=1)
if subcontractor:
domain = AND([domain, [('subcontractor_ids', 'parent_of', subcontractor.ids)]])
return self.search(domain, order='sequence, product_id, id', limit=1)
else:
return self.env['mrp.bom']

View File

@@ -1709,6 +1709,7 @@ class MrpProduction(models.Model):
vals['procurement_group_id'] = product_group_id[product_id.id] vals['procurement_group_id'] = product_group_id[product_id.id]
else: else:
vals['procurement_group_id'] = is_custemer_group_id[key] vals['procurement_group_id'] = is_custemer_group_id[key]
return super(MrpProduction, self).create(vals_list) return super(MrpProduction, self).create(vals_list)
@api.depends('procurement_group_id.stock_move_ids.created_purchase_line_id.order_id', @api.depends('procurement_group_id.stock_move_ids.created_purchase_line_id.order_id',

View File

@@ -26,13 +26,16 @@ class ResProductMo(models.Model):
model_file = fields.Binary('模型文件') model_file = fields.Binary('模型文件')
categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True) categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True)
model_name = fields.Char('模型名称') model_name = fields.Char('模型名称')
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类')
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型')
model_long = fields.Float('模型长(mm)', digits=(16, 3)) model_long = fields.Float('模型长(mm)', digits=(16, 3))
model_width = fields.Float('模型宽(mm)', digits=(16, 3)) model_width = fields.Float('模型宽(mm)', digits=(16, 3))
model_height = fields.Float('模型高(mm)', digits=(16, 3)) model_height = fields.Float('模型高(mm)', digits=(16, 3))
unit_number = fields.Float('单件用量', digits=(16, 3), default=1)
model_volume = fields.Float('模型体积(m³)') model_volume = fields.Float('模型体积(m³)')
model_area = fields.Float('模型表面积(m²)') model_area = fields.Float('模型表面积(m²)')
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='加工精度') model_machining_precision = fields.Selection(selection=_get_machining_precision, string='加工精度')
model_processing_panel = fields.Char('模型加工面板') model_processing_panel = fields.Char('模型加工面板', default='')
model_remark = fields.Char('模型备注说明') model_remark = fields.Char('模型备注说明')
length = fields.Float('长(mm)', digits=(16, 3)) length = fields.Float('长(mm)', digits=(16, 3))
width = fields.Float('宽(mm)', digits=(16, 3)) width = fields.Float('宽(mm)', digits=(16, 3))
@@ -893,16 +896,24 @@ class ResProductMo(models.Model):
if not embryo_redundancy_id: if not embryo_redundancy_id:
raise UserError('请先配置模型类型内的坯料冗余') raise UserError('请先配置模型类型内的坯料冗余')
product_name = self.generate_product_name(order_id, item, i) product_name = self.generate_product_name(order_id, item, i)
# 判断参数中是否包含 坯料尺寸(长、宽、高)
blank_bool = any(value is not None and value != 0 for value in (
item.get('blank_length'), item.get('blank_width'), item.get('blank_height'))) if all(
key in item for key in ('blank_length', 'blank_width', 'blank_height')) else False
vals = { vals = {
'name': product_name, 'name': product_name,
'model_long': self.format_float(item['model_long'] + embryo_redundancy_id.long), 'blank_type': item.get('blank_type'),
'model_width': self.format_float(item['model_width'] + embryo_redundancy_id.width), 'blank_precision': item.get('blank_precision'),
'model_height': self.format_float(item['model_height'] + embryo_redundancy_id.height), 'model_long': item.get('blank_length') if blank_bool else self.format_float(item['model_long'] + embryo_redundancy_id.long),
'model_volume': self.format_float((item['model_long'] + embryo_redundancy_id.long) * ( 'model_width': item.get('blank_width') if blank_bool else self.format_float(item['model_width'] + embryo_redundancy_id.width),
item['model_width'] + embryo_redundancy_id.width) * ( 'model_height': item.get('blank_height') if blank_bool else self.format_float(item['model_height'] + embryo_redundancy_id.height),
item['model_height'] + embryo_redundancy_id.height)), 'unit_number': item.get('unit_number'),
'model_volume': self.format_float(((item['model_long'] + embryo_redundancy_id.long) *
(item['model_width'] + embryo_redundancy_id.width) *
(item['model_height'] + embryo_redundancy_id.height))) if not blank_bool else (
item.get('blank_length') * item.get('blank_width') * item.get('blank_height')),
'product_model_type_id': model_type.id, 'product_model_type_id': model_type.id,
'model_processing_panel': item['processing_panel_detail'], 'model_processing_panel': item['processing_panel_detail'] if item['processing_panel_detail'] else '',
'model_machining_precision': item['model_machining_precision'], 'model_machining_precision': item['model_machining_precision'],
'model_code': item['barcode'], 'model_code': item['barcode'],
'length': item['model_long'], 'length': item['model_long'],
@@ -1204,6 +1215,51 @@ class ResProductFixture(models.Model):
mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2)) mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2))
centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2)) centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2))
# ‘磁吸托盘’ 字段
magnet_tray_length = fields.Float('磁吸托盘长度(mm)', digits=(16, 2))
magnet_tray_width = fields.Float('磁吸托盘宽度(mm)', digits=(16, 2))
magnet_tray_height = fields.Float('磁吸托盘厚度(mm)', digits=(16, 2))
magnet_tray_diameter = fields.Float('磁吸托盘直径(mm)', digits=(16, 2))
magnet_tray_weight = fields.Float('磁吸托盘重量(kg)', digits=(16, 2))
magnet_max_adsorp_length = fields.Float('磁吸托盘最大吸附长度(mm)', digits=(16, 2))
magnet_max_adsorp_width = fields.Float('磁吸托盘最大吸附宽度(mm)', digits=(16, 2))
magnet_max_adsorp_height = fields.Float('磁吸托盘最大吸附厚度(mm)', digits=(16, 2))
magnet_max_adsorp_diameter = fields.Float('磁吸托盘最大吸附直径(mm)', digits=(16, 2))
magnet_max_adsorp_force = fields.Float('磁吸托盘最大吸附力(N)', digits=(16, 2))
magnet_unlocking_method = fields.Selection(
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
string='磁吸托盘锁紧方式'
)
magnet_flatness = fields.Char('磁吸托盘平面精度(mm)', size=20)
magnet_max_load = fields.Float('磁吸托盘最大负载(kg)', digits=(16, 2))
# ‘气吸托盘’ 字段
air_tray_length = fields.Float('气吸托盘长度(mm)', digits=(16, 2))
air_tray_width = fields.Float('气吸托盘宽度(mm)', digits=(16, 2))
air_tray_height = fields.Float('气吸托盘高度(mm)', digits=(16, 2))
air_tray_diameter = fields.Float('气吸托盘直径(mm)', digits=(16, 2))
air_tray_weight = fields.Float('气吸托盘重量(kg)', digits=(16, 2))
air_max_adsorp_length = fields.Float('气吸托盘最大吸附长度(mm)', digits=(16, 2))
air_max_adsorp_width = fields.Float('气吸托盘最大吸附宽度(mm)', digits=(16, 2))
air_max_adsorp_height = fields.Float('气吸托盘最大吸附厚度(mm)', digits=(16, 2))
air_max_adsorp_diameter = fields.Float('气吸托盘最大吸附直径(mm)', digits=(16, 2))
air_max_adsorp_force = fields.Float('气吸托盘最大吸附力(N)', digits=(16, 2))
air_unlocking_method = fields.Selection(
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
string='气吸托盘锁紧方式'
)
air_flatness = fields.Char('气吸托盘平面精度(mm)', size=20)
air_max_load = fields.Float('气吸托盘最大负载(kg)', digits=(16, 2))
air_boolean_chip_blowing_function = fields.Boolean('气吸托盘是否有吹屑功能')
air_way_to_install = fields.Selection(
[('接口式', '接口式'), ('螺栓固定', '螺栓固定'), ('磁吸式', '磁吸式'), ('其他', '其他')],
string='气吸托盘安装方式'
)
@api.onchange('specification_fixture_id') @api.onchange('specification_fixture_id')
def _onchange_specification_fixture_id(self): def _onchange_specification_fixture_id(self):
if self.specification_fixture_id: if self.specification_fixture_id:

View File

@@ -193,6 +193,19 @@ class SaleOrder(models.Model):
'target': 'new', 'target': 'new',
'res_id': wizard.id, 'res_id': wizard.id,
} }
def write_sale_documents(self, kw):
"""BFM 内部下单 内容补充 """
val = {}
if kw.get('contract_file_name') and kw.get('contract_file'):
document_id = self.create_sale_documents(kw.get('contract_file_name'), kw.get('contract_file'))
val.update({'contract_document_id': document_id.id})
if kw.get('contract_code') or kw.get('contract_date'):
val.update({'contract_code': kw.get('contract_code'), 'contract_date': kw.get('contract_date')})
if kw.get('customer_name'):
val.update({'customer_name': kw.get('customer_name')})
self.write(val)
def create_sale_documents(self, contract_file_name, contract_file): def create_sale_documents(self, contract_file_name, contract_file):
# 创建ir.attachment记录 # 创建ir.attachment记录
attachment = self.env['ir.attachment'].sudo().create({ attachment = self.env['ir.attachment'].sudo().create({
@@ -214,9 +227,7 @@ class SaleOrder(models.Model):
'res_id': self.id, 'res_id': self.id,
}) })
self.write({ return document
'contract_document_id': document.id
})
class SaleOrderLine(models.Model): class SaleOrderLine(models.Model):
_inherit = 'sale.order.line' _inherit = 'sale.order.line'

View File

@@ -21,6 +21,7 @@ from odoo.addons.sf_base.commons.common import Common
from odoo.exceptions import UserError from odoo.exceptions import UserError
from io import BytesIO from io import BytesIO
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
from dateutil.relativedelta import relativedelta
class stockWarehouse(models.Model): class stockWarehouse(models.Model):
@@ -95,35 +96,36 @@ class StockRule(models.Model):
precision_rounding=proc[ precision_rounding=proc[
0].product_uom.rounding) > 0) 0].product_uom.rounding) > 0)
list2 = [] list2 = []
for item in procurements: for procurement, rule in procurements:
num = int(item[0].product_qty) num = int(procurement.product_qty)
product = self.env['product.product'].search( warehouse_id = rule.warehouse_id
[("id", '=', item[0].product_id.id)]) if not warehouse_id:
product_tmpl = self.env['product.template'].search( warehouse_id = rule.location_dest_id.warehouse_id
["&", ("id", '=', product.product_tmpl_id.id), ('single_manufacturing', "!=", False)]) manu_rule = rule.route_id.rule_ids.filtered(lambda r: r.action == 'manufacture' and r.warehouse_id == warehouse_id)
if product_tmpl:
if procurement.product_id.product_tmpl_id.single_manufacturing and manu_rule:
if num > 1: if num > 1:
for no in range(1, num + 1): for no in range(1, num + 1):
Procurement = namedtuple('Procurement', ['product_id', 'product_qty', Procurement = namedtuple('Procurement', ['product_id', 'product_qty',
'product_uom', 'location_id', 'name', 'origin', 'product_uom', 'location_id', 'name', 'origin',
'company_id', 'company_id',
'values']) 'values'])
s = Procurement(product_id=item[0].product_id, product_qty=1.0, product_uom=item[0].product_uom, s = Procurement(product_id=procurement.product_id, product_qty=1.0, product_uom=procurement.product_uom,
location_id=item[0].location_id, location_id=procurement.location_id,
name=item[0].name, name=procurement.name,
origin=item[0].origin, origin=procurement.origin,
company_id=item[0].company_id, company_id=procurement.company_id,
values=item[0].values, values=procurement.values,
) )
item1 = list(item) # item1 = list(item)
item1[0] = s # item1[0] = s
list2.append(tuple(item1)) list2.append((s, rule))
else: else:
list2.append(item) list2.append((procurement, rule))
else: else:
list2.append(item) list2.append((procurement, rule))
for procurement, rule in list2: for procurement, rule in list2:
procure_method = rule.procure_method procure_method = rule.procure_method
@@ -183,18 +185,6 @@ class StockRule(models.Model):
'''创建制造订单''' '''创建制造订单'''
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create( productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
productions_values) productions_values)
# 将这一批制造订单的采购组根据成品设置为不同的采购组
# product_group_id = {}
# for index, production in enumerate(productions):
# if production.product_id.id not in product_group_id.keys():
# product_group_id[production.product_id.id] = production.procurement_group_id.id
# else:
# productions_values[index].update({'name': production.name})
# procurement_group_vals = production._prepare_procurement_group_vals(productions_values[index])
# production.procurement_group_id = self.env["procurement.group"].create(procurement_group_vals).id
# self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
''' '''
创建工单 创建工单
@@ -227,7 +217,8 @@ class StockRule(models.Model):
''' '''
创建制造订单时生成序列号 创建制造订单时生成序列号
''' '''
production.action_generate_serial() if production.product_id.tracking != "none":
production.action_generate_serial()
origin_production = production.move_dest_ids and production.move_dest_ids[ origin_production = production.move_dest_ids and production.move_dest_ids[
0].raw_material_production_id or False 0].raw_material_production_id or False
orderpoint = production.orderpoint_id orderpoint = production.orderpoint_id
@@ -452,7 +443,7 @@ class ProductionLot(models.Model):
@api.model @api.model
def _get_next_serial(self, company, product): def _get_next_serial(self, company, product):
"""Return the next serial number to be attributed to the product.""" """Return the next serial number to be attributed to the product."""
if product.tracking == "serial": if product.tracking != "none":
last_serial = self.env['stock.lot'].search( last_serial = self.env['stock.lot'].search(
[('company_id', '=', company.id), ('product_id', '=', product.id), ('name', 'ilike', product.name)], [('company_id', '=', company.id), ('product_id', '=', product.id), ('name', 'ilike', product.name)],
limit=1, order='name desc') limit=1, order='name desc')
@@ -463,7 +454,9 @@ class ProductionLot(models.Model):
return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name if ( return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name if (
not move_line_id or not move_line_id or
(last_serial and last_serial.name > move_line_id.lot_name)) else move_line_id.lot_name, 2)[1] (last_serial and last_serial.name > move_line_id.lot_name)) else move_line_id.lot_name, 2)[1]
return "%s-%03d" % (product.name, 1) else:
return "%s-%03d" % (product.name, 1)
return False
qr_code_image = fields.Binary(string='二维码', compute='_generate_qr_code') qr_code_image = fields.Binary(string='二维码', compute='_generate_qr_code')
@@ -738,6 +731,33 @@ class StockPicking(models.Model):
production.workorder_ids.write({'back_button_display': False}) production.workorder_ids.write({'back_button_display': False})
return res return res
def _prepare_subcontract_mo_vals(self, subcontract_move, bom):
subcontract_move.ensure_one()
group = self.env['procurement.group'].sudo().search([('name', '=', self.name)])
if not group:
group = self.env['procurement.group'].create({
'name': self.name,
'partner_id': self.partner_id.id,
})
product = subcontract_move.product_id
warehouse = self._get_warehouse(subcontract_move)
vals = {
'company_id': subcontract_move.company_id.id,
'procurement_group_id': group.id,
'subcontractor_id': subcontract_move.picking_id.partner_id.commercial_partner_id.id,
'picking_ids': [subcontract_move.picking_id.id],
'product_id': product.id,
'product_uom_id': subcontract_move.product_uom.id,
'bom_id': bom.id,
'location_src_id': subcontract_move.picking_id.partner_id.with_company(subcontract_move.company_id).property_stock_subcontractor.id,
'location_dest_id': subcontract_move.picking_id.partner_id.with_company(subcontract_move.company_id).property_stock_subcontractor.id,
'product_qty': subcontract_move.product_uom_qty,
'picking_type_id': warehouse.subcontracting_type_id.id,
'date_planned_start': subcontract_move.date - relativedelta(days=product.produce_delay)
}
return vals
# 创建 外协出库入单 # 创建 外协出库入单
def create_outcontract_picking(self, workorders, item, sorted_workorders): def create_outcontract_picking(self, workorders, item, sorted_workorders):
production = workorders[0].production_id production = workorders[0].production_id
@@ -1216,6 +1236,20 @@ class ReStockMove(models.Model):
res['lot_id'] = self.subcontract_workorder_id.production_id.move_raw_ids.move_line_ids[0].lot_id.id res['lot_id'] = self.subcontract_workorder_id.production_id.move_raw_ids.move_line_ids[0].lot_id.id
return res return res
def _get_subcontract_bom(self):
self.ensure_one()
purchase_type = getattr(self.picking_id.purchase_id, 'purchase_type', False)
if purchase_type:
self = self.with_context(stock_picking=purchase_type)
bom = self.env['mrp.bom'].sudo()._bom_subcontract_find(
self.product_id,
picking_type=self.picking_type_id,
company_id=self.company_id.id,
bom_type='subcontract',
subcontractor=self.picking_id.partner_id
)
return bom
class ReStockQuant(models.Model): class ReStockQuant(models.Model):
_inherit = 'stock.quant' _inherit = 'stock.quant'

View File

@@ -44,7 +44,8 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
if productions: if productions:
# 修改需求计划中的程序工时 # 修改需求计划中的程序工时
demand_plan = request.env['sf.production.demand.plan'].with_user( demand_plan = request.env['sf.production.demand.plan'].with_user(
request.env.ref("base.user_admin")).search([('model_id', '=', ret['folder_name'])]) request.env.ref("base.user_admin")).search(
[('model_id', '=', ret['folder_name']), ('new_supply_method', '=', 'custom_made')])
if demand_plan and ret['total_estimated_time']: if demand_plan and ret['total_estimated_time']:
demand_plan.write( demand_plan.write(
{'processing_time': ret['total_estimated_time']}) {'processing_time': ret['total_estimated_time']})

View File

@@ -9,6 +9,7 @@ from odoo import models
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
from odoo.addons.sf_base.commons.common import Common from odoo.addons.sf_base.commons.common import Common
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -178,6 +179,7 @@ class sfMaterialModel(models.Model):
materials_model.mf_materia_post = item['mf_materia_post'] materials_model.mf_materia_post = item['mf_materia_post']
materials_model.materials_id = materials.id materials_model.materials_id = materials.id
materials_model.need_h = item['need_h'] materials_model.need_h = item['need_h']
materials_model.need_m = item['need_m']
materials_model.density = item['density'] materials_model.density = item['density']
materials_model.active = item['active'] materials_model.active = item['active']
else: else:
@@ -192,6 +194,7 @@ class sfMaterialModel(models.Model):
"active": item['active'], "active": item['active'],
"materials_id": materials.id, "materials_id": materials.id,
"need_h": item['need_h'], "need_h": item['need_h'],
"need_m": item['need_m'],
"mf_materia_post": item['mf_materia_post'], "mf_materia_post": item['mf_materia_post'],
"density": item['density'], "density": item['density'],
}) })
@@ -228,6 +231,7 @@ class sfMaterialModel(models.Model):
"standards_id": self.env['sf.international.standards'].search( "standards_id": self.env['sf.international.standards'].search(
[("name", '=', item['standards_id'])]).id, [("name", '=', item['standards_id'])]).id,
"need_h": item['need_h'], "need_h": item['need_h'],
"need_m": item['need_m'],
"alloy_code": item['alloy_code'], "alloy_code": item['alloy_code'],
"mf_materia_post": item['mf_materia_post'], "mf_materia_post": item['mf_materia_post'],
"density": item['density'], "density": item['density'],
@@ -248,6 +252,7 @@ class sfMaterialModel(models.Model):
materials_model.mf_materia_post = item['mf_materia_post'] materials_model.mf_materia_post = item['mf_materia_post']
materials_model.materials_id = materials.id materials_model.materials_id = materials.id
materials_model.need_h = item['need_h'] materials_model.need_h = item['need_h']
materials_model.need_m = item['need_m']
materials_model.density = item['density'] materials_model.density = item['density']
materials_model.active = item['active'] materials_model.active = item['active']
materials_model.materials_code= item['materials_code'] materials_model.materials_code= item['materials_code']
@@ -1610,6 +1615,10 @@ class SyncfixtureMaterialsBasicParameters(models.Model):
self._write_or_create(all_list.get('adapter_board_yesterday_list'), '转接板(锁板)夹具') self._write_or_create(all_list.get('adapter_board_yesterday_list'), '转接板(锁板)夹具')
if all_list.get('scroll_chuck_all_list'): if all_list.get('scroll_chuck_all_list'):
self._write_or_create(all_list.get('scroll_chuck_yesterday_list'), '三爪卡盘') self._write_or_create(all_list.get('scroll_chuck_yesterday_list'), '三爪卡盘')
if all_list.get('air_blow_tray_all_list'):
self._write_or_create(all_list.get('air_tray_yesterday_list'), '气吸托盘')
if all_list.get('magnet_tray_all_list'):
self._write_or_create(all_list.get('magnet_tray_yesterday_list'), '磁吸托盘')
else: else:
raise ValidationError("夹具型号基本参数认证未通过") raise ValidationError("夹具型号基本参数认证未通过")
@@ -1638,6 +1647,10 @@ class SyncfixtureMaterialsBasicParameters(models.Model):
self._write_or_create(all_list.get('adapter_board_all_list'), '转接板(锁板)夹具') self._write_or_create(all_list.get('adapter_board_all_list'), '转接板(锁板)夹具')
if all_list.get('scroll_chuck_all_list'): if all_list.get('scroll_chuck_all_list'):
self._write_or_create(all_list.get('scroll_chuck_all_list'), '三爪卡盘') self._write_or_create(all_list.get('scroll_chuck_all_list'), '三爪卡盘')
if all_list.get('air_blow_tray_all_list'):
self._write_or_create(all_list.get('air_tray_all_list'), '气吸托盘')
if all_list.get('magnet_tray_all_list'):
self._write_or_create(all_list.get('magnet_tray_all_list'), '磁吸托盘')
else: else:
raise ValidationError("夹具型号基本参数认证未通过") raise ValidationError("夹具型号基本参数认证未通过")

View File

@@ -45759,6 +45759,11 @@ msgstr ""
msgid "热处理" msgid "热处理"
msgstr "" msgstr ""
#. module: sf_base
#: model:ir.model.fields,field_description:sf_base.field_sf_materials_model__need_m
msgid "是否磁吸"
msgstr ""
#. module: sf_base #. module: sf_base
#: model:ir.model.fields,field_description:sf_base.field_sf_materials_model__mf_materia_post #: model:ir.model.fields,field_description:sf_base.field_sf_materials_model__mf_materia_post
msgid "热处理后密度" msgid "热处理后密度"

View File

@@ -22,6 +22,7 @@
'data/report_actions.xml', 'data/report_actions.xml',
'views/view.xml', 'views/view.xml',
'views/quality_cnc_test_view.xml', 'views/quality_cnc_test_view.xml',
'views/stock_picking.xml',
'views/mrp_workorder.xml', 'views/mrp_workorder.xml',
'views/quality_check_view.xml', 'views/quality_check_view.xml',
'views/quality_company.xml', 'views/quality_company.xml',

View File

@@ -148,7 +148,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<img src="/sf_quality/static/img/pass.png" style="width: 200px; height: 200px;position: absolute; bottom: 20px; right: 20%;"/> <img src="/sf_quality/static/img/pass.png" style="width: 100px; height: 100px; position: absolute; bottom: -100px; left: 90px;"/>
</div> </div>
<div style="clear: both; margin-top: 30px; padding-top: 10px;"> <div style="clear: both; margin-top: 30px; padding-top: 10px;">
@@ -200,11 +200,11 @@
<p></p> <p></p>
</div> </div>
</div> --> </div> -->
<!-- 页脚固定在底部 --> <!-- 页脚固定在底部 -->
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
<t t-call="sf_quality.report_quality_footer"/> <!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
<!-- </div> --> <t t-call="sf_quality.report_quality_footer"/>
<!-- </div> -->
</div> </div>
</t> </t>
</t> </t>
@@ -275,7 +275,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<img src="/sf_quality/static/img/pass.png" style="width: 200px; height: 200px;position: absolute; bottom: 20px; right: 20%;"/> <img src="/sf_quality/static/img/pass.png" style="width: 100px; height: 100px; position: absolute; bottom: -100px; left: 90px;"/>
</div> </div>
<div style="clear: both; margin-top: 30px; padding-top: 10px;"> <div style="clear: both; margin-top: 30px; padding-top: 10px;">
@@ -329,9 +329,11 @@
</div> --> </div> -->
<!-- 页脚固定在底部 --> <!-- 页脚固定在底部 -->
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> --> <!-- <t t-if="loop.index == len(docs) - 1">-->
<t t-call="sf_quality.html_report_quality_footer"/> <!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
<!-- </div> --> <t t-call="sf_quality.html_report_quality_footer"/>
<!-- </div> -->
<!-- </t>-->
</div> </div>
</t> </t>
</t> </t>

View File

@@ -1,59 +1,185 @@
from odoo import api, models import logging
from odoo import api, models, fields
from odoo.exceptions import ValidationError, UserError
class StockPicking(models.Model): class StockPicking(models.Model):
_inherit = 'stock.picking' _inherit = 'stock.picking'
whether_show_quality_check = fields.Boolean('是否显示质量检测按钮', default=True)
def _compute_check(self):
super()._compute_check()
for picking in self:
picking_to_quality = picking.get_picking_to_quality()
if not picking_to_quality:
picking.quality_check_todo = False
picking.whether_show_quality_check = False
break
else:
picking.whether_show_quality_check = True
need_quality_line = picking.get_need_quality_line(picking_to_quality)
if not need_quality_line or all(not line.get('need_done_check_ids') for line in need_quality_line):
picking.quality_check_todo = False
def check_quality(self):
self.ensure_one()
# checkable_products = self.mapped('move_line_ids').mapped('product_id')
# checks = self.check_ids.filtered(lambda check: check.quality_state == 'none' and (
# check.product_id in checkable_products or check.measure_on == 'operation'))
checks = self.env['quality.check']
picking_to_quality = self._get_picking_to_quality()
need_quality_line = self.get_need_quality_line(picking_to_quality)
if need_quality_line and any(line.get('need_done_check_ids') for line in need_quality_line):
for item in need_quality_line:
checks += item.get('need_done_check_ids')
if checks:
return checks.action_open_quality_check_wizard()
return False
def button_validate(self): def button_validate(self):
""" """=
出厂检验报告上传 出厂检验报告上传
""" """
out_quality_checks = self.env['quality.check'].search( out_quality_checks = self.env['quality.check'].search(
[('picking_id', '=', self.id), ('test_type_id.name', '=', '出厂检验报告')]) [('picking_id', '=', self.id), ('test_type_id.name', '=', '出厂检验报告'),
('quality_state', '=', 'pass')])
# out_quality_checks 可能存在多个 # out_quality_checks 可能存在多个
if out_quality_checks: if out_quality_checks:
for out_quality_check in out_quality_checks: for out_quality_check in out_quality_checks:
if not out_quality_check.is_factory_report_uploaded: if not out_quality_check.is_factory_report_uploaded:
if out_quality_check and self.state == 'assigned': if out_quality_check and self.state == 'assigned':
out_quality_check.upload_factory_report() out_quality_check.upload_factory_report()
quality_action = self.pinking_checkout_quality()
if quality_action:
return quality_action
res = super(StockPicking, self).button_validate()
return res
def pinking_checkout_quality(self):
""" """
调拨单若关联了质量检查单,验证调拨单时,应校验是否有不合格品,若存在,应弹窗提示: 调拨单若关联了质量检查单,验证调拨单时,应校验是否有不合格品,若存在,应弹窗提示:
“警告存在不合格产品XXXX n 件、YYYYY m件继续调拨请点“确认”否则请取消 “警告存在不合格产品XXXX n 件、YYYYY m件继续调拨请点“确认”否则请取消
""" """
context = self.env.context try:
if not context.get('again_validate') and self.quality_check_ids.filtered(lambda qc: qc.quality_state == 'fail'): self.ensure_one()
# 回滚事务,为二次确认/取消做准备 context = self.env.context
self.env.cr.rollback() if not context.get('pinking_checkout_quality'):
quality_check_ids = self.quality_check_ids.filtered(lambda qc: qc.quality_state == 'fail') picking_to_quality = self._get_picking_to_quality()
product_list = list(set([quality_check_id.product_id for quality_check_id in quality_check_ids])) if not picking_to_quality: return False
fail_check_text = '' need_quality_val = self.get_need_quality_line(picking_to_quality)
for product_id in product_list: if any(line.get('fail_check_ids') for line in need_quality_val):
check_ids = quality_check_ids.filtered(lambda qc: qc.product_id == product_id) # 回滚事务,为二次确认/取消做准备
if all(check_id.measure_on == 'move_line' for check_id in check_ids): self.env.cr.rollback()
number = sum(check_ids.mapped('qty_line')) # 获取存在失败的 质检单 调拨单明细行
else: check_list = [item for item in need_quality_val if item.get('fail_check_ids')]
number = sum(self.move_ids_without_package.filtered( fail_check_text = ''
lambda ml: ml.product_id == product_id).mapped('quantity_done')) for item in check_list:
if number == 0: move_id, pre_done_qty = item.get('move_id'), item.get('pre_done_qty')
number = sum(self.move_ids_without_package.filtered( fail_check_text = (f'{fail_check_text}{move_id.product_id.display_name} {pre_done_qty}'
lambda ml: ml.product_id == product_id).mapped('reserved_availability')) if fail_check_text != '' else f'{move_id.product_id.display_name} {pre_done_qty}')
if number == 0: return {
number = sum(self.move_ids_without_package.filtered( 'type': 'ir.actions.act_window',
lambda ml: ml.product_id == product_id).mapped('product_uom_qty')) 'res_model': 'picking.validate.check.wizard',
fail_check_text = (f'{fail_check_text}{product_id.display_name} {number}' 'name': '质检不合格提示',
if fail_check_text != '' else f'{product_id.display_name} {number}') 'view_mode': 'form',
return { 'target': 'new',
'type': 'ir.actions.act_window', 'context': {
'res_model': 'picking.validate.check.wizard', 'default_picking_id': self.id,
'name': '质检不合格提示', 'default_fail_check_text': f'警告:存在不合格产品{fail_check_text},继续调拨请点“确认”,否则请取消?',
'view_mode': 'form', 'pinking_checkout_quality': True}
'target': 'new', }
'context': { else:
'default_picking_id': self.id, return False
'default_fail_check_text': f'警告:存在不合格产品{fail_check_text},继续调拨请点“确认”,否则请取消?', except Exception as e:
'again_validate': True} logging.info('pinking_checkout_quality()方法报错:%s' % e)
} raise ValidationError('调拨单验证质检单是否合格时报错,请联系管理员处理!!')
res = super(StockPicking, self).button_validate()
def get_need_quality_line(self, picking_to_quality):
"""
# 对需要进行质检,还没有质检完成的明细行进行统计
# 1、当【质量标准_控制方式】=“产品、作业”,仅校验“预完成数量”>0的产品行对应的质检单必须处理。
2、当【质量标准_控制方式】=“数量”时,仅校验“预完成数量”>0的产品行对应的质检单必须处理
1每一类的“总单数”=【调拨单_需求】时则已处理的质检单“单数”≥“预完成数量”时可执行调拨单验证
2每一类的“总单数”<【调拨单_需求】时则已处理的质检单“单数”≥0时可执行调拨单验证
"""
res = []
for item in picking_to_quality:
need_done_check_ids = self.env['quality.check']
fail_check_ids = self.env['quality.check']
move_id, pre_done_qty, check_ids = item.values()
check_ids_1 = check_ids.filtered(lambda qc: qc.measure_on in ('operation', 'product'))
if check_ids_1:
check_ids_1_done = check_ids_1.filtered(lambda qc: qc.quality_state in ('pass', 'fail'))
check_ids_1_fail = check_ids_1.filtered(lambda qc: qc.quality_state == 'fail')
check_ids_1_none = check_ids_1.filtered(lambda qc: qc.quality_state == 'none')
if check_ids_1 and not check_ids_1_done:
need_done_check_ids += check_ids_1_none
if check_ids_1_fail:
fail_check_ids += check_ids_1_fail
check_ids_2 = check_ids.filtered(lambda qc: qc.measure_on == 'move_line')
if check_ids_2:
check_ids_2_done = check_ids_2.filtered(lambda qc: qc.quality_state in ('pass', 'fail'))
check_ids_2_fail = check_ids_2.filtered(lambda qc: qc.quality_state == 'fail')
check_ids_2_none = check_ids_2.filtered(lambda qc: qc.quality_state == 'none')
# 每一类的“总单数”=【调拨单_需求】时则已处理的质检单“单数”≥“预完成数量”时可执行调拨单验证
if len(check_ids_2) >= move_id.product_uom_qty and len(check_ids_2_done) < pre_done_qty:
need_done_check_ids += check_ids_2_none
# 每一类的“总单数”<【调拨单_需求】时则已处理的质检单“单数”≥0时可执行调拨单验证
elif len(check_ids_2) < move_id.product_uom_qty and len(check_ids_2_done) == 0:
need_done_check_ids += check_ids_2_none
if check_ids_2_fail:
fail_check_ids += check_ids_2_fail
if need_done_check_ids or fail_check_ids:
res.append({'move_id': move_id,
'pre_done_qty': pre_done_qty,
'check_ids': check_ids,
'fail_check_ids': fail_check_ids,
'need_done_check_ids': need_done_check_ids})
return res return res
def get_picking_to_quality(self):
self.ensure_one()
return self._get_picking_to_quality()
def _get_picking_to_quality(self):
"""
对需要质检的明细行进行统计(针对“预完成数量”>0的行)
"""
quality_piking_line_list = []
pre_done_qty_lines = self._get_pinking_pre_done_qty()
for line in pre_done_qty_lines:
move_id, pre_done_qty = line.values()
if pre_done_qty == 0:
continue
product_id = move_id.product_id
check_ids = self.check_ids.filtered(lambda c: c.product_id == product_id)
quality_piking_line_list.append({'move_id': move_id, 'pre_done_qty': pre_done_qty, 'check_ids': check_ids})
return quality_piking_line_list
def _get_pinking_pre_done_qty(self):
"""
return: 明细行 及 预完成数量
1、若调拨单所有明细行的【完成】=0且任意行的【预留】<【需求】,则验证时将会话是否需创建欠单。
---->此时“预完成数量”=【预留】
2、若调拨单任意行的0<【完成】<【需求】,且则验证时将会话是否需创建欠单
---->此时“预完成数量”=【完成】
"""
# if all(move_id.quantity_done == 0 for move_id in self.move_ids_without_package):
# pre_done_qty = [{'move_id': move_id, 'pre_done_qty': move_id.reserved_availability} for move_id in
# self.move_ids_without_package]
# else:
# pre_done_qty = [{'move_id': move_id, 'pre_done_qty': move_id.quantity_done} for move_id in
# self.move_ids_without_package]
pre_done_qty = []
for move_id in self.move_ids_without_package:
if move_id.quantity_done > 0:
pre_done_qty.append({'move_id': move_id, 'pre_done_qty': move_id.quantity_done})
else:
pre_done_qty.append({'move_id': move_id, 'pre_done_qty': move_id.reserved_availability})
return pre_done_qty

View File

@@ -66,7 +66,7 @@
<attribute name="string">不合格</attribute> <attribute name="string">不合格</attribute>
</xpath> </xpath>
<xpath expr="//header//button[@name='do_fail'][2]" position="attributes"> <xpath expr="//header//button[@name='do_fail'][2]" position="attributes">
<attribute name="attrs">{'invisible': ['|',('quality_state', '!=', 'pass'),('work_state','in', ('done', 'rework'))]}</attribute> <attribute name="attrs">{'invisible': ['|','|',('quality_state', '!=', 'pass'),('work_state','in', ('done', 'rework')),'&amp;',('quality_state', '=', 'pass'), ('test_type', '=', 'factory_inspection')]}</attribute>
<attribute name="string">不合格</attribute> <attribute name="string">不合格</attribute>
</xpath> </xpath>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="stock_picking_view_form_inherit_quality_sf_quality" model="ir.ui.view">
<field name="name">stock.picking.view.form.sf.quality</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="quality_control.stock_picking_view_form_inherit_quality"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<field name="whether_show_quality_check" invisible="1"/>
</xpath>
<xpath expr="//button[@name='action_open_quality_check_picking'][1]" position="attributes">
<attribute name="attrs">{'invisible': ['|', '|','|', ('check_ids', '=', []), ('quality_check_fail', '=',
True), ('quality_check_todo', '!=', True), ('whether_show_quality_check', '!=', True)]}
</attribute>
</xpath>
<xpath expr="//button[@name='action_open_quality_check_picking'][2]" position="attributes">
<attribute name="attrs">{'invisible': ['|', '|','|', ('check_ids', '=', []), ('quality_check_fail', '=',
True), ('quality_check_todo', '=', True), ('whether_show_quality_check', '!=', True)]}
</attribute>
</xpath>
<xpath expr="//button[@name='action_open_quality_check_picking'][3]" position="attributes">
<attribute name="attrs">{'invisible': ['|', '|',('check_ids', '=', []), ('quality_check_fail', '!=',
True), ('whether_show_quality_check', '!=', True)]}
</attribute>
</xpath>
</field>
</record>
</odoo>

View File

@@ -63,6 +63,7 @@ class ReSaleOrder(models.Model):
model_display_version = fields.Char('模型展示版本', default="v1") model_display_version = fields.Char('模型展示版本', default="v1")
customer_name = fields.Char('终端客户')
contract_code = fields.Char('合同编号') contract_code = fields.Char('合同编号')
contract_date = fields.Date('合同日期') contract_date = fields.Date('合同日期')
contract_document_id = fields.Many2one('documents.document', string='合同文件') contract_document_id = fields.Many2one('documents.document', string='合同文件')
@@ -154,10 +155,10 @@ class ReSaleOrder(models.Model):
'glb_url': item['glb_url'], 'glb_url': item['glb_url'],
'remark': item.get('remark'), 'remark': item.get('remark'),
'embryo_redundancy_id': item.get('embryo_redundancy_id'), 'embryo_redundancy_id': item.get('embryo_redundancy_id'),
'is_incoming_material': True if item.get('embryo_redundancy_id') else False, 'is_incoming_material': True if item.get('incoming_size') else False,
'manual_quotation': item.get('manual_quotation'), 'manual_quotation': item.get('manual_quotation'),
'model_id': item['model_id'], 'model_id': item['model_id'],
'delivery_end_date': item['delivery_end_date'], 'delivery_end_date': item['delivery_end_date']
} }
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals) return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
@@ -286,13 +287,12 @@ class ResaleOrderLine(models.Model):
check_status = fields.Selection(related='order_id.check_status') check_status = fields.Selection(related='order_id.check_status')
remark = fields.Char('备注') remark = fields.Char('备注')
is_incoming_material = fields.Boolean('客供料', compute='_compute_is_incoming_material', store=True) is_incoming_material = fields.Boolean('客供料', store=True)
embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余') embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余')
manual_quotation = fields.Boolean('人工编程', default=False) manual_quotation = fields.Boolean('人工编程', default=False)
model_url = fields.Char('模型文件地址') model_url = fields.Char('模型文件地址')
model_id = fields.Char('模型ID') model_id = fields.Char('模型ID')
delivery_end_date = fields.Date('客户交期')
delivery_end_date = fields.Date('交货截止日期')
@api.depends('embryo_redundancy_id') @api.depends('embryo_redundancy_id')
def _compute_is_incoming_material(self): def _compute_is_incoming_material(self):

View File

@@ -90,6 +90,9 @@
<field name="partner_id" position="replace"> <field name="partner_id" position="replace">
<field name="partner_id" widget="res_partner_many2one" context="{'is_customer': True }" <field name="partner_id" widget="res_partner_many2one" context="{'is_customer': True }"
options='{"always_reload": True,"no_create": True}'/> options='{"always_reload": True,"no_create": True}'/>
<field name="customer_name" readonly="1"/>
<field name="contract_code" readonly="1"/>
<field name="contract_date" readonly="1"/>
</field> </field>
<field name="payment_term_id" position="attributes"> <field name="payment_term_id" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute> <attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
@@ -138,7 +141,7 @@
<attribute name="optional">hide</attribute> <attribute name="optional">hide</attribute>
</xpath> </xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='remark']" position="before"> <xpath expr="//field[@name='order_line']/tree/field[@name='remark']" position="before">
<field name="delivery_end_date" optional="hide"/> <field name="delivery_end_date" optional="show"/>
</xpath> </xpath>
<field name="user_id" position="attributes"> <field name="user_id" position="attributes">

View File

@@ -818,6 +818,7 @@ class FunctionalToolAssembly(models.Model):
def _get_old_tool_material_lot(self, material_ids): def _get_old_tool_material_lot(self, material_ids):
""" 根据先进先出原则选择物料批次 """ """ 根据先进先出原则选择物料批次 """
material_ids = material_ids.filtered(lambda m: m.tracking != 'none')
location_id = self.env['stock.location'].search([('name', '=', '刀具房')]) location_id = self.env['stock.location'].search([('name', '=', '刀具房')])
stock_quant = self.env['stock.quant'].sudo().search( stock_quant = self.env['stock.quant'].sudo().search(
[('location_id', '=', location_id.id), ('product_id', 'in', material_ids.ids), ('quantity', '>', '0')], [('location_id', '=', location_id.id), ('product_id', 'in', material_ids.ids), ('quantity', '>', '0')],

View File

@@ -16,6 +16,7 @@
# 'security/sf_stock_security.xml', # 'security/sf_stock_security.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'wizard/wizard_view.xml', 'wizard/wizard_view.xml',
'views/product.xml',
'views/view.xml', 'views/view.xml',
'views/shelf_location.xml', 'views/shelf_location.xml',
'views/change_stock_move_views.xml', 'views/change_stock_move_views.xml',

View File

@@ -7,8 +7,14 @@ def migrate(cr, version):
env = api.Environment(cr, SUPERUSER_ID, {}) env = api.Environment(cr, SUPERUSER_ID, {})
sf_shelf_model = env["sf.shelf"] sf_shelf_model = env["sf.shelf"]
sf_shelf_location_model = env["sf.shelf.location"] sf_shelf_location_model = env["sf.shelf.location"]
preproduction_shelf_ids = sf_shelf_location_model.get_preproduction_shelf_ids()
shelves = sf_shelf_model.search([]) shelves = sf_shelf_model.search([])
for shelf in shelves: for shelf in shelves:
if shelf.id not in preproduction_shelf_ids:
continue
shelf_barcode = shelf.barcode or "" shelf_barcode = shelf.barcode or ""
if not shelf_barcode: if not shelf_barcode:
continue continue

View File

@@ -1,2 +1,3 @@
from . import model from . import model
from . import sync_common from . import sync_common
from . import product

View File

@@ -13,6 +13,7 @@ from odoo import api, fields, models, _
from odoo.osv import expression from odoo.osv import expression
from odoo.exceptions import UserError, ValidationError from odoo.exceptions import UserError, ValidationError
_logger = logging.getLogger(__name__)
class SfLocation(models.Model): class SfLocation(models.Model):
_inherit = 'stock.location' _inherit = 'stock.location'
@@ -459,7 +460,40 @@ class ShelfLocation(models.Model):
product_sn_ids = fields.One2many('sf.shelf.location.lot', 'shelf_location_id', string='产品批次号') product_sn_ids = fields.One2many('sf.shelf.location.lot', 'shelf_location_id', string='产品批次号')
# 产品数量 # 产品数量
product_num = fields.Integer('总数量', compute='_compute_number', store=True) product_num = fields.Integer('总数量', compute='_compute_number', store=True)
tool_rfid = fields.Char('Rfid', compute='_compute_tool', store=True)
tool_name_id = fields.Many2one('sf.functional.cutting.tool.entity', string='功能刀具名称', compute='_compute_tool', store=True)
display_rfid = fields.Char('RFID', compute='_compute_display_rfid', store=True)
@api.depends('product_sn_id')
def _compute_display_rfid(self):
"""计算显示 RFID"""
for record in self:
try:
record.display_rfid = record.product_sn_id.rfid if record.product_sn_id else ''
except Exception as e:
record.display_rfid = ''
@api.depends('product_id')
def _compute_tool(self):
"""计算工具 RFID"""
for record in self:
try:
if record.product_id:
if record.product_id.categ_id.name == '功能刀具':
# 搜索关联的功能刀具实体
tool_id = self.env['sf.functional.cutting.tool.entity'].search(
[('barcode_id', '=', record.product_sn_id.id)], limit=1
)
if tool_id:
record.tool_rfid = tool_id.rfid
record.tool_name_id = tool_id.id
continue
# 默认值
record.tool_rfid = ''
record.tool_name_id = False
except Exception as e:
record.tool_rfid = ''
record.tool_name_id = False
_logger.error(f"计算 tool_rfid 时出错: {e}")
@api.depends('product_num') @api.depends('product_num')
def _compute_product_num(self): def _compute_product_num(self):
for record in self: for record in self:
@@ -563,8 +597,27 @@ class ShelfLocation(models.Model):
else: else:
_layer_capacity = _layer_capacity _layer_capacity = _layer_capacity
_layer = _layer+1 _layer = _layer+1
_layer_capacity = f"{_layer_capacity:02d}"
record.kanban_show_layer_info=f"{_layer}-{_layer_capacity}" record.kanban_show_layer_info=f"{_layer}-{_layer_capacity}"
record.kanban_show_center_control_code=f"{_cc_code}" record.kanban_show_center_control_code=f"{_cc_code}"
@api.model
def get_preproduction_shelf_ids(self):
"""
获取预生产区域的货架ID列表
Returns:
list: 货架ID列表
"""
query = """
SELECT DISTINCT b.shelf_id
FROM stock_location a
LEFT JOIN sf_shelf_location b ON a.id = b.location_id
WHERE a.barcode LIKE 'WH-PREPRODUCTION'
"""
self.env.cr.execute(query)
result = self.env.cr.fetchall()
# 将结果转换为ID列表
shelf_ids = [record[0] for record in result if record[0]]
return shelf_ids
class SfShelfLocationLot(models.Model): class SfShelfLocationLot(models.Model):
_name = 'sf.shelf.location.lot' _name = 'sf.shelf.location.lot'
@@ -583,6 +636,7 @@ class SfShelfLocationLot(models.Model):
raise ValidationError('变更数量不能比库存数量大!!!') raise ValidationError('变更数量不能比库存数量大!!!')
class SfStockMoveLine(models.Model): class SfStockMoveLine(models.Model):
_name = 'stock.move.line' _name = 'stock.move.line'
_inherit = ['stock.move.line', 'printing.utils'] _inherit = ['stock.move.line', 'printing.utils']
@@ -1028,6 +1082,10 @@ class SfStockPicking(models.Model):
重写验证方法,当验证时意味着调拨单已经完成,已经移动到了目标货位,所以需要将当前货位的状态改为空闲 重写验证方法,当验证时意味着调拨单已经完成,已经移动到了目标货位,所以需要将当前货位的状态改为空闲
""" """
res = super(SfStockPicking, self).button_validate() res = super(SfStockPicking, self).button_validate()
if any(ml.state == 'done' for ml in self.move_line_ids):
# 验证产品库存为负库存问题
self.move_ids.product_id.verify_product_repertory(self.location_id)
for line in self.move_line_ids: for line in self.move_line_ids:
if line: if line:
if line.destination_location_id: if line.destination_location_id:

View File

@@ -0,0 +1,29 @@
from odoo import models, fields
from odoo.exceptions import ValidationError
class SfProductCategory(models.Model):
_inherit = 'product.category'
negative_inventory_allowed = fields.Boolean('可负库存', default=True)
class SfProductTemplate(models.Model):
_inherit = 'product.product'
def verify_product_repertory(self, location_id):
"""
验证产品 负库存
"""
if not location_id:
raise ValidationError('当前位置为空!!')
elif len(location_id) != 1:
raise ValidationError(f'存在多个当前位置{[item.name for item in location_id]}')
elif location_id.usage == 'supplier':
return True
for pp in self:
if not pp.categ_id.negative_inventory_allowed:
sq = pp.stock_quant_ids.filtered(lambda sq: sq.quantity < 0 and sq.location_id == location_id)
if sq:
raise ValidationError(
f'产品{pp.name}的产品类型设置为不可负库存,当前操作会导致产品{pp.name}在库存{location_id.name}上的库存数量为负!!!')

View File

@@ -1,128 +1,198 @@
// 定义一个 mixin 来处理重复的样式 // 定义看板公共样式的Mixin
@mixin kanban-common-styles($record-count-each-row, @mixin kanban-common-styles($record-count-each-row, $record-gap: 16px) {
$record-gap: 16px,
$color-guide-width: 70px) {
$record-gap-total-width: $record-gap * ($record-count-each-row - 1); $record-gap-total-width: $record-gap * ($record-count-each-row - 1);
display: flex !important; display: flex !important;
flex-wrap: wrap !important; flex-wrap: wrap !important;
overflow-x: hidden !important; overflow-x: hidden !important;
overflow-y: auto !important; overflow-y: auto !important;
padding: 0px !important; padding: 0 !important;
gap: $record-gap !important; gap: $record-gap !important;
width: 100% !important; width: 100% !important;
height: 100% !important; height: 100% !important;
// 设置卡片样式 // === 卡片基础样式(完全保留)===
.o_kanban_record { .o_kanban_record {
flex: 0 0 calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important; flex: 0 0 calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
height: calc((100% - #{$record-gap * 6}) / 6) !important; // 平均分配高度 height: calc((100% - #{$record-gap * 6}) / 6) !important;
margin: 0 !important; margin: 0 !important;
padding: 0px !important; padding: 0 !important;
background-color: white !important; background-color: white !important;
border: 1px solid #dee2e6 !important; border: 1px solid #dee2e6 !important;
border-radius: 4px !important; border-radius: 4px !important;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
min-width: calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important; min-width: calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
max-width: calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important; max-width: calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
position: relative;
transition: all 0.25s ease !important;
overflow: visible !important; // 允许悬停条溢出卡片边界
// === 状态标签(保留原设计)===
.status-label {
position: absolute;
top: 8px;
right: 8px;
padding: 3px 8px;
background: rgba(255, 255, 255, 0.9);
border: 1px solid #e0e0e0;
border-radius: 3px;
font-size: 11px;
color: #424242;
z-index: 2;
}
// === 优化:悬停信息条(核心改动)===
.status-hover-bar {
position: absolute;
bottom: calc(100% + 8px); // 默认显示在卡片上方
left: 0;
z-index: 1000;
min-width: max-content; // 宽度自适应内容
max-width: 300px; // 防止过宽
padding: 10px 12px;
background: rgba(255, 255, 255, 0.95);
border: 1px solid #e0e0e0;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
font-size: 12px;
color: #424242;
white-space: nowrap; // 强制单行显示
opacity: 0;
pointer-events: none; // 避免阻挡卡片交互
transition: opacity 0.2s ease, transform 0.2s ease;
transform: translateY(10px);
// 三角形指示器
&::after {
content: '';
position: absolute;
top: 100%;
left: 15px;
border: 6px solid transparent;
border-top-color: rgba(0, 0, 0, 0.85);
}
div {
margin-bottom: 4px;
line-height: 1.4;
}
}
// === 悬停触发逻辑 ===
&:hover {
transform: translateY(-4px) !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
z-index: 10;
.status-hover-bar {
background: rgba(50, 50, 50, 0.9);
color: #fff !important;
font-size: 12px;
opacity: 0.9;
transform: translateY(0);
pointer-events: auto; // 悬停时允许交互
}
}
// === 边界保护(智能定位)===
// 左侧卡片:左对齐
&:nth-child(#{$record-count-each-row}n+1) .status-hover-bar {
left: 0;
right: auto;
&::after { left: 15px; }
}
// 右侧卡片:右对齐
&:nth-child(#{$record-count-each-row}n) .status-hover-bar {
left: auto;
right: 0;
&::after {
left: auto;
right: 15px;
}
}
&:nth-child(#{$record-count-each-row}n + #{$record-count-each-row - 1}) .status-hover-bar {
left: auto;
right: 0;
&::after {
left: auto;
right: 15px;
}
}
// 顶部卡片:悬停条显示在下方
&:nth-child(-n+#{$record-count-each-row}) .status-hover-bar {
bottom: auto;
top: calc(100% + 8px);
&::after {
top: auto;
bottom: 100%;
border-top-color: transparent;
border-bottom-color: rgba(255, 255, 255, 0.95);
}
}
// === 禁用状态样式(保留原效果)===
&.kanban_color_3 {
opacity: 0.6;
&:hover { &:hover {
transform: translateY(-1px) !important; opacity: 0.85;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !important; .status-hover-bar {
} background:rgba(0, 0, 0, 0.85);
color: white !important;
.o_kanban_record_bottom { border: 1px solid rgba(255, 255, 255, 0.15) !important;
margin: 0; }
}
.oe_kanban_card.kanban_color_3,
.oe_kanban_card.kanban_color_1,
.oe_kanban_card.kanban_color_2 {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
.sf_kanban_custom_location_info_style {
display: flex !important;
justify-content: center !important;
align-items: center !important;
width: 100%;
font-size: 14px;
color: #000000;
}
.sf_kanban_no {
display: flex !important;
justify-content: center !important;
align-items: center !important;
font-size: 18px;
color: #000000;
}
} }
}
} }
} }
// 使用 mixin 为不同的列数生成样式 // === 看板视图样式(完全保留)===
.o_kanban_view { .o_kanban_view {
.sf_kanban_location_style { // 卡片内部结构(不修改)
// 设置卡片样式 .o_kanban_record {
.o_kanban_record { .o_kanban_record_bottom {
margin: 0;
&:hover { }
transform: translateY(-1px) !important; .oe_kanban_card.kanban_color_3,
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !important; .oe_kanban_card.kanban_color_1,
} .oe_kanban_card.kanban_color_2 {
display: flex;
.o_kanban_record_bottom { flex-direction: column;
margin: 0; justify-content: center;
} align-items: center;
width: 100%;
.oe_kanban_card.kanban_color_3, height: 100%;
.oe_kanban_card.kanban_color_1, .sf_kanban_custom_location_info_style {
.oe_kanban_card.kanban_color_2 { display: flex !important;
display: flex; justify-content: center !important;
flex-direction: column; align-items: center !important;
justify-content: center; width: 100%;
align-items: center; font-size: 15px;
width: 100%; color: #000000;
height: 100%; padding:0px;
.sf_kanban_custom_location_info_style {
display: flex !important;
justify-content: center !important;
align-items: center !important;
width: 100%;
font-size: 14px;
color: #000000;
}
.sf_kanban_no {
display: flex !important;
justify-content: center !important;
align-items: center !important;
font-size: 18px;
color: #000000;
}
}
} }
.sf_kanban_no {
display: flex !important;
justify-content: center !important;
align-items: center !important;
font-size: 18px;
color: #000000;
}
}
} }
// 不同列数的看板样式
.sf_kanban_location_style12 { .sf_kanban_location_style12 {
@include kanban-common-styles(12); @include kanban-common-styles(12);
} }
.sf_kanban_location_style19 { .sf_kanban_location_style19 {
@include kanban-common-styles(19); @include kanban-common-styles(19);
} }
.sf_kanban_location_style4 { .sf_kanban_location_style4 {
@include kanban-common-styles(4); @include kanban-common-styles(4);
} }
.sf_kanban_location_style3 { .sf_kanban_location_style3 {
@include kanban-common-styles(3); @include kanban-common-styles(3);
} }
} }

View File

@@ -28,8 +28,18 @@ class CustomKanbanController extends KanbanController {
isBaseStyle: true isBaseStyle: true
}); });
let self = this; let self = this;
// 获取货架分层数据
onWillStart(async () => { onWillStart(async () => {
try {
this.preproductionShelfIds = await this.orm.call(
'sf.shelf.location',
'get_preproduction_shelf_ids',
[]
);
} catch (error) {
this.preproductionShelfIds = [];
}
this.searchModel.on('update', self, self._onUpdate); this.searchModel.on('update', self, self._onUpdate);
await this.loadShelfLayersData(); await this.loadShelfLayersData();
}); });
@@ -50,7 +60,11 @@ class CustomKanbanController extends KanbanController {
let domain = this.searchModel.domain; let domain = this.searchModel.domain;
if (domain.length > 0) { if (domain.length > 0) {
let shelfDomain = domain.find(item => item[0] === 'shelf_id'); let shelfDomain = domain.find(item => item[0] === 'shelf_id');
this.onShelfChange(shelfDomain[2]); if (shelfDomain && shelfDomain[2] && this.preproductionShelfIds && this.preproductionShelfIds.includes(shelfDomain[2])) {
this.onShelfChange(shelfDomain[2]);
} else {
this.setKanbanStyle('sf_kanban_location_style');
}
} else { } else {
this.setKanbanStyle('sf_kanban_location_style'); this.setKanbanStyle('sf_kanban_location_style');
} }
@@ -63,8 +77,7 @@ class CustomKanbanController extends KanbanController {
let shelfDomain = domain.find(item => item[0] === 'shelf_id'); let shelfDomain = domain.find(item => item[0] === 'shelf_id');
if (shelfDomain) { if (shelfDomain) {
let shelfId = shelfDomain[2]; let shelfId = shelfDomain[2];
// 如果货架ID存在则设置相应的样式 if (shelfId && this.preproductionShelfIds.includes(shelfId)) {
if (shelfId) {
this.onShelfChange(shelfId); this.onShelfChange(shelfId);
return; return;
} }
@@ -75,7 +88,6 @@ class CustomKanbanController extends KanbanController {
this.setKanbanStyle('sf_kanban_location_style'); this.setKanbanStyle('sf_kanban_location_style');
} catch (error) { } catch (error) {
} }
} }
// 加载所有货架的层数数据 // 加载所有货架的层数数据
@@ -107,10 +119,18 @@ class CustomKanbanController extends KanbanController {
// 添加新类 // 添加新类
if (isHave) kanbanViewEl.classList.add(style); if (isHave) kanbanViewEl.classList.add(style);
} }
const ghostCards = document.querySelectorAll('.o_kanban_ghost');
ghostCards.forEach(card => { // 获取当前的搜索域
card.remove(); let domain = this.searchModel.domain;
}); let shelfDomain = domain.find(item => item[0] === 'shelf_id');
// 只有当shelf_id在preproductionShelfIds中时才删除幽灵看板
if (shelfDomain && this.preproductionShelfIds && this.preproductionShelfIds.includes(shelfDomain[2])) {
const ghostCards = document.querySelectorAll('.o_kanban_ghost');
ghostCards.forEach(card => {
card.remove();
});
}
} }
updatePagerLimit(limit) { updatePagerLimit(limit) {

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="product_category_form_view_sf_warehouse" model="ir.ui.view">
<field name="name">product.category.property.form.warehouse</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="account.view_category_property_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='account_property']" position="after">
<group name="other">
<group string="其他">
<field name="negative_inventory_allowed"/>
</group>
</group>
</xpath>
</field>
</record>
</odoo>

View File

@@ -193,53 +193,78 @@
</field> </field>
</record> </record>
<record id="shelf_location_kanban_view" model="ir.ui.view"> <record id="shelf_location_kanban_view" model="ir.ui.view">
<field name="name">shelf.location.kanban</field> <field name="name">shelf.location.kanban</field>
<field name="model">sf.shelf.location</field> <field name="model">sf.shelf.location</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<kanban class="sf_kanban_location_style" js_class="custom_kanban" create="0"> <kanban class="sf_kanban_location_style" js_class="custom_kanban" create="0">
<templates> <templates>
<t t-name="kanban-box"> <t t-name="kanban-box">
<t t-set='isBaseStyle' t-value="user_context.isBaseStyle"/> <t t-set='isBaseStyle' t-value="user_context.isBaseStyle"/>
<div t-attf-class="oe_kanban_card oe_kanban_global_click <div t-attf-class="oe_kanban_card oe_kanban_global_click
#{record.location_status.raw_value == '空闲' ? 'kanban_color_1' : ''} #{record.location_status.raw_value == '空闲' ? 'kanban_color_1' : ''}
#{record.location_status.raw_value == '占用' ? 'kanban_color_2' : ''} #{record.location_status.raw_value == '占用' ? 'kanban_color_2' : ''}
#{record.location_status.raw_value == '禁用' ? 'kanban_color_3' : ''}"> #{record.location_status.raw_value == '禁用' ? 'kanban_color_3' : ''}">
<!-- 所有情况都需要的数据 (隐藏) --> <!-- 所有情况都需要的数据 (隐藏) -->
<div style="display:none"> <div style="display:none">
<field name="location_status"/> <field name="location_status"/>
<field name="tool_name_id"/>
</div>
<t t-if="isBaseStyle">
<div class="o_kanban_card_header">
<div class="o_kanban_card_header_title">
<field name="name"/>
</div> </div>
</div>
<div class="o_kanban_record_bottom">
<t t-if="isBaseStyle"> <field name="product_sn_id"/>
<div class="o_kanban_card_header"> <field name="product_id"/>
<div class="o_kanban_card_header_title">
<field name="name"/>
</div>
</div>
<div class="o_kanban_record_bottom">
<field name="product_sn_id"/>
<span>|</span>
<field name="product_id"/>
</div>
</t>
<t t-else="">
<div class="o_kanban_record_bottom sf_kanban_custom_location_info_style">
<field name="kanban_show_layer_info"/>
</div>
<div class="o_kanban_record_bottom sf_kanban_no">
<field name="kanban_show_center_control_code"/>
</div>
</t>
</div> </div>
</t> </t>
</templates>
</kanban>
</field>
</record>
<t t-else="">
<div class="o_kanban_record_bottom sf_kanban_custom_location_info_style">
<field name="kanban_show_layer_info"/>
</div>
<!-- 添加RFID字段 -->
<!-- <t t-if="record.data and record.data.display_rfid">
<div class="o_kanban_record_bottom">
<field name="display_rfid"/>
</div>
</t>
<t t-if="record.data and record.data.tool_rfid">
<div class="o_kanban_record_bottom">
<field name="tool_rfid"/>
</div>
</t> -->
<!-- 悬停时显示的详细信息 -->
<div class="status-hover-bar">
<t t-if="record.product_id.value">
<div>产品: <t t-esc="record.product_id.value"/></div>
</t>
<t t-if="record.product_sn_id.value">
<div>标签ID: <t t-esc="record.product_sn_id.value"/></div>
</t>
<!-- <t t-if="record.display_rfid.value">
<div>rfid: <t t-esc="record.display_rfid.value"/></div>
</t>
<t t-if="record.tool_rfid.value">
<div>rfid: <t t-esc="record.tool_rfid.value"/></div>
</t> -->
<t t-if="record.tool_name_id and record.tool_name_id.value">
<div>功能刀具名称: <t t-esc="record.tool_name_id.value"/></div>
</t>
<div>状态: <t t-esc="record.location_status.value"/></div>
</div>
</t>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!-- 搜索视图 --> <!-- 搜索视图 -->
<record id="shelf_location_search_view" model="ir.ui.view"> <record id="shelf_location_search_view" model="ir.ui.view">
<field name="name">shelf.location.search</field> <field name="name">shelf.location.search</field>