2011-06-21 13:30:26 +00:00
|
|
|
-
|
2011-06-23 13:42:07 +00:00
|
|
|
create Company
|
|
|
|
-
|
2011-06-24 13:11:17 +00:00
|
|
|
!record {model: res.company, id: res_company_test11}:
|
2011-06-23 13:42:07 +00:00
|
|
|
name: Thomson pvt. ltd.
|
|
|
|
partner_id: 1
|
|
|
|
rml_header: 1
|
|
|
|
rml_header2: 1
|
|
|
|
rml_header3: 1
|
|
|
|
currency_id: 1
|
|
|
|
|
|
|
|
-
|
2011-06-24 13:11:17 +00:00
|
|
|
create partner
|
2011-06-23 13:42:07 +00:00
|
|
|
-
|
2011-06-24 13:11:17 +00:00
|
|
|
!record {model: res.partner, id: res_partner_test20}:
|
2011-06-23 13:42:07 +00:00
|
|
|
name: Junjun wala
|
|
|
|
supplier: False
|
2011-06-24 13:11:17 +00:00
|
|
|
company_id: res_company_test11
|
|
|
|
-
|
|
|
|
create customer invoice
|
|
|
|
-
|
|
|
|
!record {model: account.invoice, id: customer_invoice_test}:
|
|
|
|
journal_id: 1
|
|
|
|
partner_id: res_partner_test20
|
2011-06-23 13:42:07 +00:00
|
|
|
currency_id: base.EUR
|
2011-06-24 13:11:17 +00:00
|
|
|
address_invoice_id: base.res_partner_address_11
|
2011-06-28 13:43:26 +00:00
|
|
|
company_id: res_company_test11
|
|
|
|
account_id: account.a_pay
|
2011-06-23 13:42:07 +00:00
|
|
|
date_invoice: '2011-06-22'
|
2011-06-27 12:26:16 +00:00
|
|
|
name: selling product
|
2011-06-24 13:11:17 +00:00
|
|
|
type: 'out_invoice'
|
2011-06-23 13:42:07 +00:00
|
|
|
invoice_line:
|
2011-06-24 13:11:17 +00:00
|
|
|
- product_id: product.product_product_pc1
|
|
|
|
partner_id: res_partner_test20
|
|
|
|
uos_id: 1
|
2011-06-23 13:42:07 +00:00
|
|
|
quantity: 1.0
|
2011-06-24 13:11:17 +00:00
|
|
|
price_unit: 10.0
|
|
|
|
name: 'basic pc'
|
2011-06-28 13:43:26 +00:00
|
|
|
account_id: account.a_pay
|
|
|
|
|
|
|
|
tax_line:
|
|
|
|
- name: sale tax
|
|
|
|
account_id: account.a_pay
|
|
|
|
manual: True
|
|
|
|
amount: 1000.00
|
|
|
|
|
|
|
|
-
|
|
|
|
I open the Invoice for the SO.
|
|
|
|
-
|
|
|
|
!python {model: account.invoice}: |
|
2011-06-24 13:11:17 +00:00
|
|
|
|
2011-06-28 13:43:26 +00:00
|
|
|
invoices = self.browse(cr, uid, ref("customer_invoice_test"))
|
|
|
|
import netsvc
|
|
|
|
wf_service = netsvc.LocalService("workflow")
|
|
|
|
wf_service.trg_validate(uid, 'account.invoice',invoices.id,'invoice_open', cr)
|
|
|
|
|
2011-06-23 13:42:07 +00:00
|
|
|
-
|
2011-06-27 06:53:31 +00:00
|
|
|
Tesing of EDI functionality
|
2011-06-21 13:30:26 +00:00
|
|
|
-
|
|
|
|
!python {model: ir.edi.document}: |
|
2011-06-28 13:43:26 +00:00
|
|
|
invoice_invoice_new = self.pool.get('account.invoice')
|
|
|
|
invoices = invoice_invoice_new.browse(cr, uid, [ref("customer_invoice_test")])
|
2011-06-24 13:11:17 +00:00
|
|
|
tokens = self.export_edi(cr, uid, invoices)
|
|
|
|
for token in tokens:
|
|
|
|
document = self.get_document(cr, uid, token, context=context)
|
|
|
|
a = self.import_edi(cr, uid, edi_document = document)
|
2011-06-28 13:43:26 +00:00
|
|
|
|
2011-06-23 13:42:07 +00:00
|
|
|
-
|
2011-06-28 13:43:26 +00:00
|
|
|
Check the exported out_invoice become in_invoice or not
|
2011-06-23 13:42:07 +00:00
|
|
|
-
|
|
|
|
!python {model: account.invoice}: |
|
2011-06-28 13:43:26 +00:00
|
|
|
|
|
|
|
invoice_old = self.browse(cr,uid,ref("customer_invoice_test"))
|
2011-06-29 05:27:22 +00:00
|
|
|
new_partner_id = self.pool.get('res.partner').name_search(cr, uid, invoice_old.company_id.name)
|
|
|
|
assert new_partner_id, 'Partner is not created of party'
|
|
|
|
|
|
|
|
ids = self.search(cr, uid, [('partner_id','=',new_partner_id[0]),('reference','=',invoice_old.internal_number)])
|
|
|
|
assert ids, 'Invoice does not have created of party'
|
|
|
|
invoice_new = self.browse(cr, uid, ids[0])
|
2011-06-28 13:43:26 +00:00
|
|
|
assert invoice_new.reference == invoice_old.internal_number, "internal number is not stored in reference"
|
|
|
|
assert invoice_new.reference_type == None, "reference type is not set to 'None'"
|
|
|
|
assert invoice_new.internal_number == False, "internal number is not reset"
|
|
|
|
assert invoice_new.journal_id.id, "journal id is not selected"
|
2011-06-29 05:27:22 +00:00
|
|
|
for inv_line in invoice_new.invoice_line:
|
|
|
|
assert inv_line.account_id.id, "account_id is not taken from product's default"
|
|
|
|
for inv_tax in invoice_new.tax_line:
|
|
|
|
assert inv_tax.manual, "for tax line manual is not set to True"
|
|
|
|
assert inv_tax.account_id, "for tax_line default accounts is not picked based on the tax config of the DB where it is imported."
|
2011-06-28 13:43:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|