odoo/addons/sale/test/advance_invoice.yml

145 lines
5.5 KiB
YAML

-
In order to test the Deposit wizard of sale module in the Open-ERP,
I create a Sale Order for LG Viewty Smart for qty 100 having order_policy manual.
-
!record {model: sale.order, id: sale_order_so5}:
invoice_quantity: order
order_line:
- product_uom_qty: 100.0
product_id: sale.product_product_lgviewtysmart0
name: LG View
product_uos_qty: 100.0
type: make_to_order
order_policy: manual
partner_id: sale.res_partner_cleartrail0
picking_policy: direct
-
I use the Advance Payment wizard.
-
!record {model: sale.advance.payment.inv, id: sale_advance_payment_inv_0}:
amount: 1000.0
product_id: product.product_product_pc3
qtty: 3.0
-
Then I click on the "Create Partial Invoice" button
-
!python {model: sale.advance.payment.inv}: |
self.create_invoices(cr, uid, [ref("sale_advance_payment_inv_0")], {"lang": 'en_US',
"active_model": 'sale.order', "active_ids": [ref("sale_order_so5")], "tz":
False, "active_id": ref("sale_order_so5"), })
-
I verify whether the invoice has been generated.
-
!python {model: sale.order}: |
so = self.read(cr, uid, ref("sale_order_so5"))
assert so['invoice_ids'], "Invoices has not been generated for sale_order_so5"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
I verify that an invoice state has transit from draft to open state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','open')])
assert invoice_id, "Invoice is not in the open state"
-
I pay the invoice
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','open')])
self.pay_and_reconcile(cr, uid, invoice_id,
3000.0, ref('account.cash'), ref('account.period_5'),
ref('sale.account_journal_bankjournal0'), ref('account.cash'),
ref('account.period_8'), ref('sale.account_journal_bankjournal0'),
name='test')
-
I verify that invoice has transit from Open to Paid state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','paid')])
assert invoice_id, "Invoice for SO is not in paid state."
-
I verify that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so5"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
-
I confirm the Sale Order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so5}
-
I click on "Create Invoice" button of Sales order to create the invoice.
-
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so5}
-
I verify whether the invoice has been generated for SO
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so5"))
assert so.invoice_ids[1], "Invoices has not been generated for sale_order_so5"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
I verify that an invoice state has transit from draft to open state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','open')])
assert invoice_id, "Invoice is not in the open state"
-
I assign an analytic journal to the bank journal
-
!record {model: account.journal, id: sale.account_journal_bankjournal0}:
analytic_journal_id: account.cose_journal_sale
-
I pay the invoice
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','open')])
self.pay_and_reconcile(cr, uid, invoice_id,
14000.0, ref('account.cash'), ref('account.period_5'),
ref('sale.account_journal_bankjournal0'), ref('account.cash'),
ref('account.period_5'), ref('sale.account_journal_bankjournal0'),
name='test')
-
I verify that an invoice is in done state.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name),('state','=','paid')])
assert invoice_id, "Invoice for SO is not in done state."
-
I verify that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so5"))
assert(sale_id.invoiced == True), "Paid has not been set to true"