[MERGE] with trunk
[odoo/odoo.git] / addons / stock_invoice_directly / test / stock_invoice_directly.yml
1 -
2   In order to test the stock_invoice_directly module. I will create an outgoing
3   picking order which creates an invoice from the picking order itself.
4 -
5   I create an Outgoing Picking order.
6 -
7   !record {model: stock.picking, id: stock_picking_out0}:
8     partner_id: base.res_partner_address_22
9     invoice_state: 2binvoiced
10     move_lines:
11       - company_id: base.main_company
12         location_id: stock.stock_location_stock
13         product_id: product.product_product_3
14         product_qty: 3.0
15         product_uom: product.product_uom_unit
16         location_dest_id: stock.stock_location_customers
17     move_type: direct
18     type: out
19 -
20   I need to check the availability of the product so I make my picking order for processing later.
21 -
22   !python {model: stock.picking}: |
23     self.draft_force_assign(cr, uid, [ref("stock_picking_out0")], {"lang": "en_US", "search_default_available":
24       1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
25       "active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
26       })
27 -
28   I check the product availability. Product is available in the stock and ready to be sent.
29 -
30   !python {model: stock.picking}: |
31     self.action_assign(cr, uid, [ref("stock_picking_out0")], {"lang": "en_US", "search_default_available":
32       1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
33       "active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
34       })
35 -
36   I process the delivery
37 -
38   !python {model: stock.partial.picking}: |
39     partial_id = self.create(cr, uid, {}, context={'active_model':'stock.picking',
40                                                    'active_ids':[ref('stock_picking_out0')]})
41     self.do_partial(cr, uid, [partial_id])
42
43 -
44   As the Invoice state of the picking order is To be invoiced. I create invoice for my outgoing picking order.
45 -
46   !python {model: stock.invoice.onshipping}: |
47     wiz_id = self.create(cr, uid, {'invoice_date': '2010-08-04', 'journal_id': ref('account.sales_journal')},
48       {'active_ids': [ref("stock_picking_out0")], "active_model": "stock.picking"})
49     self.create_invoice(cr, uid, [wiz_id], {"lang": "en_US",
50       "search_default_available": 1, "tz": False, "active_model": "stock.picking",
51       "contact_display": "partner", "active_ids": [ref("stock_picking_out0")], "active_id": ref("stock_picking_out0")})
52 -
53   I check that the customer invoice is created successfully.
54 -
55   !python {model: account.invoice}: |
56     picking_obj = self.pool.get('stock.picking')
57     picking = picking_obj.browse(cr, uid, [ref('stock_picking_out0')])
58     partner = picking[0].partner_id.id
59     inv_ids = self.search(cr, uid, [('type','=','out_invoice'),('partner_id','=',partner)])
60     assert inv_ids, 'No Invoice is generated!'
61