[IMP]account_payment: improve a account_payment with using a demo data and test a more case and reneame a file and fix the problem of populate_statement wizard

bzr revid: mma@tinyerp.com-20111115063530-qxdbl15skf34h413
This commit is contained in:
Mayur Maheshwari (OpenERP) 2011-11-15 12:05:30 +05:30
parent f79e0d1f59
commit 6c7405a0cd
4 changed files with 93 additions and 120 deletions

View File

@ -51,7 +51,7 @@ This module provides :
],
'demo_xml': ['account_payment_demo.xml'],
'test': [
'test/account_payment.yml',
'test/process/draft2done_payment_order.yml',
'test/account_payment_report.yml'
],
'installable': True,

View File

@ -1,118 +0,0 @@
-
In order to test account_payment in OpenERP I created a new Bank Record
-
Creating a res.partner.bank record
-
!record {model: res.partner.bank, id: res_partner_bank_0}:
acc_number: '126-2013269-08'
partner_id: base.res_partner_9
sequence: 0.0
state: bank
bank: base.res_bank_1
-
I created a new Payment Mode
-
Creating a payment.mode record
-
!record {model: payment.mode, id: payment_mode_m0}:
bank_id: res_partner_bank_0
journal: account.bank_journal
name: TestMode
-
I created a Supplier Invoice
-
Creating a account.invoice record
-
!record {model: account.invoice, id: account_invoice_payment}:
account_id: account.a_pay
address_contact_id: base.res_partner_address_tang
address_invoice_id: base.res_partner_address_tang
check_total: 300.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: 1.0
uos_id: product.product_uom_unit
journal_id: account.expenses_journal
partner_id: base.res_partner_asus
reference_type: none
type: in_invoice
-
I make the supplier invoice in Open state
-
Performing a workflow action invoice_open on module account.invoice
-
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_payment}
-
I create a new payment order
-
Creating a payment.order record
-
!record {model: payment.order, id: payment_order_0}:
date_prefered: due
mode: payment_mode_m0
reference: !eval "'%s/006' %(datetime.now().year)"
user_id: base.user_root
-
Creating a payment.order.create record
-
!record {model: payment.order.create, id: payment_order_create_0}:
duedate: !eval time.strftime('%Y-%m-%d')
-
I searched the entries using "Payment Create Order" wizard
-
Performing an osv_memory action search_entries on module payment.order.create
-
!python {model: payment.order.create}: |
self.search_entries(cr, uid, [ref("payment_order_create_0")], {"lang": "en_US",
"active_model": "payment.order", "active_ids": [ref("payment_order_0")],
"tz": False, "active_id": ref("payment_order_0"), })
-
I check that Initially Payment order is in "draft" state
-
!assert {model: payment.order, id: payment_order_0}:
- state == 'draft'
-
I pressed the confirm payment button to confirm the payment
-
Performing a workflow action open on module payment.order
-
!workflow {model: payment.order, action: open, ref: payment_order_0}
-
I check that Payment order is in "Confirmed" state
-
!assert {model: payment.order, id: payment_order_0}:
- state == 'open'
-
I paid the payment using "Make Payments" Button
-
Creating a account.payment.make.payment record
-
!record {model: account.payment.make.payment, id: account_payment_make_payment_0}:
{}
-
Performing an osv_memory action launch_wizard on module account.payment.make.payment
-
!python {model: account.payment.make.payment}: |
self.launch_wizard(cr, uid, [ref("account_payment_make_payment_0")], {"lang":
"en_US", "active_model": "payment.order", "active_ids": [ref("payment_order_0")], "tz":
False, "active_id": ref("payment_order_0"), })
-
I check that Payment order is in "Done" state
-
!assert {model: payment.order, id: payment_order_0}:
- state == 'done'

View File

@ -0,0 +1,91 @@
-
In order to test the process of supplier invoice I enter the amount for a total of invoice
-
!python {model: account.invoice}: |
self.write(cr, uid, [ref('account.demo_invoice_0')], {'check_total': 14})
-
In order to test account move line of journal I check that there is no move attached to the invoice at draft
-
!python {model: account.invoice}: |
invoice = self.browse(cr, uid, ref("account.demo_invoice_0"))
assert (not invoice.move_id), "Move wrongly created at draft"
-
I perform action to change the state of invoice to "open"
-
!workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0}
-
I check that the invoice state is now "Open"
-
!assert {model: account.invoice, id: account.demo_invoice_0}:
- state == 'open'
-
In order to test the process of payment order and payment line
-
I create a record for payment order
-
!record {model: payment.order.create, id: payment_order_create_0}:
duedate: !eval time.strftime('%Y-%m-%d')
-
I perform a action to search the entries for create a order
-
Performing an osv_memory action search_entries on module payment.order.create
-
!python {model: payment.order.create}: |
self.search_entries(cr, uid, [ref("payment_order_create_0")], {"lang": "en_US",
"active_model": "payment.order", "active_ids": [ref("account_payment.payment_order_1")],
"tz": False, "active_id": ref("account_payment.payment_order_1"), })
-
In order to make entries in payment line I create a entries
-
!python {model: payment.order.create}: |
invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0"))
move_line = invoice.move_id.line_id[0]
self.write(cr, uid, [ref("payment_order_create_0")], {'entries': [(6,0,[move_line.id])]})
self.create_payment(cr, uid, [ref("payment_order_create_0")], {"lang": "en_US",
"active_model": "payment.order", "active_ids": [ref("account_payment.payment_order_1")],
"tz": False, "active_id": ref("account_payment.payment_order_1"), })
-
I check a payment line is created with proper data
-
!python {model: payment.order}: |
invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0"))
payment = self.browse(cr, uid, ref("account_payment.payment_order_1"))
payment_line = payment.line_ids[0]
assert payment_line.move_line_id, "move line is not created in payment line"
assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created"
assert invoice.partner_id == payment_line.partner_id, "partner is not same created"
assert invoice.date_due == payment_line.ml_maturity_date, "due date is not same created"
assert invoice.amount_total == payment_line.amount, "payment amount is not same created"
-
I perform action to change the state of payment order to "confirmed"
-
!workflow {model: payment.order, action: open, ref: account_payment.payment_order_1}
-
I check that Payment order is now "Confirmed"
-
!assert {model: payment.order, id: account_payment.payment_order_1}:
- state == 'open'
-
I perform action to change the state of payment order to "done"
-
!python {model: payment.order}: |
self.set_done(cr, uid, [ref("account_payment.payment_order_1")])
-
I check that Payment order is now "done"
-
!assert {model: payment.order, id: account_payment.payment_order_1}:
- state == 'done'
-
I check a payment order is done with proper data
-
!python {model: payment.order}: |
payment = self.browse(cr, uid, ref("account_payment.payment_order_1"))
assert payment.date_done, "date is not created after done payment order"

View File

@ -76,7 +76,7 @@ class account_payment_populate_statement(osv.osv_memory):
statement.currency.id, line.amount_currency, context=ctx)
context.update({'move_line_ids': [line.move_line_id.id]})
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), voucher_currency_id= statement.currency.id, ttype='payment', date=line.ml_maturity_date, context=context)
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', date=line.ml_maturity_date, context=context)
if line.move_line_id:
voucher_res = {