取消采购申请部分确认生成的反向单据

This commit is contained in:
胡尧
2025-05-20 16:08:03 +08:00
parent 9f94a4e06f
commit c23715a1ef
6 changed files with 34 additions and 16 deletions

View File

@@ -13,4 +13,14 @@ class PurchaseOrder(models.Model):
('done', '完成'),
('cancel', '取消'),
('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)
def button_confirm(self):
res = super(PurchaseOrder, self).button_confirm()
# 取消反向调拨单
reverse_move_ids = self.env['stock.move'].search([('origin', '=', self.name), ('purchase_line_id', '=', False)])
if reverse_move_ids:
reverse_move_ids.picking_id.action_cancel()
return res