You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
2.0 KiB

  1. -
  2. In order to test payment mode in contract, I create a contract with custom payment mode.
  3. Then, I generate Invoices from contract and test this payment mode.
  4. First create custom payment mode.
  5. -
  6. !record {model: payment.mode, id: custom_payment_mode}:
  7. name: Custom Payment Mode
  8. journal: account.bank_journal
  9. bank_id: account_payment.partner_bank_1
  10. company_id: base.main_company
  11. type: account_banking_payment_export.manual_bank_tranfer
  12. -
  13. I create a contract with custom payment mode
  14. -
  15. !record {model: account.analytic.account, id: contract_custom_payment}:
  16. name: Maintenance of Servers
  17. company_id: base.main_company
  18. partner_id: base.main_partner
  19. payment_mode_id: custom_payment_mode
  20. type: contract
  21. recurring_invoices : 1
  22. recurring_interval : 1
  23. recurring_invoice_line_ids:
  24. - quantity: 2.0
  25. price_unit: 100.0
  26. name: Database Administration 25
  27. product_id: product.product_product_consultant
  28. uom_id: product.product_uom_hour
  29. -
  30. I test the payment mode in contract
  31. -
  32. !python {model: account.analytic.account}: |
  33. aid = ref('contract_payment_mode.contract_custom_payment')
  34. contract = self.browse(cr, uid, aid,context=context)
  35. assert contract.payment_mode_id.id == ref('contract_payment_mode.custom_payment_mode'), "Payment Mode is not correct in contract"
  36. -
  37. I generate all invoices from contracts having recurring invoicing
  38. -
  39. !python {model: account.analytic.account}: |
  40. self.recurring_create_invoice(cr, uid, [])
  41. -
  42. I test the generated invoice for custom payment contract
  43. -
  44. !python {model: account.invoice}: |
  45. aid = ref('contract_payment_mode.contract_custom_payment')
  46. ids = self.search(cr, uid, [('invoice_line.account_analytic_id','=',aid)], context=context)
  47. assert len(ids)>=1, 'No invoice created for the custom paymetn mode contract'
  48. for invoice in self.browse(cr, uid, ids,context=context):
  49. assert invoice.payment_mode_id.id == ref('contract_payment_mode.custom_payment_mode'), "Payment Mode is not correct in invoice"