hunk.code_window:                             move_qty -= qty
           for move in todo_moves:
               if move.linked_move_operation_ids:
                   continue
               #then if the move isn't totally assigned, try to find quants without any specific domain
               if move.state != 'assigned':
                   qty_already_assigned = move.reserved_availability
                   qty = move.product_qty - qty_already_assigned
  
hunk.labels: keep keep keep replace replace keep keep keep keep
hunk.file_path: addons/stock/stock.py
hunk.type: replace
file: # -*- coding: utf-8 -*-
  
  from openerp import SUPERUSER_ID
  from openerp.osv import orm, fields
  
  
  class PaymentTransaction(orm.Model):
      _inherit = 'payment.transaction'
  
      _columns = {
          # link with the sale order
          'sale_order_id': fields.many2one('sale.order', 'Sale Order'),
      }
  
      def form_feedback(self, cr, uid, data, acquirer_name, context=None):
          """ Override to confirm the sale order, if defined, and if the transaction
          is done. """
          tx = None
          res = super(PaymentTransaction, self).form_feedback(cr, uid, data, acquirer_name, context=context)
  
          # fetch the tx, check its state, confirm the potential SO
          tx_find_method_name = '_%s_form_get_tx_from_data' % acquirer_name
          if hasattr(self, tx_find_method_name):
              tx = getattr(self, tx_find_method_name)(cr, uid, data, context=context)
          if tx and tx.state == 'done' and tx.acquirer_id.auto_confirm == 'at_pay_confirm' and tx.sale_order_id and tx.sale_order_id.state in ['draft', 'sent']:
              self.pool['sale.order'].action_confirm(cr, SUPERUSER_ID, [tx.sale_order_id.id], context=dict(context, send_email=True))
          elif tx and tx.state not in ['cancel', 'error'] and tx.sale_order_id and tx.sale_order_id.state in ['draft']:
              self.pool['sale.order'].force_quotation_send(cr, SUPERUSER_ID, [tx.sale_order_id.id], context=context)
  
          return res
  