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.

34 lines
1.3 KiB

  1. -
  2. In order to test Contract Invoices Button I create a new Contract
  3. -
  4. !record {model: account.analytic.account, id: contract_main}:
  5. name: Maintenance of Servers
  6. company_id: base.main_company
  7. partner_id: base.main_partner
  8. type: contract
  9. recurring_invoices : 1
  10. recurring_interval : 1
  11. recurring_invoice_line_ids:
  12. - quantity: 2.0
  13. price_unit: 100.0
  14. name: Database Administration 25
  15. product_id: product.product_product_consultant
  16. uom_id: product.product_uom_hour
  17. -
  18. I test the invoices button
  19. -
  20. !python {model: account.invoice}: |
  21. contract_id = ref('contract_show_invoice.contract_main')
  22. invoices = self.search(cr, uid,[('analytic_account_ids','=',contract_id)],context=context)
  23. assert len(invoices) == 0, "No invoices related this contract, but get (%s)"%(invoices,)
  24. -
  25. I generate all invoices from contracts having recurring invoicing
  26. -
  27. !python {model: account.analytic.account}: |
  28. self.recurring_create_invoice(cr, uid, [])
  29. -
  30. I test the invoices button
  31. -
  32. !python {model: account.invoice}: |
  33. contract_id = ref('contract_show_invoice.contract_main')
  34. invoices = self.search(cr, uid,[('analytic_account_ids','=',contract_id)],context=context)
  35. assert len(invoices) == 1, "Must have one invoice related this contract, but get (%s)"%(invoices,)