[ADD] stock_invoice_directly: Added yaml.
bzr revid: uco@tinyerp.com-20100803064451-7f0d67jwj55a25gf
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
'init_xml': [],
|
||||
'update_xml': [],
|
||||
'demo_xml': [],
|
||||
'test': ['test/stock_invoice_directly.yml'],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0081385081261',
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
-
|
||||
In order to test the stock_invoice_directly module. I will create an outgoing
|
||||
picking order which creates an invoice from the picking order itself.
|
||||
-
|
||||
I create an Outgoing Picking order.
|
||||
-
|
||||
!record {model: stock.picking, id: stock_picking_out0}:
|
||||
address_id: base.res_partner_address_3000
|
||||
company_id: base.main_company
|
||||
invoice_state: 2binvoiced
|
||||
move_lines:
|
||||
- company_id: base.main_company
|
||||
date_expected: '2010-08-03 11:05:47'
|
||||
date_planned: '2010-08-03 11:05:47'
|
||||
location_id: stock.stock_location_stock
|
||||
product_id: product.product_product_pc1
|
||||
product_qty: 3.0
|
||||
product_uom: product.product_uom_unit
|
||||
location_dest_id: stock.stock_location_customers
|
||||
name: '[PC1] Basic PC'
|
||||
move_type: direct
|
||||
name: OUT/00006
|
||||
type: out
|
||||
-
|
||||
I need to check the availability of the product so I make my picking order for processing later.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
self.draft_force_assign(cr, uid, [ref("stock_picking_out0")], {"lang": "en_US", "search_default_available":
|
||||
1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
|
||||
"active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
|
||||
})
|
||||
-
|
||||
I check the product availability. Product is available in the stock and ready to be sent.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
self.action_assign(cr, uid, [ref("stock_picking_out0")], {"lang": "en_US", "search_default_available":
|
||||
1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
|
||||
"active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
|
||||
})
|
||||
-
|
||||
I create a record for partial picking.
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
|
||||
date: '2010-08-03 11:25:58'
|
||||
-
|
||||
I make picking order Done.
|
||||
-
|
||||
!python {model: stock.partial.picking}: |
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
partial = self.browse(cr, uid, ref('stock_partial_picking_0'), context)
|
||||
partial_datas = {
|
||||
'delivery_date' : partial.date
|
||||
}
|
||||
for pick in pick_obj.browse(cr, uid, [ref('stock_picking_out0')]):
|
||||
for m in pick.move_lines:
|
||||
partial_datas['move%s'%(m.id)] = {
|
||||
'product_id' : m.product_id.id,
|
||||
'product_qty' : m.product_qty,
|
||||
'product_uom' : m.product_uom.id
|
||||
}
|
||||
pick_obj.do_partial(cr, uid, [ref('stock_picking_out0')], partial_datas, context=context)
|
||||
-
|
||||
As the Invoice state of the picking order is To be invoiced. I create a record for create invoice.
|
||||
-
|
||||
!record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}:
|
||||
invoice_date: '2010-08-04'
|
||||
journal_id: account.bank_journal
|
||||
type: out_invoice
|
||||
-
|
||||
I create a Customer invoice for my outgoing picking order.
|
||||
-
|
||||
!python {model: stock.invoice.onshipping}: |
|
||||
self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US",
|
||||
"search_default_available": 1, "tz": False, "active_model": "stock.picking",
|
||||
"contact_display": "partner", "active_ids": [ref("stock_picking_out0")], "active_id": ref("stock_picking_out0")})
|
||||
-
|
||||
I check that the customer invoice is created successfully.
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
picking = picking_obj.browse(cr, uid, [ref('stock_picking_out0')])
|
||||
partner = picking[0].address_id.partner_id.id
|
||||
inv_ids = self.search(cr, uid, [('type','=','out_invoice'),('partner_id','=',partner)])
|
||||
assert inv_ids, 'No Invoice is generated!'
|
||||
|
||||
Reference in New Issue
Block a user