Launchpad automatic translations update.
[odoo/odoo.git] / addons / sale / test / manual_order_policy.yml
1 -
2   I confirm the Quotation with "On Demand" order policy.
3 -
4   !workflow {model: sale.order, action: order_confirm, ref: sale_order_2}
5 -
6   I check that Invoice should not created.
7 -
8   !python {model: sale.order}: |
9     sale_order = self.browse(cr, uid, ref("sale_order_2"))
10     assert len(sale_order.invoice_ids) == False, "Invoice should not created."
11 -
12   I create advance invoice where type is 'Fixed Price'.
13 -
14   !python {model: sale.advance.payment.inv}: |
15     ctx = context.copy()
16     ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_2")], "active_id":ref("sale_order_2")})
17     order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("sale_order_line_4"), context=context)
18     pay_id = self.create(cr, uid, {'advance_payment_method': 'fixed', 'product_id': order_line.product_id.id, 'amount': order_line.price_unit})
19     self.create_invoices(cr, uid, [pay_id], context=ctx)
20 -
21   I check Invoice which made advance.
22 -
23   !python {model: sale.order}: |
24     order = self.browse(cr, uid, ref('sale_order_2'))
25     assert order.invoice_ids, "Invoice should be created after make advance invoice."
26 -
27   I create advance invoice where type is 'Invoice all the Sale Order'.
28 -
29   !python {model: sale.advance.payment.inv}: |
30     ctx = context.copy()
31     ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_2")], "active_id":ref("sale_order_2")})
32     pay_id = self.create(cr, uid, {'advance_payment_method': 'all'})
33     self.create_invoices(cr, uid, [pay_id], context=ctx)
34 -
35   I check Invoice which made advance where type is 'Invoice all the Sale Order'.
36 -
37   !python {model: sale.order}: |
38     order = self.browse(cr, uid, ref('sale_order_2'))
39     assert order.invoice_ids, "Invoice should be created after make advance invoice where type is 'Invoice all the Sale Order'."
40 -
41   I open the Invoice.
42 -
43   !python {model: sale.order}: |
44     import netsvc
45     wf_service = netsvc.LocalService("workflow")
46     so = self.browse(cr, uid, ref("sale_order_2"))
47     for invoice in so.invoice_ids:
48       wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr)
49 -
50   I pay the invoice.
51 -
52   !python {model: account.invoice}: |
53     sale_order = self.pool.get('sale.order')
54     order = sale_order.browse(cr, uid, ref("sale_order_2"))
55     journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', order.company_id.id)], limit=1)
56     for invoice in order.invoice_ids:
57         invoice.pay_and_reconcile(
58             invoice.amount_total, ref('account.cash'), ref('account.period_8'),
59             journal_ids[0], ref('account.cash'),
60             ref('account.period_8'), journal_ids[0],
61             name='test')
62 -
63   I check Invoice after do manual.
64 -
65   !python {model: sale.order}: |
66     sale_order = self.browse(cr, uid, ref("sale_order_2"))
67     assert sale_order.invoice_ids, "Invoice should be created."
68     assert sale_order.invoice_exists, "Order is not invoiced."
69     assert sale_order.invoiced, "Order is not paid."
70     assert sale_order.state == 'done', 'Order should be Done.'