2 Now I confirm the Quotation with "Invoice on order after delivery" policy.
4 !workflow {model: sale.order, action: order_confirm, ref: order2}
6 I check that related delivery order after confirmed.
8 !python {model: sale.order}: |
9 sale_order = self.browse(cr, uid, ref("order2"))
10 assert sale_order.picking_ids, "Delivery Order should be created."
11 assert len(sale_order.invoice_ids) == False, "Invoice should be not created."
13 Now, I dispatch delivery order.
15 !python {model: stock.partial.picking}: |
16 order = self.pool.get('sale.order').browse(cr, uid, ref("order2"))
17 for pick in order.picking_ids:
18 data = pick.force_assign()
20 partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick.id]})
21 self.do_partial(cr, uid, [partial_id])
25 !python {model: sale.order}: |
27 wf_service = netsvc.LocalService("workflow")
28 order = self.browse(cr, uid, ref("order2"))
29 #assert order.invoice_ids, "Invoice should be created after dispatch delivery order."
30 for invoice in order.invoice_ids:
31 wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr)
35 !python {model: account.invoice}: |
36 sale_order = self.pool.get('sale.order')
37 order = sale_order.browse(cr, uid, ref("order2"))
38 journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', order.company_id.id)], limit=1)
39 for invoice in order.invoice_ids:
40 invoice.pay_and_reconcile(
41 invoice.amount_total, ref('account.cash'), ref('account.period_8'),
42 journal_ids[0], ref('account.cash'),
43 ref('account.period_8'), journal_ids[0],
46 I check that an order has been invoiced, shipped and closed.
48 !python {model: sale.order}: |
49 order = self.browse(cr, uid, ref("order2"))
50 assert order.picked_rate == 100, "Shipment progress is not 100%."
51 #assert order.shipped, "Delivery Order should be dispatch." #TOFIX: procurement is gone in idle state so order never shipped, invoiced. after install mrp, it will be normal.
52 #assert order.invoiced == True, "Sale order is not invoiced."
53 #assert order.invoiced_rate == 100, "Invoiced progress is not 100%."
54 #assert order.state == 'done', 'Order should be in closed.'