odoo/addons/stock/test/stock_test.yml

296 lines
8.8 KiB
YAML

-
In order to test the stock module, I will create product,
create physical inventory ,fill inventory lines from location,split inventory line into production lot
-
I create Receivable Account .
-
!record {model: account.account, id: account_account_receivable0}:
code: '40000-stock-test'
company_id: base.main_company
currency_mode: current
name: Receivable
parent_left: 1
parent_right: 2
type: receivable
user_type: account.account_type_receivable
-
I create Payable Account.
-
!record {model: account.account, id: account_account_payable0}:
code: '440000-stock-test'
company_id: base.main_company
currency_mode: current
name: Payable
parent_left: 3
parent_right: 4
type: payable
user_type: account.account_type_payable
-
I create Purchase Journal - (test).
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: pur
company_id: base.main_company
name: Purchase Journal - (test)
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_bank_view
-
I create Sale Journal.
-
!record {model: account.journal, id: account_journal_salejouran0}:
code: sal
company_id: base.main_company
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create Expense Account.
-
!record {model: account.account, id: account_account_expenseaccount0}:
code: Expe
company_id: base.main_company
currency_mode: current
name: Expense Account
parent_left: 5
parent_right: 6
type: consolidation
user_type: account.account_type_expense
-
I create Product Sale Account.
-
!record {model: account.account, id: account_account_productsale0}:
code: '001-stock-test'
company_id: base.main_company
currency_mode: current
name: Product Sale
type: other
user_type: account.account_type_income
-
I create Product Purchase Account.
-
!record {model: account.account, id: account_account_productpurchase0}:
code: '0002-stock-test'
company_id: base.main_company
currency_mode: current
name: Product Purchase
type: other
user_type: account.account_type_expense
-
I create partner.
-
!record {model: res.partner, id: res_partner_shawtrust0}:
address:
- country_id: base.in
- street: St James House, Vicar Lane, Sheffield
lang: en_US
name: 'Shaw Trust '
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
-
I create partner.
-
!record {model: res.partner, id: res_partner_diasorinltd0}:
address:
- country_id: base.in
street: Ash House, Ash Road
name: DiaSorin Ltd
supplier: true
-
I create partner.
-
!record {model: res.partner, id: res_partner_microlinktechnologies0}:
address:
- street: Kailash Vaibhav, Parksite
name: Micro Link Technologies
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
supplier: true
-
I create partner address.
-
!record {model: res.partner.address, id: res_partner_address_0}:
country_id: base.in
partner_id: stock.res_partner_diasorinltd0
street: Ash House, Ash Road
title: base.res_partner_title_miss
-
I create product.category .
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
I create product HP Pavilion Desktop PCs .
-
!record {model: product.product, id: product_product_hppaviliondesktoppcs0}:
categ_id: stock.product_category_computer0
cost_method: standard
mes_type: fixed
list_price: 1000.0
name: HP Pavilion Desktop PCs
procure_method: make_to_stock
seller_ids:
- delay: 1
name: stock.res_partner_shawtrust0
min_qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_account_expense: account_account_productsale0
property_account_income: account_account_productsale0
-
I create product HP CD writers.
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: stock.product_category_computer0
cost_method: standard
list_price: 1000.0
mes_type: fixed
name: HP CD writers
procure_method: make_to_stock
seller_ids:
- delay: 1
name: res_partner_shawtrust0
min_qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_account_expense: account_account_productpurchase0
property_account_income: account_account_productsale0
-
I create Physical Inventory for the products.
-
!record {model: stock.inventory, id: stock_inventory_physicalinventoy0}:
company_id: base.main_company
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
date_done: !eval time.strftime('%Y-%m-%d %H:%M:%S')
inventory_line_id:
- company_id: base.main_company
location_id: stock.stock_location_stock
product_id: stock.product_product_hpcdwriters0
product_qty: 10.0
product_uom: product.product_uom_unit
- company_id: base.main_company
location_id: stock.stock_location_stock
product_id: stock.product_product_hppaviliondesktoppcs0
product_qty: 10.0
product_uom: product.product_uom_unit
name: Physical inventory
state: draft
-
I confirm the Inventory for HP CD writers.
-
!python {model: stock.inventory}: |
self.action_confirm(cr,uid,[ref('stock_inventory_physicalinventoy0')])
self.action_done(cr,uid,[ref('stock_inventory_physicalinventoy0')])
-
I create stock.fill.inventory .
-
!record {model: stock.fill.inventory, id: stock_fill_inventory_0}:
location_id: stock.stock_location_stock
-
I fill inventory for HP CD writers.
-
!python {model: stock.fill.inventory}: |
self.fill_inventory(cr, uid, [ref("stock_fill_inventory_0")], {"lang": 'en_US',
"full": "1", "tz": False, "active_model": "stock.inventory", "active_ids":
[ref("stock_inventory_physicalinventoy0")], "active_id": ref("stock_inventory_physicalinventoy0"), })
-
I create stock.move.split record.
-
!record {model: stock.move.split, id: stock_move_split_0}:
line_ids:
- name: '00001-stock-test'
quantity: 5
product_id: stock.product_product_hpcdwriters0
-
I Split into production line.
-
!python {model: stock.move.split}: |
move_obj=self.pool.get('stock.move')
product_obj=self.pool.get('product.product')
product_id=product_obj.search(cr,uid,[('name','=','HP CD writers')])
move_ids=move_obj.search(cr,uid,[('product_id','in',product_id)])
self.split_lot(cr, uid, [ref("stock_move_split_0")], {"lang": 'en_US', "active_model":
"stock.move", "active_ids": move_ids, "tz": False, "active_id":move_ids[0]
})
-
In Order to test the picking I create picking with move lines.
-
!record {model: stock.picking, id: stock_picking_0}:
name: test_picking
address_id: base.res_partner_address_4
company_id: base.main_company
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
invoice_state: none
move_lines:
- company_id: base.main_company
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
location_dest_id: stock.stock_location_customers
location_id: stock.stock_location_stock
name: HP CD writers
product_id: product.product_product_pc1
product_qty: 3.0
product_uom: product.product_uom_unit
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
product_uos_qty: 3.0
move_type: direct
type: internal
-
I click on draft_force_assign on picking.
-
!python {model: stock.picking}: |
self.draft_force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
"ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display":
"partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
ref("stock.menu_action_picking_tree6"), })
-
I click on force_assign on picking.
-
!python {model: stock.picking}: |
self.force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
"ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display":
"partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
ref("stock.menu_action_picking_tree6"), })
-
I confirm the picking.
-
!python {model: stock.picking }: |
import time
pick = self.browse(cr,uid,ref('stock_picking_0'))
stock_partial_picking = self.pool.get('stock.partial.picking')
partial_id = stock_partial_picking.create(cr, uid, {},
context={'active_model': 'stock.picking',
'active_ids': [pick.id]})
stock_partial_picking.do_partial(cr, uid, [partial_id])