hunk.code_window:     purchase_line = purchase_ids[0].order_line[0]
       assert purchase_line.product_qty == 29.0, 'As we ordered 2 Dozen(s) and 5 Unit(s), total should be 29 Unit(s) and not %s' % (purchase_line.product_qty,)
       # Let us cancel the procurement related to the 2nd sales order first and check that the 2 Dozen(s) are subtracted correctly
       so2 = self.pool.get('sale.order').browse(cr, uid, ref('sale_order_product_mto2'))
       self.cancel(cr, uid, [so2.order_line[0].procurement_ids[0].id], context=context)
  
hunk.labels: keep replace keep keep keep keep
hunk.after_edit:     assert purchase_line.product_qty == 5.0, 'The product quantity of the first order line should be 5 and not %s' % (purchase_line.product_qty,)
       assert purchase_line.product_uom.id == ref("product.product_uom_unit"), 'The product UoM ID of the first order line should be %s and not %s' % (ref("product.product_uom_unit"), purchase_line.product_uom.id,)
       purchase_line = purchase_ids[0].order_line[1]
       assert purchase_line.product_qty == 2.0, 'The product quantity of the first order line should be 2 and not %s' % (purchase_line.product_qty,)
       assert purchase_line.product_uom.id == ref("product.product_uom_dozen"), 'The product UoM ID of the second order line should be %s and not %s' % (ref("product.product_uom_dozen"), purchase_line.product_uom.id,)
  
hunk.file_path: addons/stock_dropshipping/test/cancellation_propagated.yml
hunk.type: replace
file: from openerp import models, fields, api, _
  from openerp.exceptions import UserError
  
  class CashBox(models.TransientModel):
      _register = False
  
      name = fields.Char(string='Reason', required=True)
      # Attention, we don't set a domain, because there is a journal_type key 
      # in the context of the action
      amount = fields.Float(string='Amount', digits=0, required=True)
  
      @api.multi
      def run(self):
          context = dict(self._context or {})
          active_model = context.get('active_model', False)
          active_ids = context.get('active_ids', [])
  
          records = self.env[active_model].browse(active_ids)
  
          return self._run(records)
  
      @api.multi
      def _run(self, records):
          for box in self:
              for record in records:
                  if not record.journal_id:
                      raise UserError(_("Please check that the field 'Journal' is set on the Bank Statement"))
                  if not record.journal_id.company_id.transfer_account_id:
                      raise UserError(_("Please check that the field 'Transfer Account' is set on the company."))
                  box._create_bank_statement_line(record)
          return {}
  
      @api.one
      def _create_bank_statement_line(self, record):
          values = self._compute_values_for_statement_line(record)
          return self.env['account.bank.statement.line'].create(values[0])
  
  
  class CashBoxIn(CashBox):
      _name = 'cash.box.in'
  
      ref = fields.Char('Reference')
  
      @api.one
      def _compute_values_for_statement_line(self, record):
          if not record.journal_id.company_id.transfer_account_id:
              raise UserError(_("You should have defined an 'Internal Transfer Account' in your cash register's journal!"))
          return {
              'statement_id': record.id,
              'journal_id': record.journal_id.id,
              'amount': self.amount or 0.0,
              'account_id': record.journal_id.company_id.transfer_account_id.id,
              'ref': '%s' % (self.ref or ''),
              'name': self.name,
          }
  
  
  class CashBoxOut(CashBox):
      _name = 'cash.box.out'
  
      @api.one
      def _compute_values_for_statement_line(self, record):
          if not record.journal_id.company_id.transfer_account_id:
              raise UserError(_("You should have defined an 'Internal Transfer Account' in your cash register's journal!"))
          amount = self.amount or 0.0
          return {
              'statement_id': record.id,
              'journal_id': record.journal_id.id,
              'amount': -amount if amount > 0.0 else amount,
              'account_id': record.journal_id.company_id.transfer_account_id.id,
              'name': self.name,
          }
  