diff --git a/addons/stock_location/procurement_pull.py b/addons/stock_location/procurement_pull.py index c564422962f..56a35d93b0b 100644 --- a/addons/stock_location/procurement_pull.py +++ b/addons/stock_location/procurement_pull.py @@ -66,7 +66,6 @@ class procurement_order(osv.osv): 'invoice_state': line.invoice_state, }) - print "COmpany_id line:", line.company_id move_id = move_obj.create(cr, uid, { 'name': line.name, 'picking_id': picking_id, diff --git a/addons/stock_location/procurement_pull_workflow.xml b/addons/stock_location/procurement_pull_workflow.xml index d45942ae5a6..6bb10c2970f 100644 --- a/addons/stock_location/procurement_pull_workflow.xml +++ b/addons/stock_location/procurement_pull_workflow.xml @@ -19,5 +19,12 @@ + + + + + not check_produce() and not check_buy() and not check_move() + diff --git a/addons/stock_location/test/stock_location_pull_flow.yml b/addons/stock_location/test/stock_location_pull_flow.yml index 76b3a4cc44f..4dd5634eba7 100644 --- a/addons/stock_location/test/stock_location_pull_flow.yml +++ b/addons/stock_location/test/stock_location_pull_flow.yml @@ -1,163 +1,39 @@ - - In order to test the product pulled flow , I create ,partner,product,procurement -- - I create a account type Asset. -- - !record {model: account.account.type, id: account_account_type_asset0}: - close_method: balance - code: asset_test - name: Asset For Tests -- - I create a account type income. -- - !record {model: account.account.type, id: account_account_type_income0}: - close_method: unreconciled - code: income_test - name: Income For Tests -- - I create a account type Expense. -- - !record {model: account.account.type, id: account_account_type_expense0}: - close_method: unreconciled - code: expense_test - name: Expense For Tests -- - I create a account type Receivable. -- - !record {model: account.account.type, id: account_account_type_receivable0}: - close_method: unreconciled - code: receivable_test - name: Receivable For Tests -- - - I create a account Receivable. -- - !record {model: account.account, id: account_account_receivable0}: - code: 40000_test - company_id: base.main_company - currency_mode: current - name: Receivable For Tests - type: receivable - user_type: account_account_type_receivable0 -- - I create a account Payable. -- - !record {model: account.account, id: account_account_payable0}: - code: 440000_test - company_id: base.main_company - currency_mode: current - name: Payable For Tests - type: payable - user_type: account_account_type_expense0 -- - I create a Purchase Journal. -- - !record {model: account.journal, id: account_journal_purchasejournal0}: - code: pur_test - company_id: base.main_company - name: Purchase Journal For Tests - sequence_id: account.sequence_purchase_journal - type: purchase - -- - I create a Sale Journal. -- - !record {model: account.journal, id: account_journal_salejouran0}: - code: sal_test - company_id: base.main_company - name: Sale Journal For Tests - sequence_id: account.sequence_sale_journal - type: sale - -- - I create an Expense Account -- - !record {model: account.account, id: account_account_expenseaccount0}: - code: Expe_test - company_id: base.main_company - currency_mode: current - name: Expense Account For Tests - type: consolidation - user_type: account_account_type_asset0 -- - I create Product Sale account. -- - !record {model: account.account, id: account_account_productsale0}: - code: 001_test - company_id: base.main_company - currency_mode: current - name: Product Sale For Tests - type: other - user_type: account_account_type_income0 - -- - I create Product Product Purchase. -- - !record {model: account.account, id: account_account_productpurchase0}: - code: 0002_test - company_id: base.main_company - currency_mode: current - name: Product Purchase For Tests - type: other - user_type: account_account_type_expense0 -- - I create a Supplier. -- - !record {model: res.partner, id: res_partner_shawtrust0}: - name: Shaw Trust - lang: en_US - country_id: base.in - street: St James House, Vicar Lane, Sheffiel - property_account_payable: account_account_payable0 - property_account_receivable: account_account_receivable0 -- - I create a product category. -- - !record {model: product.category, id: product_category_computer0}: - name: Computer -- - I create a product and define the pulled flow condition for stock move. - I set shipping type Sending Goods. and set Procurement type to move. + In order to test the stock_location module, I create a product and define its pulled flows. If a product is needed either in Chicago Shop or in Birmingham shop, there must be a incomming move from transit location to these shops, and an outgoing move from Stock to the transit location. - !record {model: product.product, id: product_product_hpcdwriters01}: - 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 + property_account_expense: account.a_expense + property_account_income: account.rev flow_pull_ids: - invoice_state: none location_id: stock.stock_location_shop0 - location_src_id: stock.stock_location_shop1 + location_src_id: stock.stock_location_intermediatelocation0 name: E001 - picking_type: out - procure_method: make_to_stock + picking_type: in + procure_method: make_to_order type_proc: move company_id: stock.res_company_1 - invoice_state: none location_id: stock.stock_location_shop1 location_src_id: stock.stock_location_intermediatelocation0 name: E002 - picking_type: out - procure_method: make_to_stock + picking_type: in + procure_method: make_to_order type_proc: move - company_id: stock.res_company_1 + company_id: stock.res_company_2 - invoice_state: none location_id: stock.stock_location_intermediatelocation0 location_src_id: stock.stock_location_stock name: E003 type_proc: move + picking_type: out company_id: base.main_company property_stock_inventory: stock.location_inventory property_stock_procurement: stock.location_procurement @@ -187,18 +63,26 @@ - !python {model: procurement.order.compute.all}: | proc_obj = self.pool.get('procurement.order') - proc_obj._procure_confirm(cr,uid) + proc_obj._procure_confirm(cr,uid, ids=[ref('procurement_order_test0')]) - I check the new procurement order has been created . - !python {model: procurement.order }: | - from openerp.tools.translate import _ - procurement_ids=self.search(cr, uid, [('name','=','E001')]) - assert len(procurement_ids), "Procurement order hasn't Created." + procurement_ids = self.search(cr, uid, [('name','=','E001')]) + assert len(procurement_ids), "Procurement order hasn't been created." - - I check the Outgoing Picking is created for source location Birmingham Shop and destination Chicago shop. + I check the Outgoing Picking is created for source location Stock and destination Chicago shop. - !python {model: stock.picking }: | - from openerp.tools.translate import _ - picking_id = self.search(cr, uid, [('origin','=','Testing pulled flow:E001'),('type','=','out')]) - assert len(picking_id), "Picking hasn't Created." \ No newline at end of file + in_picking_id = self.search(cr, uid, [('origin','=','Testing pulled flow:E001'),('type','=','in')]) + assert len(in_picking_id), "Picking in hasn't been created." + in_picking = self.browse(cr, uid, in_picking_id[0]) + assert in_picking.move_lines[0].location_id.id == ref('stock.stock_location_intermediatelocation0'), "wrong source location for picking in" + assert in_picking.move_lines[0].location_dest_id.id == ref('stock.stock_location_shop0'), "wrong destination location for picking in" + assert in_picking.company_id.id == ref('stock.res_company_1'), "wrong company for picking in" + out_picking_id = self.search(cr, uid, [('origin','like','%E003%'),('type','=','out')]) + assert len(out_picking_id), "Picking out hasn't been created." + out_picking = self.browse(cr, uid, out_picking_id[0]) + assert out_picking.move_lines[0].location_id.id == ref('stock.stock_location_stock'), "wrong source location for picking out" + assert out_picking.move_lines[0].location_dest_id.id == ref('stock.stock_location_intermediatelocation0'), "wrong destination location for picking out" + assert out_picking.company_id.id == ref('base.main_company'), "wrong company for picking out" diff --git a/addons/stock_location/test/stock_location_push_flow.yml b/addons/stock_location/test/stock_location_push_flow.yml index 64bd30e0c99..9e153b5c27d 100644 --- a/addons/stock_location/test/stock_location_push_flow.yml +++ b/addons/stock_location/test/stock_location_push_flow.yml @@ -1,20 +1,14 @@ - 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}: street: Kailash Vaibhav, Parksite name: Micro Link Technologies - property_account_payable: account_account_payable0 - property_account_receivable: account_account_receivable0 + property_account_payable: account.a_pay + property_account_receivable: account.a_recv supplier: true is_company: true @@ -35,7 +29,6 @@ Stock Input to Quality test and Quality test -Stock . - !record {model: product.product, id: product_product_hpcdwriters01}: - categ_id: product_category_computer0 cost_method: standard list_price: 1000.0 mes_type: fixed