Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4580 มุมมอง

If product inventory is zero (0), process should not continue (SALES ORDER should not continue if the QUANTITY ON HAND of the product is zero. Any help please...

อวตาร
ละทิ้ง
ผู้เขียน

where can i see the warning_alert? in sales module?

ผู้เขียน คำตอบที่ดีที่สุด

my problem got solved by adding this code in  action_wait:

 order_line_ids = self.pool.get('sale.order.line').search(cr, uid, [('order_id', '=', o.id)])
            for so_line in self.pool.get('sale.order.line').browse(cr, uid, order_line_ids):
                  so_line_id = self.pool.get('product.product').search(cr, uid, [('id', '=', so_line.product_id.id)])
                  for bom in self.pool.get('mrp.bom').browse(cr, uid, so_line_id):   
                      xbom_id = self.pool.get('mrp.bom').search(cr, uid, [('product_id', '=', bom.id)]
                      for child_bom in self.pool.get('mrp.bom').browse(cr,uid,xbom_id):
                          child_bom_ids = self.pool.get('mrp.bom').search(cr,uid,[('id','=',child_bom.id)]
                          if (child_bom.product_id > child_bom.product_id.qty_available):  
                                raise osv.except_osv(_('Not enough Stock !'), _('You requested %.2f.The available Components is %s !') %(child_bom.product_qty, child_bom.product_id.qty_available))
                         

 

 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

We can user warning_alert for showing the alert that, stock is low. Then we can block the sales quotation.

อวตาร
ละทิ้ง
ผู้เขียน

where can i see the warning_alert? in sales module?