[IMP] Imrpove the demo data

[ADD] Add new yml for push and pull flow and remove the old yml

bzr revid: sbh@tinyerp.com-20101008105814-9cc86y4h0hj12a5r
This commit is contained in:
sbh (Open ERP) 2010-10-08 16:28:14 +05:30
parent 05ed5b4531
commit 2605be1413
5 changed files with 401 additions and 288 deletions

View File

@ -82,8 +82,10 @@ product (i.e. the destination location of that procurement order).
'demo_xml': ['stock_location_demo.xml',],
'installable': True,
'test':[
'test/stock_location.yml'
'test':[''
'test/stock_location.yml',
'test/stock_location_pull_flow.yml',
'test/stock_location_push_flow.yml',
],
'active': False,
'certificate': '0046505115101',

View File

@ -4,35 +4,58 @@
<record id="product.product_product_cpu1" model="product.product">
<field name="description">This product use for push/pull path </field>
</record>
<record id="stock_location_path_0" model="stock.location.path">
<record id="stock_location_input0" model="stock.location">
<field name="location_id" ref="stock.stock_location_company"/>
<field eval="0" name="scrap_location"/>
<field name="company_id" ref="base.main_company"/>
<field name="usage">internal</field>
<field name="chained_location_type">none</field>
<field eval="1" name="active"/>
<field eval="27" name="parent_right"/>
<field name="name">Input</field>
<field name="chained_auto_packing">manual</field>
<field eval="26" name="parent_left"/>
</record>
<record id="stock_location_qualitytest0" model="stock.location">
<field name="location_id" ref="stock.stock_location_company"/>
<field eval="0" name="scrap_location"/>
<field name="company_id" ref="base.main_company"/>
<field name="usage">internal</field>
<field name="chained_location_type">none</field>
<field eval="1" name="active"/>
<field eval="25" name="parent_right"/>
<field name="name">Quality test</field>
<field name="chained_auto_packing">manual</field>
<field eval="24" name="parent_left"/>
</record>
<record id="stock_location_path_3" model="stock.location.path">
<field name="location_from_id" ref="stock.stock_location_suppliers"/>
<field name="product_id" ref="product.product_product_cpu1"/>
<field name="auto">auto</field>
<field name="invoice_state">none</field>
<field eval="1" name="delay"/>
<field name="location_dest_id" ref="stock.stock_location_stock"/>
<field model="stock.location" name="location_dest_id" search="[('name', '=', u'Input')]"/>
<field name="picking_type">out</field>
</record>
<record id="stock_location_path_1" model="stock.location.path">
<field name="location_from_id" ref="stock.stock_location_output"/>
<record id="stock_location_path_4" model="stock.location.path">
<field model="stock.location" name="location_from_id" search="[('name', '=', u'Input')]"/>
<field name="product_id" ref="product.product_product_cpu1"/>
<field name="auto">auto</field>
<field name="invoice_state">none</field>
<field eval="1" name="delay"/>
<field model="stock.location" name="location_dest_id" search="[('name', '=', u'Quality test')]"/>
<field name="picking_type">out</field>
</record>
<record id="stock_location_path_5" model="stock.location.path">
<field model="stock.location" name="location_from_id" search="[('name', '=', u'Quality test')]"/>
<field name="product_id" ref="product.product_product_cpu1"/>
<field name="auto">auto</field>
<field name="invoice_state">none</field>
<field eval="5" name="delay"/>
<field name="location_dest_id" ref="stock.stock_location_stock"/>
<field name="picking_type">out</field>
</record>
<record id="product_pulled_flow_l0" model="product.pulled.flow">
<field name="product_id" ref="product.product_product_cpu1"/>
<field name="location_id" ref="stock.stock_location_shop0"/>
<field name="invoice_state">none</field>
<field name="company_id" ref="base.main_company"/>
<field name="type_proc">move</field>
<field eval="0" name="cancel_cascade"/>
<field name="procure_method">make_to_order</field>
<field name="picking_type">out</field>
<field name="name">L001</field>
</record>
<record id="product_pulled_flow_l1" model="product.pulled.flow">
<field name="product_id" ref="product.product_product_cpu1"/>
<field name="location_src_id" ref="stock.stock_location_suppliers"/>

View File

@ -1,271 +0,0 @@
-
In order to test the stock location module, I will create product, locations, SO, warehouse.
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_asset0}:
close_method: balance
code: asset
name: Asset
sign: 1
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: income
name: Income
sign: 1
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: expense
name: Expense
sign: 1
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_receivable0}:
close_method: balance
code: receivable
name: Receivable
sign: 1
-
Creating a account.account record
-
!record {model: account.account, id: account_account_receivable0}:
code: '40000'
company_id: base.main_company
currency_mode: current
name: Receivable
parent_left: 1
parent_right: 2
type: receivable
user_type: account_account_type_receivable0
-
Creating a account.account record
-
!record {model: account.account, id: account_account_payable0}:
code: '440000'
company_id: base.main_company
currency_mode: current
name: Payable
parent_left: 3
parent_right: 4
type: payable
user_type: account_account_type_expense0
-
Creating a account.journal record
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: pur
company_id: base.main_company
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_bank_view
-
Creating a account.journal record
-
!record {model: account.journal, id: account_journal_salejouran0}:
code: sal
company_id: base.main_company
name: Sale Jouran
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
Creating a account.account record
-
!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_asset0
-
Creating a account.account record
-
!record {model: account.account, id: account_account_productsale0}:
code: '001'
company_id: base.main_company
currency_mode: current
name: Product Sale
type: other
user_type: account_account_type_income0
-
Creating a account.account record
-
!record {model: account.account, id: account_account_productpurchase0}:
code: '0002'
company_id: base.main_company
currency_mode: current
name: Product Purchase
type: other
user_type: account_account_type_expense0
-
Creating a res.partner record
-
!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
-
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_diasorinltd0}:
address:
- country_id: base.in
street: Ash House, Ash Road
name: DiaSorin Ltd
supplier: true
-
Creating a res.partner record
-
!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
-
Creating a res.partner.address record
-
!record {model: res.partner.address, id: res_partner_address_0}:
country_id: base.in
partner_id: res_partner_microlinktechnologies0
street: Ash House, Ash Road
title: base.res_partner_title_miss
-
Creating a product.category record
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
Creating a stock.location record
-
!record {model: stock.location, id: stock_location_suppiler0}:
chained_auto_packing: auto
chained_delay: 15
chained_location_type: none
company_id: base.main_company
name: Suppiler1
usage: supplier
-
Creating a product.product record
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: 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
path_ids:
- auto: auto
delay: 30
location_dest_id: stock.location_inventory
location_from_id: stock_location_suppiler0
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
-
Creating a stock.location record
-
!record {model: stock.location, id: stock_location_suppiler0}:
address_id: res_partner_address_0
chained_auto_packing: manual
chained_delay: 20
chained_location_type: none
company_id: base.main_company
name: Suppiler 1
usage: internal
-
I create warehouse.
-
!record {model: stock.warehouse, id: warehouse0}:
company_id: base.main_company
lot_input_id: stock.stock_location_stock
lot_output_id: stock_location_suppiler0
lot_stock_id: stock_location_suppiler0
name: OpenERP S.A.
partner_address_id: res_partner_address_0
-
I create outgoing picking order for HP CD writers.
-
!record {model: stock.picking, id: stock_picking_out0}:
address_id: base.res_partner_address_1
company_id: base.main_company
invoice_state: none
move_lines:
- date_expected: '2010-10-07 10:52:54'
location_dest_id: stock.stock_location_customers
location_id: stock_location_suppiler0
name: '[MB1] Mainboard ASUStek A7N8X'
product_id: product.product_product_mb1
product_qty: 1.0
product_uom: product.product_uom_unit
product_uos_qty: 1.0
move_type: direct
name: OUT/00007
type: out
-
I confirm the picking.
-
!python {model: stock.picking}: |
self.draft_validate(cr, uid, [ref("stock_picking_out0")], {"lang": "en_US",
"search_default_available": 1, "tz": False, "active_model": "ir.ui.menu",
"contact_display": "partner_address", "active_ids": [ref("stock.menu_action_picking_tree")],
"active_id": ref("stock.menu_action_picking_tree"), })
-
I check the delay mentioned in pushed flow in move.
-
!python {model: stock.move}: |
product_id=self.pool.get('product.product').search(cr,uid,[('name','=','HP CD writers')])
location_id=self.pool.get('stock.location').search(cr,uid,[('name','=','Inventory loss')])
move_ids =self.search(cr, uid, [('product_id','in',product_id),('location_dest_id','=',location_id)])
if move_ids:
move_obj=self.browse(cr,uid,move_ids)[0]
import time
from_dt = time.mktime(time.strptime(move_obj.date,'%Y-%m-%d %H:%M:%S'))
to_dt = time.mktime(time.strptime(move_obj.date_planned,'%Y-%m-%d %H:%M:%S'))
diff_day = (to_dt-from_dt)/(3600*24)
assert (round(diff_day)+1 ==30)

View File

@ -0,0 +1,226 @@
-
In order to test the product pulled flow , I create ,partner,product,procument
-
I create a account type Asset.
-
!record {model: account.account.type, id: account_account_type_asset0}:
close_method: balance
code: asset
name: Asset
sign: 1
-
I create a account type income.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: income
name: Income
sign: 1
-
I create a account type Expense.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: expense
name: Expense
sign: 1
-
I create a account type Receivable.
-
!record {model: account.account.type, id: account_account_type_receivable0}:
close_method: balance
code: receivable
name: Receivable
sign: 1
-
I create a account Receivable.
-
!record {model: account.account, id: account_account_receivable0}:
code: '40000'
company_id: base.main_company
currency_mode: current
name: Receivable
parent_left: 1
parent_right: 2
type: receivable
user_type: account_account_type_receivable0
-
I create a account Payable.
-
!record {model: account.account, id: account_account_payable0}:
code: '440000'
company_id: base.main_company
currency_mode: current
name: Payable
parent_left: 3
parent_right: 4
type: payable
user_type: account_account_type_expense0
-
I create a Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: pur
company_id: base.main_company
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_bank_view
-
I create a 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 a Sale Journal.
-
!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_asset0
-
I create Product Sale account.
-
!record {model: account.account, id: account_account_productsale0}:
code: '001'
company_id: base.main_company
currency_mode: current
name: Product Sale
type: other
user_type: account_account_type_income0
-
I create Product Product Purchase.
-
!record {model: account.account, id: account_account_productpurchase0}:
code: '0002'
company_id: base.main_company
currency_mode: current
name: Product Purchase
type: other
user_type: account_account_type_expense0
-
I create Supplier.
-
!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 product category.
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
I create product and define the pulled flow condition for stock move.
I set shipping type Sending Goods. and set Procurement type move.
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: 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
flow_pull_ids:
- invoice_state: none
location_id: stock.stock_location_shop0
location_src_id: stock.stock_location_shop1
name: E001
partner_address_id: base.res_partner_address_2
picking_type: out
procure_method: make_to_stock
type_proc: move
- invoice_state: none
location_id: stock.stock_location_shop1
location_src_id: stock.stock_location_suppliers
name: E002
partner_address_id: base.res_partner_address_7
picking_type: out
procure_method: make_to_stock
type_proc: move
- invoice_state: none
location_id: stock.stock_location_suppliers
location_src_id: stock.stock_location_stock
name: E003
type_proc: buy
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
qty_available: 15
-
I create procurement order.
-
!record {model: procurement.order, id: procurement_order_test0}:
company_id: base.main_company
date_planned: '2010-10-07 18:24:24'
location_id: stock.stock_location_shop0
name: Testing pulled flow
priority: '1'
procure_method: make_to_order
product_id: product_product_hpcdwriters0
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos: product.product_uom_unit
product_uos_qty: 0.0
-
I confirm procurement order.
-
!workflow {model: procurement.order, action: button_confirm, ref: procurement_order_test0}
-
I launch the scheduler to compute procurement.
-
!python {model: procurement.order.compute.all}: |
proc_obj = self.pool.get('procurement.order')
proc_obj._procure_confirm(cr,uid)
-
I check the state of procurement order is cancel and stock move is cancel.
-
!python {model: procurement.order }: |
from tools.translate import _
procurement_ids=self.search(cr, uid, [('id', '=', ref('procurement_order_test0'))])
if procurement_ids:
order=self.browse(cr,uid,procurement_ids)[0]
assert(order.state=='cancel')
-
I check the new of procurement order create .
-
!python {model: procurement.order }: |
from tools.translate import _
procurement_ids=self.search(cr, uid, [('name','=','E001')])
assert len(procurement_ids), "Procurement order hasn't Created."
-
I check the Outgoing Picking is create for source location Shop 2 and destination shop1.
-
!python {model: stock.picking }: |
from tools.translate import _
picking_id = self.search(cr, uid, [('origin','=','Testing pulled flow:E001'),('type','=','out')])
assert len(picking_id), "Picking hasn't Created."

View File

@ -0,0 +1,133 @@
-
In order to test the product pushed flow , I create account ,partner,product,shipment
Push flow specification indicates which location is chained with which location.
-
I create product category.
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
I create Supplier.
-
!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 Supplier address.
-
!record {model: res.partner.address, id: res_partner_address_0}:
country_id: base.in
partner_id: res_partner_microlinktechnologies0
street: Ash House, Ash Road
title: base.res_partner_title_miss
-
I create product and define the pushed flow .
-
I set the chain location Supplier to stock Input
Stock Input to Quality test and Quality test -Stock .
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: 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_diasorinltd0
min_qty: 5.0
path_ids:
- auto: auto
invoice_state: none
location_dest_id: stock_location.stock_location_input0
location_from_id: stock.stock_location_suppliers
- auto: auto
invoice_state: none
location_dest_id: stock_location.stock_location_qualitytest0
location_from_id: stock_location.stock_location_input0
- auto: auto
invoice_state: none
location_dest_id: stock.stock_location_stock
location_from_id: stock_location.stock_location_qualitytest0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
-
In order to test pushed flow .I buy the product from Micro Link Technologies supplier. I create a Picking.
-
!record {model: stock.picking , id: stock_picking_in0}:
address_id: res_partner_address_0
company_id: base.main_company
invoice_state: none
move_lines:
- date_expected: '2010-10-08 15:36:53'
location_dest_id: stock_location.stock_location_input0
location_id: stock.stock_location_suppliers
name: 'HP CD writers'
product_id: product_product_hpcdwriters0
product_qty: 6.0
product_uom: product.product_uom_unit
product_uos_qty: 6.0
name: Pushed Flow Test
type: in
-
I confirm picking.
-
!python {model: stock.picking }: |
self.draft_force_assign(cr, uid, [ref("stock_picking_in0")], {"lang": "en_US",
"search_default_available": 1, "tz": False, "active_model": "ir.ui.menu",
"contact_display": "partner_address", "active_ids": [ref("stock.menu_action_picking_tree4")],
"active_id": ref("stock.menu_action_picking_tree4"), })
-
I check that the outgoing order of the supplier is create with two move line.
Stock/Input To Quality test and Quality test To Stock.
I check the move is in waiting state.
-
!python {model: stock.picking }: |
from tools.translate import _
picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
for move in pick.move_lines:
assert(move.state == 'waiting'), _('Stock is not in waiting state')
-
I receive the order of the supplier DiaSorin from the Incoming Shipments menu.
-
!python {model: stock.picking }: |
import time
picking_id = self.search(cr, uid, [('address_id.partner_id','=',ref('res_partner_microlinktechnologies0')),('type','=','in')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
move =pick.move_lines[0]
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, picking_id,partial_datas)
-
I check the Outgoing Orders is automatically done.
-
!python {model: stock.picking }: |
from tools.translate import _
picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
assert(pick.state == 'done'), _('Picking is not in done state')