hunk.code_window:             return round(price, decimal_precision.precision_get(cr, uid, 'Account'))
           if inv.type in ('out_invoice','out_refund'):
               for i_line in inv.invoice_line:
                   if i_line.product_id and i_line.product_id.valuation == 'real_time':
                       if inv.type == 'out_invoice':
                           # debit account dacc will be the output account
                           # first check the product, if empty check the category
                           dacc = i_line.product_id.property_stock_account_output and i_line.product_id.property_stock_account_output.id
                           if not dacc:
                               dacc = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id
                       else:
                           # = out_refund
                           # debit account dacc will be the input account
                           # first check the product, if empty check the category
                           dacc = i_line.product_id.property_stock_account_input and i_line.product_id.property_stock_account_input.id
                           if not dacc:
                               dacc = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id
                       # in both cases the credit account cacc will be the expense account
                       # first check the product, if empty check the category
                       cacc = i_line.product_id.property_account_expense and i_line.product_id.property_account_expense.id
                       if not cacc:
                           cacc = i_line.product_id.categ_id.property_account_expense_categ and i_line.product_id.categ_id.property_account_expense_categ.id
  
hunk.labels: keep keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
hunk.after_edit:                     # debit account dacc will be the output account
                       # first check the product, if empty check the category
                       dacc = i_line.product_id.property_stock_account_output and i_line.product_id.property_stock_account_output.id
                       if not dacc:
                           dacc = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id
  
hunk.file_path: addons/account_anglo_saxon/invoice.py
hunk.type: replace
file: -
    Test the data with salesman,
  -
    !context
      uid: 'res_users_salesman'
  -
    In order to test process of the Sale Order, I create sale order
  -
    !record {model: sale.order, id: sale_order_test1}:
      partner_id: base.res_partner_2
      note: Invoice after delivery
      payment_term: account.account_payment_term
      order_line: 
        - product_id: product.product_product_7
          product_uom_qty: 8
  -
    I verify that the onchange was correctly triggered
  -
    !assert {model: sale.order, id: sale.sale_order_test1, string: The onchange function of product was not correctly triggered}:
      - order_line[0].name == u'[A8767] Apple In-Ear Headphones'
      - order_line[0].price_unit == 79.0
      - order_line[0].product_uom_qty == 8
      - order_line[0].product_uom.id == ref('product.product_uom_unit')
  
  -
    I create another sale order
  -
    !record {model: sale.order, id: sale_order_test2}:
      partner_id: base.res_partner_2
      order_line: 
        - product_id: product.product_product_7
          product_uom_qty: 16
          product_uom: product.product_uom_dozen
  -
    I verify that the onchange was correctly triggered
  -
    !assert {model: sale.order, id: sale.sale_order_test2, string: The onchange function of product was not correctly triggered}:
      - order_line[0].name == u'[A8767] Apple In-Ear Headphones'
      - order_line[0].price_unit == 79.0 * 12
      - order_line[0].product_uom.id == ref('product.product_uom_dozen')
      - order_line[0].product_uom_qty == 16