Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>def action_confirm(self, cr, uid, ids, context=None):</p> <pre><code> move_obj = self.pool.get('stock.move') for procurement in self.browse(cr, uid, ids, context=context): cr.execute("select id,order_id,foc from sale_order_line where product_id = %s and order_id= %s and foc = %s", (procurement.product_id.id, procurement.move_id.sale_line_id.order_id.id, procurement.foc,)) data = cr.fetchall() count = len(data) if count &gt;= 2: raise osv.except_osv(_('Data Duplicate!'), _('Please check the sale order line.Duplicate record can not allow.')) else: {} if procurement.product_qty &lt;= 0.00: raise osv.except_osv(_('Data Insufficient!'), _('Please check the quantity in procurement order(s) for the product "%s", it should not be 0 or less!' % procurement.product_id.name)) if procurement.product_id.type in ('product', 'consu'): if not procurement.move_id: source = procurement.location_id.id if procurement.procure_method == 'make_to_order': source = procurement.product_id.property_stock_procurement.id id = move_obj.create(cr, uid, { 'name': procurement.name, 'location_id': source, 'location_dest_id': procurement.location_id.id, 'product_id': procurement.product_id.id, 'product_qty': procurement.product_qty, 'foc':procurement.foc, 'product_uom': procurement.product_uom.id, 'date_expected': procurement.date_planned, 'state': 'draft', 'company_id': procurement.company_id.id, 'auto_validate': True, }) move_obj.action_confirm(cr, uid, [id], context=context) self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move': 1}) self.write(cr, uid, ids, {'state': 'confirmed', 'message': ''}) return True </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload