odoo/addons/sale_journal/test/picking_journal.yml

88 lines
3.9 KiB
YAML

-
In order to test the sale_journal module in OpenERP,
I create a picking journal
-
!record {model: sale_journal.picking.journal, id: sale_journal_picking_journal_pickjournal0}:
code: PJ
date: '2010-08-04'
date_created: '2010-08-04'
name: Pick_journal
state: draft
user_id: base.user_root
-
I create a picking for product keyboard, quantity 50
-
!record {model: stock.picking, id: stock_picking_out0}:
address_id: base.res_partner_address_6
company_id: base.main_company
invoice_state: none
journal_id: sale_journal_picking_journal_pickjournal0
move_lines:
- company_id: base.main_company
date_expected: '2010-08-04 14:09:38'
date: '2010-08-04 14:09:38'
location_id: stock.stock_location_stock
product_id: product.product_product_24
product_qty: 50.0
product_uom: product.product_uom_unit
location_dest_id: stock.stock_location_customers
name: '[KEYA] Keyboard - AZERTY'
product_uos_qty: 50.0
move_type: direct
name: OUT/00007
type: out
-
I verify that a Journal consist of picking order
-
!python {model: sale_journal.picking.journal}: |
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
assert pick_jour.picking_stats_ids, "Journal does not consist of a picking order"
-
Then I click on the 'Open Journal' button
-
!python {model: sale_journal.picking.journal}: |
self.button_open(cr, uid, [ref("sale_journal_picking_journal_pickjournal0")], {"lang": "en_US", "search_default_user_id":
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal_picking")],
"active_id": ref("sale_journal.menu_definition_journal_picking")})
-
I verify that a state of journal has transit from draft to open state
-
!python {model: sale_journal.picking.journal}: |
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
assert (pick_jour.state == 'open'), "Journal is not in the open state"
-
Then I click on the 'Confirm Picking' button
-
!python {model: sale_journal.picking.journal}: |
self.button_picking_confirm(cr, uid, [ref("sale_journal_picking_journal_pickjournal0")], {"lang": "en_US", "search_default_user_id":
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal_picking")],
"active_id": ref("sale_journal.menu_definition_journal_picking")})
-
I verify that a state of journal has transit from open to confirm state
-
!python {model: sale_journal.picking.journal}: |
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
assert (pick_jour.state == 'confirm'), "Journal is not in the open state"
-
I verify that an picking order is now in the confirm state
-
!python {model: stock.picking}: |
pick_jour_obj = self.pool.get('sale_journal.picking.journal')
jour = pick_jour_obj.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
stock_pick = self.browse(cr, uid, ref("stock_picking_out0"))
pick_jour = self.search(cr, uid, [('journal_id','=',jour.name) and ('state','=','confirmed')])
assert pick_jour, "Sale order is not in the confirm state"
-
Then I click on the 'Close Journal' button
-
!python {model: sale_journal.picking.journal}: |
self.button_close(cr, uid, [ref("sale_journal_picking_journal_pickjournal0")], {"lang": "en_US", "search_default_user_id":
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal_picking")],
"active_id": ref("sale_journal.menu_definition_journal_picking")})
-
I verify that a state of journal has transit from confirm to close state
-
!python {model: sale_journal.picking.journal}: |
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
assert (pick_jour.state == 'close'), "Journal is not in the open state"