[ADD] account: Add yml test files for invoices
bzr revid: psi@tinyerp.co.in-20100527132540-2c1xitk3ue0ng36u
This commit is contained in:
parent
885f365e90
commit
8eb8507424
|
@ -121,6 +121,10 @@ module named account_voucherss
|
||||||
'demo/account_minimal.xml',
|
'demo/account_minimal.xml',
|
||||||
'account_unit_test.xml',
|
'account_unit_test.xml',
|
||||||
],
|
],
|
||||||
|
'test': [
|
||||||
|
'test/account_customer_invoice.yml',
|
||||||
|
'test/account_supplier_invoice.yml',
|
||||||
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'active': False,
|
'active': False,
|
||||||
'certificate': '0080331923549',
|
'certificate': '0080331923549',
|
||||||
|
|
|
@ -0,0 +1,143 @@
|
||||||
|
-
|
||||||
|
In order to test account invoice i create a new customer invoice
|
||||||
|
-
|
||||||
|
Creating a account.invoice record
|
||||||
|
-
|
||||||
|
!record {model: account.invoice, id: account_invoice_0}:
|
||||||
|
account_id: account.a_recv
|
||||||
|
address_contact_id: base.res_partner_address_zen
|
||||||
|
address_invoice_id: base.res_partner_address_zen
|
||||||
|
company_id: base.main_company
|
||||||
|
currency_id: base.EUR
|
||||||
|
date_invoice: '2010-05-26'
|
||||||
|
invoice_line:
|
||||||
|
- account_id: account.a_sale
|
||||||
|
name: '[PC3] Medium PC'
|
||||||
|
price_unit: 900.0
|
||||||
|
quantity: 10.0
|
||||||
|
product_id: product.product_product_pc3
|
||||||
|
uos_id: product.product_uom_unit
|
||||||
|
journal_id: account.sales_journal
|
||||||
|
partner_id: base.res_partner_3
|
||||||
|
reference_type: none
|
||||||
|
-
|
||||||
|
I check that Initially customer invoice is in the draft state
|
||||||
|
-
|
||||||
|
!assert {model: account.invoice, id: account_invoice_0}:
|
||||||
|
- state == 'draft'
|
||||||
|
-
|
||||||
|
I change the state of invoice to proforma2 by clicking PRO-FORMA button
|
||||||
|
-
|
||||||
|
Performing a workflow action invoice_proforma2 on module account.invoice
|
||||||
|
-
|
||||||
|
!workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_0}
|
||||||
|
-
|
||||||
|
I check that the invoice state is now proforma2
|
||||||
|
-
|
||||||
|
!assert {model: account.invoice, id: account_invoice_0}:
|
||||||
|
- state == 'proforma2'
|
||||||
|
-
|
||||||
|
I create invoice by clicking on Create button
|
||||||
|
-
|
||||||
|
Performing a workflow action invoice_open on module account.invoice
|
||||||
|
-
|
||||||
|
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_0}
|
||||||
|
-
|
||||||
|
I check that the invoice state is now open
|
||||||
|
-
|
||||||
|
!assert {model: account.invoice, id: account_invoice_0}:
|
||||||
|
- state == 'open'
|
||||||
|
-
|
||||||
|
I make a partial payment of 1000 by clicking on Pay Invoice button
|
||||||
|
-
|
||||||
|
Creating a account.invoice.pay record
|
||||||
|
-
|
||||||
|
!record {model: account.invoice.pay, id: account_invoice_pay_first0}:
|
||||||
|
amount: 1000.0
|
||||||
|
date: '2010-05-26'
|
||||||
|
journal_id: account.sales_journal
|
||||||
|
name: First payment for [PC3] Medium PC to Distrib PC
|
||||||
|
period_id: account.period_5
|
||||||
|
|
||||||
|
|
||||||
|
-
|
||||||
|
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
|
||||||
|
-
|
||||||
|
!python {model: account.invoice.pay}: |
|
||||||
|
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_first0")], {"lang":
|
||||||
|
'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
|
||||||
|
[ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
|
||||||
|
})
|
||||||
|
-
|
||||||
|
I check that the invoice state is still open
|
||||||
|
-
|
||||||
|
!assert {model: account.invoice, id: account_invoice_0}:
|
||||||
|
- state == 'open'
|
||||||
|
-
|
||||||
|
I make second partial payment of 6000 by clicking on Pay Invoice button
|
||||||
|
-
|
||||||
|
Creating a account.invoice.pay record
|
||||||
|
-
|
||||||
|
!record {model: account.invoice.pay, id: account_invoice_pay_second0}:
|
||||||
|
amount: 6000.0
|
||||||
|
date: '2010-05-28'
|
||||||
|
journal_id: account.sales_journal
|
||||||
|
name: Second payment for [PC3] Medium PC to Distrib PC
|
||||||
|
period_id: account.period_5
|
||||||
|
|
||||||
|
-
|
||||||
|
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
|
||||||
|
-
|
||||||
|
!python {model: account.invoice.pay}: |
|
||||||
|
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_second0")], {"lang":
|
||||||
|
'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
|
||||||
|
[ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
|
||||||
|
})
|
||||||
|
-
|
||||||
|
I make final partial payment of 2000 by clicking on Pay Invoice button
|
||||||
|
-
|
||||||
|
Creating a account.invoice.pay record
|
||||||
|
-
|
||||||
|
!record {model: account.invoice.pay, id: account_invoice_pay_final0}:
|
||||||
|
amount: 2000.0
|
||||||
|
date: '2010-05-30'
|
||||||
|
journal_id: account.sales_journal
|
||||||
|
name: Final payment for [PC3] Medium PC to Distrib PC
|
||||||
|
period_id: account.period_5
|
||||||
|
|
||||||
|
|
||||||
|
-
|
||||||
|
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
|
||||||
|
-
|
||||||
|
!python {model: account.invoice.pay}: |
|
||||||
|
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_final0")], {"lang":
|
||||||
|
'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
|
||||||
|
[ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
|
||||||
|
})
|
||||||
|
|
||||||
|
-
|
||||||
|
I check that the invoice state is now Done
|
||||||
|
-
|
||||||
|
!assert {model: account.invoice, id: account_invoice_0}:
|
||||||
|
- state == 'paid'
|
||||||
|
-
|
||||||
|
I check that an payment entry gets created in the account.move.line
|
||||||
|
-
|
||||||
|
!python {model: account.invoice}: |
|
||||||
|
acc_id=self.browse(cr, uid, ref("account_invoice_0"))
|
||||||
|
assert(acc_id.move_id)
|
||||||
|
#-
|
||||||
|
# I refund the invoice
|
||||||
|
#-
|
||||||
|
# Creating a account.invoice.refund record
|
||||||
|
#-
|
||||||
|
# !record {model: account.invoice.refund, id: account_invoice_refund_0}:
|
||||||
|
# description: Refund
|
||||||
|
#
|
||||||
|
#-
|
||||||
|
# Performing an osv_memory action invoice_refund on module account.invoice.refund
|
||||||
|
#-
|
||||||
|
# !python {model: account.invoice.refund}: |
|
||||||
|
# self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US',
|
||||||
|
# "tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_0")],
|
||||||
|
# "type": "out_invoice", "active_id": ref("account.account_invoice_0"), })
|
|
@ -0,0 +1,117 @@
|
||||||
|
-
|
||||||
|
In order to test account invoice i create a new supplier invoice
|
||||||
|
-
|
||||||
|
Creating a account.invoice record
|
||||||
|
-
|
||||||
|
!record {model: account.invoice, id: account_invoice_0}:
|
||||||
|
account_id: account.a_pay
|
||||||
|
address_contact_id: base.res_partner_address_3000
|
||||||
|
address_invoice_id: base.res_partner_address_3000
|
||||||
|
check_total: 3000.0
|
||||||
|
company_id: base.main_company
|
||||||
|
currency_id: base.EUR
|
||||||
|
invoice_line:
|
||||||
|
- account_id: account.a_expense
|
||||||
|
name: '[PC1] Basic PC'
|
||||||
|
price_unit: 300.0
|
||||||
|
product_id: product.product_product_pc1
|
||||||
|
quantity: 10.0
|
||||||
|
uos_id: product.product_uom_unit
|
||||||
|
journal_id: account.expenses_journal
|
||||||
|
partner_id: base.res_partner_desertic_hispafuentes
|
||||||
|
reference_type: none
|
||||||
|
type: in_invoice
|
||||||
|
-
|
||||||
|
I check that Initially customer invoice is in the draft state
|
||||||
|
-
|
||||||
|
!assert {model: account.invoice, id: account_invoice_0}:
|
||||||
|
- state == 'draft'
|
||||||
|
-
|
||||||
|
I change the state of invoice to open by clicking Validate button
|
||||||
|
-
|
||||||
|
Performing a workflow action invoice_open on module account.invoice
|
||||||
|
-
|
||||||
|
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_0}
|
||||||
|
-
|
||||||
|
I check that the invoice state is now open
|
||||||
|
-
|
||||||
|
!assert {model: account.invoice, id: account_invoice_0}:
|
||||||
|
- state == 'open'
|
||||||
|
-
|
||||||
|
I make a partial payment of 2000 by clicking on Pay Invoice button
|
||||||
|
-
|
||||||
|
Creating a account.invoice.pay record
|
||||||
|
-
|
||||||
|
!record {model: account.invoice.pay, id: account_invoice_pay_firstpaymenttoaxelorforbasicpc0}:
|
||||||
|
amount: 2000.0
|
||||||
|
date: '2010-05-29'
|
||||||
|
journal_id: account.sales_journal
|
||||||
|
name: First Payment to Axelor for Basic PC
|
||||||
|
period_id: account.period_5
|
||||||
|
|
||||||
|
-
|
||||||
|
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
|
||||||
|
-
|
||||||
|
!python {model: account.invoice.pay}: |
|
||||||
|
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_firstpaymenttoaxelorforbasicpc0")],
|
||||||
|
{"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id":
|
||||||
|
25, "active_ids": [ref("account_invoice_0")], "type": "in_invoice", "active_id":
|
||||||
|
ref("account_invoice_0"), })
|
||||||
|
-
|
||||||
|
I check that the invoice state is still open
|
||||||
|
-
|
||||||
|
!assert {model: account.invoice, id: account_invoice_0}:
|
||||||
|
- state == 'open'
|
||||||
|
-
|
||||||
|
I make final partial payment of 1000 by clicking on Pay Invoice button
|
||||||
|
-
|
||||||
|
Creating a account.invoice.pay record
|
||||||
|
-
|
||||||
|
!record {model: account.invoice.pay, id: account_invoice_pay_finalpaymenttoaxelorforbasicpc0}:
|
||||||
|
amount: 1000.0
|
||||||
|
date: '2010-06-17'
|
||||||
|
journal_id: account.sales_journal
|
||||||
|
name: Final Payment to Axelor for Basic PC
|
||||||
|
period_id: account.period_5
|
||||||
|
|
||||||
|
|
||||||
|
-
|
||||||
|
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
|
||||||
|
-
|
||||||
|
!python {model: account.invoice.pay}: |
|
||||||
|
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_finalpaymenttoaxelorforbasicpc0")],
|
||||||
|
{"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id":
|
||||||
|
25, "active_ids": [ref("account_invoice_0")], "type": "in_invoice", "active_id":
|
||||||
|
ref("account_invoice_0"), })
|
||||||
|
|
||||||
|
-
|
||||||
|
I check that the invoice state is now Done
|
||||||
|
-
|
||||||
|
!assert {model: account.invoice, id: account_invoice_0}:
|
||||||
|
- state == 'paid'
|
||||||
|
-
|
||||||
|
I check that an payment entry gets created in the account.move.line
|
||||||
|
-
|
||||||
|
!python {model: account.invoice}: |
|
||||||
|
acc_id=self.browse(cr, uid, ref("account_invoice_0"))
|
||||||
|
assert(acc_id.move_id)
|
||||||
|
#-
|
||||||
|
# I refund the invoice
|
||||||
|
#-
|
||||||
|
# Creating a account.invoice.refund record
|
||||||
|
#-
|
||||||
|
# !record {model: account.invoice.refund, id: account_invoice_refund_0}:
|
||||||
|
# date: '2010-06-22'
|
||||||
|
# description: 'Refund By Axelor '
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#-
|
||||||
|
# Performing an osv_memory action invoice_refund on module account.invoice.refund
|
||||||
|
#-
|
||||||
|
# !python {model: account.invoice.refund}: |
|
||||||
|
# self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US',
|
||||||
|
# "tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_0")],
|
||||||
|
# "type": "in_invoice", "active_id": ref("account_invoice_0"), })
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue