From e955eac8b107f415ebbf67ccee05a9e9823b4837 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Fri, 14 May 2010 20:44:22 +0530 Subject: [PATCH] Task-Id 529 : Add the yml for stock_location bzr revid: sbh@tinyerp.com-20100514151422-l63dx5x94lubzhwc --- addons/stock_location/__openerp__.py | 1 + addons/stock_location/test/stock_location.yml | 271 ++++++++++++++++++ 2 files changed, 272 insertions(+) create mode 100644 addons/stock_location/test/stock_location.yml diff --git a/addons/stock_location/__openerp__.py b/addons/stock_location/__openerp__.py index 7dd4e3facb9..c71199cb74c 100644 --- a/addons/stock_location/__openerp__.py +++ b/addons/stock_location/__openerp__.py @@ -42,6 +42,7 @@ This module may be useful for different purposes: 'update_xml': ['stock_view.xml', 'security/ir.model.access.csv'], 'demo_xml': [], 'installable': True, + 'test':['test/stock_location.yml',], 'active': False, 'certificate': '0046505115101', } diff --git a/addons/stock_location/test/stock_location.yml b/addons/stock_location/test/stock_location.yml new file mode 100644 index 00000000000..8313da69bb9 --- /dev/null +++ b/addons/stock_location/test/stock_location.yml @@ -0,0 +1,271 @@ + +- + In order to test the stock location module, I will create product,locations, + create physical inventory ,fill inventory lines, +- + 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: Ms. + + +- + 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}: + allocation_method: fifo + 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 + 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 + pricelist_sale: 'Public Pricelist (0.00) : 1.00\n' + 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 + allocation_method: fifo + 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: sale.shop}: + company_id: base.main_company + lot_input_id: stock.stock_location_stock + lot_output_id: stock_location.stock_location_suppiler0 + lot_stock_id: stock_location.stock_location_suppiler0 + name: OpenERP S.A. + partner_address_id: res_partner_address_0 +- + !record {model: sale.order, id: sale_order_01}: + date_order: '2010-04-20' + invoice_quantity: order + name: Test/location + order_line: + - name: HP CD writers + price_unit: 1000.0 + product_uom: product.product_uom_unit + product_uom_qty: 5.0 + state: draft + 'product_id': product_product_hpcdwriters0 + 'type': make_to_order + order_policy: manual + partner_id: base.res_partner_agrolait + partner_invoice_id: base.res_partner_address_8 + partner_order_id: base.res_partner_address_8 + partner_shipping_id: base.res_partner_address_8 + picking_policy: direct + pricelist_id: product.list0 + shop_id: sale.shop +- + I confirm the order +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_01} +- + I check the dealy 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)]) + 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)