Compare commits
3 Commits
feature/71
...
feature/67
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4615f1576f | ||
|
|
c8f1676de9 | ||
|
|
f165bec662 |
@@ -31,12 +31,20 @@ class PurchaseOrder(models.Model):
|
|||||||
|
|
||||||
def button_cancel(self):
|
def button_cancel(self):
|
||||||
"""
|
"""
|
||||||
将取消的采购订单关联的库存移动撤销
|
1. 先将采购订单行与目标库存移动断开链接,避免采购单取消后,调拨单被调整为mts的问题
|
||||||
|
2. 取消采购订单
|
||||||
|
3. 将采购订单行与目标库存移动重新建立链接
|
||||||
"""
|
"""
|
||||||
move_ids = self.order_line.move_dest_ids.filtered(lambda move: move.state != 'done' and not move.scrapped)
|
created_purchase_request_line_ids = {}
|
||||||
|
if self.order_line.move_dest_ids.created_purchase_request_line_id:
|
||||||
|
move_ids = self.order_line.move_dest_ids.filtered(lambda move: move.state != 'done' and not move.scrapped)
|
||||||
|
created_purchase_request_line_ids = {move.id: move.created_purchase_request_line_id for move in move_ids}
|
||||||
|
self.order_line.write({'move_dest_ids': [(5, 0, 0)]})
|
||||||
res =super(PurchaseOrder, self).button_cancel()
|
res =super(PurchaseOrder, self).button_cancel()
|
||||||
if move_ids.mapped('created_purchase_request_line_id'):
|
for move_id, created_purchase_request_line_id in created_purchase_request_line_ids.items():
|
||||||
move_ids.write({'state': 'waiting', 'is_done': False})
|
self.env['stock.move'].browse(move_id).created_purchase_request_line_id = created_purchase_request_line_id
|
||||||
|
# if move_ids.mapped('created_purchase_request_line_id'):
|
||||||
|
# move_ids.write({'state': 'waiting', 'is_done': False})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
|
|||||||
@@ -912,17 +912,10 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
# ])
|
# ])
|
||||||
not_done_orders = work_order_obj.search(work_order_domain + [
|
not_done_orders = work_order_obj.search(work_order_domain + [
|
||||||
('state', 'in', ['ready', 'progress']),
|
('state', 'in', ['ready', 'progress']),
|
||||||
('date_planned_start', '>=', time_48_hours_ago)
|
('date_planned_start', '>=', time_48_hours_ago),
|
||||||
|
('date_planned_start', '<=', current_time)
|
||||||
], order='id asc'
|
], order='id asc'
|
||||||
)
|
)
|
||||||
# not_done_orders = request.env['mrp.workorder'].sudo().browse(plan_order_messages.mapped('res_id'))
|
|
||||||
# if line == '业绩总览':
|
|
||||||
# not_done_orders = not_done_orders.filtered(lambda o: o.routing_type in ['人工线下加工', 'CNC加工'])
|
|
||||||
# elif line == '人工线下加工中心':
|
|
||||||
# not_done_orders = not_done_orders.filtered(lambda o: o.routing_type == '人工线下加工')
|
|
||||||
# else:
|
|
||||||
# not_done_orders = not_done_orders.filtered(lambda o: o.routing_type == 'CNC加工' and o.production_line_id.name == line)
|
|
||||||
|
|
||||||
|
|
||||||
# 完成订单
|
# 完成订单
|
||||||
# 获取当前时间,并计算24小时前的时间
|
# 获取当前时间,并计算24小时前的时间
|
||||||
|
|||||||
Reference in New Issue
Block a user