diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py
index 70dc37ec2da..c6ea30db330 100644
--- a/addons/stock/__openerp__.py
+++ b/addons/stock/__openerp__.py
@@ -80,6 +80,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
],
'test': ['test/stock_test.yml',
'test/stock_report.yml',
+ 'test/stock_test_wizard.yml',
],
'installable': True,
'active': False,
diff --git a/addons/stock/report/UPS.xml b/addons/stock/report/UPS.xml
deleted file mode 100644
index 0349fda556d..00000000000
--- a/addons/stock/report/UPS.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ES
-
- 1
-
-
- PP
-
-
-
-
-
diff --git a/addons/stock/report/__init__.py b/addons/stock/report/__init__.py
index 18bfe2609c2..412e77f3f17 100644
--- a/addons/stock/report/__init__.py
+++ b/addons/stock/report/__init__.py
@@ -20,7 +20,6 @@
##############################################################################
import product_stock
-import ups
import picking
import lot_overview_all
import report_stock
diff --git a/addons/stock/report/ups.py b/addons/stock/report/ups.py
deleted file mode 100644
index fb8483341ec..00000000000
--- a/addons/stock/report/ups.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from report.interface import report_rml
-
-class report_custom(report_rml):
- def create(self, uid, ids, datas, context):
- datas.setdefault('form', {})
- datas['form'].setdefault('weight', 3.0)
-
- datas['model'] = 'stock.move.lot'
- datas['ids'] = ids
- del datas['id']
-
- return (super(report_custom, self).create(uid, ids, datas, context), 'pdf')
-
-report_custom('report.stock.move.lot.ups_xml', 'stock.move.lot', 'addons/stock/report/UPS.xml', None)
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 283b9247b63..a0ae3bae582 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -2239,6 +2239,7 @@ class stock_move(osv.osv):
return super(stock_move, self).unlink(
cr, uid, ids, context=ctx)
+ # _create_lot function is not used anywhere
def _create_lot(self, cr, uid, ids, product_id, prefix=False):
""" Creates production lot
@return: Production lot id
@@ -2284,6 +2285,7 @@ class stock_move(osv.osv):
self.action_done(cr, uid, res)
return res
+ # action_split function is not used anywhere
def action_split(self, cr, uid, ids, quantity, split_by_qty=1, prefix=False, with_lot=True, context=None):
""" Split Stock Move lines into production lot which specified split by quantity.
@param cr: the database cursor
diff --git a/addons/stock/test/stock_test.yml b/addons/stock/test/stock_test.yml
index 6a82846492d..ebd3c6670b4 100644
--- a/addons/stock/test/stock_test.yml
+++ b/addons/stock/test/stock_test.yml
@@ -2,179 +2,103 @@
-
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 Stock Production Lot for product PC3
+-
+ !record {model: stock.production.lot, id: stock_production_lot0}:
+ product_id: product.product_product_pc3
+ date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
+ name: 0000001
+-
+ I trace the Stock Production Lot for product PC3.
+-
+ !python {model: stock.production.lot }: |
+ self.action_traceability(cr,uid,[ref('stock_production_lot0')], {'lang': 'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'field': '', 'type': ''})
-
-
- I create Receivable Account .
+ I create change product quantity for product PC3.
-
- !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
+ !record {model: stock.change.product.qty, id: stock_change_product_qty0}:
+ product_id: product.product_product_pc3
+ new_quantity: 100
+ location_id: stock.stock_location_stock
+ prodlot_id: stock.stock_production_lot0
-
- I create Sale Journal.
+ I apply the new quantity on product PC3.
-
- !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
+ !python {model: stock.change.product.qty }: |
+ context = {"lang": 'en_US', "active_model":
+ "product.product", "active_ids": [ref("product.product_product_pc3")], "tz": False, "active_id":ref('product.product_product_pc3')}
+ self.default_get(cr, uid, ["prodlot_id", "location_id", "new_quantity", "product_id"], context)
+ self.fields_view_get(cr, uid, ref("stock.view_change_product_quantity"),"form", context)
+ self.change_product_qty(cr, uid, [ref("stock_change_product_qty0")], {"lang": 'en_US', "active_model":
+ "stock.change.product.qty", "active_ids": ref("product.product_product_pc3"), "tz": False, "active_id":ref('product.product_product_pc3')})
-
- I create Expense Account.
+ I check that the quantity on product PC3 is updated.
-
- !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
-
+ !python {model: product.product }: |
+ pro_obj = self.browse(cr, uid, ref("product.product_product_pc3"))
+ assert (pro_obj.qty_available >= 100) , "The quantity of PC3 is not updated!"
-
- I create Product Purchase Account.
+ I Read quantity on product PC3.
-
- !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
+ !python {model: stock.location }: |
+ self.read(cr, uid, [ref("stock.stock_location_stock")],['stock_real_value','stock_virtual'], {'lang': 'en_GB', 'tz': False, 'active_model': 'product.product', 'bin_size': True, 'active_ids': [ref("product.product_product_pc3")], 'product_id':ref("product.product_product_pc3"), 'active_id': ref("product.product_product_pc3")})
+
+-
+ I Creating a chained stock.location record
+-
+ !record {model: stock.location, id: stock_location_loc0}:
+ chained_auto_packing: auto
+ chained_delay: 0.0
+ chained_location_id: stock.stock_location_customers
+ chained_location_type: fixed
+ location_id: stock.stock_location_company
+ name: chain location
+ parent_left: 2
+ parent_right: 3
+ usage: internal
-
- I create partner.
+ I create Product By location chart for stock.location.product Object.
-
- !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
-
+ !record {model: stock.location.product, id: stock_location_product0}:
+ from_date: '2011-07-01 00:00:00'
+ to_date: '2011-07-31 23:59:00'
-
- I create partner.
+ I open product chart.
-
- !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
+ !python {model: stock.location.product }: |
+ self.action_open_window(cr, uid, [ref("stock_location_product0")], {'lang': 'en_US', 'full': 1, 'tz': False, 'active_model': 'stock.location', 'search_default_in_location': 1, 'active_ids': [ref("stock.stock_location_stock")], 'active_id': ref("stock.stock_location_stock")})
-
- I create partner address.
+ I open product form from stock.location object .
-
- !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
-
+ !python {model: product.product }: |
+ self.fields_view_get(cr, uid, False, "tree", {'lang': 'en_US', 'full': 1, 'tz': False, 'active_model': 'stock.location', 'location': ref('stock.stock_location_stock'), 'search_default_in_location': 1, 'active_ids': [ref("stock.stock_location_stock")], 'active_id': ref("stock.stock_location_stock")})
-
- I create product.category .
+ I create change product standard price for product PC3.
-
- !record {model: product.category, id: product_category_computer0}:
- name: Computer
+ !record {model: stock.change.standard.price, id: stock_change_standard_price0}:
+ new_price: 1515
+ stock_account_input: account.a_recv
+ stock_account_output: account.a_pay
+ stock_journal: account.expenses_journal
+ enable_stock_in_out_acc: True
-
- I create product HP Pavilion Desktop PCs .
+ I apply the new product standard price on product PC3.
-
- !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
+ !python {model: stock.change.standard.price }: |
+ context = {"lang": 'en_US', "active_model":
+ "product.product", "active_ids": [ref("product.product_product_pc3")], "tz": False, "active_id":ref('product.product_product_pc3')}
+ self.default_get(cr, uid, ["new_price"], context)
+ self.change_price(cr, uid, [ref("stock_change_product_qty0")], context)
-
I create Physical Inventory for the products.
@@ -182,64 +106,128 @@
!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_id: product.product_product_pc3
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_id: product.product_product_pc1
product_qty: 10.0
product_uom: product.product_uom_unit
name: Physical inventory
state: draft
+-
+ I create merge Inventory for the products.
+-
+ !record {model: stock.inventory, id: stock_inventory_mergeinventoy0}:
+ company_id: base.main_company
+ date: !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: product.product_product_pc3
+ product_qty: 20.0
+ product_uom: product.product_uom_unit
+ - company_id: base.main_company
+ location_id: stock.stock_location_stock
+ product_id: product.product_product_pc1
+ product_qty: 20.0
+ product_uom: product.product_uom_unit
+ name: Physical inventory
+ state: draft
-
- I confirm the Inventory for HP CD writers.
+ I merge inventory .
-
- !python {model: stock.inventory}: |
- self.action_confirm(cr,uid,[ref('stock_inventory_physicalinventoy0')])
- self.action_done(cr,uid,[ref('stock_inventory_physicalinventoy0')])
+ !python {model: stock.inventory.merge}: |
+ context = {"lang": 'en_US',
+ "full": "1", "tz": False, "active_model": "stock.inventory", "active_ids":
+ [ref("stock_inventory_physicalinventoy0"), ref("stock_inventory_mergeinventoy0")], "active_id": ref("stock_inventory_physicalinventoy0"), }
+ self.fields_view_get(cr, uid, False, "form", context)
+ self.do_merge(cr, uid, [ref("stock_inventory_mergeinventoy0")], context)
+
+-
+ I create stock.inventory.line record.
+-
+ !record {model: stock.inventory.line, id: stock_inventory_line}:
+ product_id: product.product_product_pc1
+ product_uom: product.product_uom_unit
+ product_qty: 10
+ inventory_id: stock_inventory_mergeinventoy0
+ location_id: stock.stock_location_stock
+
+-
+ I Change a Product oF stock.inventory.line record.
+-
+ !python {model: stock.inventory.line}: |
+ self.on_change_product_id(cr, uid, [ref("stock_inventory_line")], ref('stock.stock_location_stock'), ref('product.product_product_pc3'), False, False)
+
-
I create stock.fill.inventory .
-
!record {model: stock.fill.inventory, id: stock_fill_inventory_0}:
location_id: stock.stock_location_stock
+ recursive: False
+ set_stock_zero: False
-
- I fill inventory for HP CD writers.
+ I fill inventory for PC3.
-
!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"), })
+ context = {"lang": 'en_US',"full": "1", "tz": False, "active_model": "stock.inventory", "active_ids":
+ [ref("stock_inventory_physicalinventoy0")], "active_id": ref("stock_inventory_physicalinventoy0")}
+ self.view_init(cr, uid, ["set_stock_zero", "location_id", "recursive"], context)
+ self.fill_inventory(cr, uid, [ref("stock_fill_inventory_0")], context)
-
- I create stock.move.split record.
+ I create stock.inventory.line.split record.
-
- !record {model: stock.move.split, id: stock_move_split_0}:
+ !record {model: stock.inventory.line.split, id: stock_inventory_line_0}:
line_ids:
- - name: '00001-stock-test'
+ - name: '00002-stock-test'
quantity: 5
- product_id: stock.product_product_hpcdwriters0
+ line_exist_ids:
+ - name: '00003-stock-test'
+ quantity: 5
+ product_id: product.product_product_pc1
+ product_uom: product.product_uom_unit
+ use_exist: False
+ qty: 10
-
- 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]
- })
+ I Split stock.inventory.line into production line.
-
+ !python {model: stock.inventory.line.split}: |
+ context = {"lang": 'en_US', "active_model": "stock.inventory.line",
+ "active_ids": [ref("stock_inventory_line_0")], "tz": False, "active_id": ref("stock_inventory_line_0")}
+ self.default_get(cr, uid, ["product_id", "product_uom", "line_exist_ids", "qty",
+ "line_ids", "use_exist"], context)
+ self.split_lot(cr, uid, [ref("stock_inventory_line_0")], context)
+-
+ I confirm the Inventory for PC3.
+-
+ !python {model: stock.inventory}: |
+ self.action_confirm(cr,uid,[ref('stock_inventory_physicalinventoy0')])
+ self.action_done(cr,uid,[ref('stock_inventory_physicalinventoy0')])
+
+-
+ I cancel the Inventory for PC3.
+-
+ !python {model: stock.inventory}: |
+ self.action_cancel_inventary(cr,uid,[ref('stock_inventory_physicalinventoy0')])
+
+-
+ I change inventory state to draft for PC3.
+-
+ !python {model: stock.inventory}: |
+ self.action_cancel_draft(cr,uid,[ref('stock_inventory_physicalinventoy0')])
+
+-
In Order to test the picking I create picking with move lines.
-
!record {model: stock.picking, id: stock_picking_0}:
@@ -247,21 +235,36 @@
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
+ invoice_state: 2binvoiced
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_dest_id: stock.stock_location_loc0
location_id: stock.stock_location_stock
- name: HP CD writers
- product_id: product.product_product_pc1
- product_qty: 3.0
+ name: PC3
+ product_id: product.product_product_pc3
+ product_qty: 100.0
product_uom: product.product_uom_unit
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
- product_uos_qty: 3.0
+ product_uos_qty: 100.0
move_type: direct
- type: internal
+ type: out
+-
+ I Performing an osv_memory action split on module stock.split.into
+-
+ !python {model: stock.picking }: |
+ pick=self.browse(cr,uid,ref('stock_picking_0'))
+ split_obj=self.pool.get('stock.split.into')
+ partial_datas={}
+ move=pick.move_lines[0]
+ partial_datas= {
+ 'quantity': 20,
+ }
+ split_id = self.pool.get('stock.split.into').create(cr, uid, partial_datas)
+ split_obj.split(cr, uid, [split_id], {"lang": "en_US", "tz":
+ False, "active_model": "stock.move", "active_ids": [move.id],
+ "active_id": move.id, })
-
I click on draft_force_assign on picking.
@@ -272,31 +275,207 @@
"partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
ref("stock.menu_action_picking_tree6"), })
-
-
- I click on force_assign on picking.
+ I click on action_assign on picking.
-
!python {model: stock.picking}: |
- self.force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
+ self.action_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.
+ I create a record for stock.partial.move.
+-
+ !record {model: stock.partial.move, id: stock_partial_move_0}:
+ date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
+
+-
+ I done stock.partial.move record.
+-
+ !python {model: stock.partial.move }: |
+ pick_obj = self.pool.get('stock.picking')
+ move_obj = self.pool.get('stock.move')
+ pick=pick_obj.browse(cr,uid,ref('stock_picking_0'))
+ search_id = move_obj.search(cr, uid, [('picking_id', '=', pick.id)])
+ partial_datas={}
+ for move in pick.move_lines:
+ partial_datas['move%s'%(move.id)]= {
+ 'quantity': 20,
+ 'product_uom': move.product_uom.id,
+ 'prodlot_id': move.prodlot_id and move.prodlot_id.id or False,
+ 'wizard_id': ref('stock_partial_move_0'),
+ }
+ context = {"lang": 'en_US', "active_model": "stock.move", "active_ids": search_id, "tz": False, "active_id":search_id[0]}
+ self.fields_view_get(cr, uid, False,"form", context)
+ self.do_partial(cr, uid, [ref('stock_partial_move_0')], context)
+
+-
+ I Performing an osv_memory action split_lot on module stock.move.split
+-
+
+ !python {model: stock.picking }: |
+ split_obj=self.pool.get('stock.move.split')
+ split_move_lines=self.pool.get('stock.move.split.lines')
+ pick=self.browse(cr,uid,ref('stock_picking_0'))
+ partial_datas={}
+ move=pick.move_lines[0]
+ partial_datas= {
+ 'product_id': move.product_id.id,
+ 'qty': 80,
+ 'product_uom': move.product_uom.id,
+ 'use_exist': move.picking_id and move.picking_id.type=='out' and True or False
+ }
+ split_id = self.pool.get('stock.move.split').create(cr, uid, partial_datas, context={})
+ split_move_data= {
+ 'lot_id': split_id,
+ 'quantity': 10,
+ 'name': 'lot',
+ }
+ split_move_id = split_move_lines.create(cr, uid, split_move_data, context={})
+ split_obj.default_get(cr, uid, ["product_id", "product_uom", "line_exist_ids", "qty",
+ "line_ids", "use_exist"], {'lang': 'en_US', 'default_location_dest_id': ref('stock.stock_location_stock'), 'tz': False, 'active_model': 'stock.move', 'search_default_receive': 1, 'product_receive': True, 'active_ids': [move.id], 'default_location_id': ref('stock.stock_location_locations'), 'active_id': move.id})
+ split_obj.split_lot(cr, uid, [split_id], context={"lang": "en_US", "tz":
+ False, "active_model": "stock.move", "scrap": True, "active_ids": [move.id],
+ "active_id": move.id, })
+
+-
+ I Performed an osv_memory action move_scrap on module stock.move.scrap
-
!python {model: stock.picking }: |
- import time
- pick=self.browse(cr,uid,ref('stock_picking_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,
- 'product_qty': move.product_qty,
+ location_obj = self.pool.get('stock.location')
+ scrpaed_location_ids = location_obj.search(cr, uid, [('scrap_location','=',True)])
+ pick=self.browse(cr,uid,ref('stock_picking_0'))
+ scrap_obj=self.pool.get('stock.move.scrap')
+ partial_datas={}
+ move=pick.move_lines[0]
+ partial_datas= {
+ 'product_id': move.product_id.id,
+ 'location_id': scrpaed_location_ids[0],
+ 'product_qty': 1,
'product_uom': move.product_uom.id,
}
- self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)
+ scrap_id = scrap_obj.create(cr, uid, partial_datas)
+ context = {"lang": "en_US", "tz": False, "active_model": "stock.move",
+ "scrap": True, "active_ids": [move.id], "active_id": move.id, }
+ scrap_obj.default_get(cr, uid, ["location_id", "product_id", "product_uom", "product_qty"], context)
+ scrap_obj.move_scrap(cr, uid, [scrap_id], context)
+
+-
+ I Performed an osv_memory do move consume on module stock.move.consume
+-
+ !python {model: stock.picking }: |
+ location_obj = self.pool.get('stock.location')
+ scrpaed_location_ids = location_obj.search(cr, uid, [('scrap_location','=',True)])
+ pick=self.browse(cr,uid,ref('stock_picking_0'))
+ consume_obj=self.pool.get('stock.move.consume')
+ partial_datas={}
+ move=pick.move_lines[0]
+ partial_datas= {
+ 'product_id': move.product_id.id,
+ 'location_id': scrpaed_location_ids[0],
+ 'product_qty': 1,
+ 'product_uom': move.product_uom.id,
+ }
+ context = {"lang": "en_US", "tz": False, "active_model": "stock.move",
+ "scrap": True, "active_ids": [move.id], "active_id": move.id, }
+ consume_id = consume_obj.create(cr, uid, partial_datas)
+ consume_obj.default_get(cr, uid, ["location_id", "product_id", "product_uom", "product_qty"], context)
+ consume_obj.do_move_consume(cr, uid, [consume_id], context)
+
+-
+ I create a record for stock partial picking.
+-
+ !record {model: stock.partial.picking, id: stock_partial_picking_0}:
+ date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
+
+-
+ I make stock partial picking order Done.
+-
+ !python {model: stock.partial.picking}: |
+ pick_obj = self.pool.get('stock.picking')
+ partial = self.browse(cr, uid, ref('stock_partial_picking_0'), context)
+ partial_datas = {
+ 'delivery_date' : partial.date
+ }
+ for pick in pick_obj.browse(cr, uid, [ref('stock_picking_0')]):
+ for m in pick.move_lines:
+ partial_datas['move%s'%(m.id)] = {
+ 'product_id' : m.product_id.id,
+ 'product_qty' : 80,
+ 'product_uom' : m.product_uom.id
+ }
+ context = {"lang": "en_US", "search_default_available":
+ 1, "tz": False, "active_model": "ir.ui.menu",
+ "active_ids": [ref('stock_picking_0')], "active_id": ref("stock_picking_0"),
+ }
+ self.fields_view_get(cr, uid, False,"form", context)
+ self.do_partial(cr, uid, [ref('stock_partial_picking_0')], context)
+
+-
+ I Performing an osv_memory action create_invoice on module stock.invoice.onshipping
+-
+ !python {model: stock.invoice.onshipping}: |
+ invoice_line_id = self.create(cr, uid,{}, {"lang": 'en_US', "active_model":
+ "stock.picking", "active_ids": [ref("stock_picking_0")], "tz": False, "active_id":ref("stock_picking_0")})
+ self.open_invoice(cr, uid, [invoice_line_id], {"lang": "en_US",
+ "search_default_available": 1, "inv_type": "in_invoice" , "tz": False, "active_model": "stock.picking",
+ "contact_display": "partner_address", "active_ids": [ref("stock_picking_0")],
+ "active_id": ref("stock_picking_0")})
+ self._get_journal_id(cr, uid, {"lang": "en_US", "search_default_available": 1, "tz": False, "active_model": "stock.picking",
+ "contact_display": "partner_address", "active_ids": [ref("stock_picking_0")],
+ "active_id": ref("stock_picking_0"), })
+
+-
+ I create a record of stock.picking and unlink a record
+-
+ !python {model: stock.picking}: |
+ copy_id = self.copy(cr, uid, (ref("stock_picking_0")))
+ ctx = {"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"), }
+ self.draft_force_assign(cr, uid, [copy_id], ctx)
+ self.unlink(cr, uid, [copy_id], ctx)
+
+-
+ I create a record of stock.picking and cancel a record
+-
+ !python {model: stock.picking}: |
+ copy_id = self.copy(cr, uid, (ref("stock_picking_0")))
+ self.draft_validate(cr, uid, [copy_id], {"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"),
+ })
+ pick=self.browse(cr,uid,copy_id)
+ self.allow_cancel(cr, uid, [copy_id], context= None)
+
+-
+ I create a record of stock.picking and I reaturn the picking
+-
+ !python {model: stock.picking}: |
+ copy_id = self.copy(cr, uid, (ref("stock_picking_0")))
+ ctx = {"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")}
+ self.draft_force_assign(cr, uid, [copy_id], ctx)
+ self.force_assign(cr, uid, [copy_id], ctx)
+ pick=self.browse(cr,uid,copy_id)
+ partial_datas={}
+ for move in pick.move_lines:
+ partial_datas['move%s'%(move.id)]= {
+ 'product_id': move.product_id,
+ 'product_qty': move.product_qty,
+ }
+ self.do_partial(cr, uid, [pick.id],partial_datas)
+ reurn_datas={}
+ context = {"lang": 'en_US', "active_model":
+ "stock.picking", "active_ids": [pick.id], "tz": False, "active_id":pick.id}
+ return_pick_id = self.pool.get('stock.return.picking').create(cr, uid,{}, context)
+ for move in pick.move_lines:
+ reurn_datas= {
+ 'product_id': move.product_id.id,
+ 'quantity': move.product_qty,
+ }
+ self.pool.get('stock.return.picking').create_returns(cr, uid, [return_pick_id], context)
diff --git a/addons/stock/test/stock_test_wizard.yml b/addons/stock/test/stock_test_wizard.yml
new file mode 100644
index 00000000000..6c4d5ae12c2
--- /dev/null
+++ b/addons/stock/test/stock_test_wizard.yml
@@ -0,0 +1,78 @@
+
+-
+ I create stock.tracking record.
+-
+ !record {model: stock.tracking, id: stock_tracking_0}:
+ move_ids:
+ - product_id: product.product_product_pc1
+ product_qty: 5.0
+ product_uom: product.product_uom_unit
+ location_id : stock.stock_location_suppliers
+ location_dest_id: stock.stock_location_shop0
+ name : '[PC1] Basic PC'
+ date_expected : !eval time.strftime('%Y-%m-%d %H:%M:%S')
+ name: 0000007
+ active: True
+ date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
+
+-
+ I trace the information of a product.
+-
+ !python {model: stock.tracking}: |
+ self.name_get(cr, uid, [ref('stock_tracking_0')],{'lang': 'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'field': '', 'type': ''})
+ self.action_traceability(cr,uid,[ref('stock_tracking_0')], {'lang': 'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'field': '', 'type': ''})
+
+-
+ I creat stock.move Record
+-
+ !record {model: stock.move, id: stock_move_test0}:
+ location_dest_id: stock.stock_location_shop0
+ product_id: product.product_product_pc1
+ product_qty: 5.0
+ product_uom: product.product_uom_unit
+ date_expected : !eval time.strftime('%Y-%m-%d %H:%M:%S')
+ location_id : stock.stock_location_suppliers
+ name : '[PC1] Basic PC'
+ company_id: base.main_company
+ product_uos_qty : 5.0
+ name: IN/00010
+ state: assigned
+
+-
+ I Check onchange function of stock.move object
+-
+ !python {model: stock.move }: |
+ self.onchange_lot_id(cr, uid, [ref("stock_move_test0")], ref("stock.stock_production_lot0"), 5, ref("stock.stock_location_suppliers"), ref("product.product_product_pc1"), ref("product.product_uom_unit"), None)
+ self.onchange_quantity(cr, uid, [ref("stock_move_test0")], ref("product.product_product_pc1"), 10, ref("product.product_uom_unit"), ref("product.product_uom_unit"))
+ self.onchange_uos_quantity(cr, uid, [ref("stock_move_test0")], ref("product.product_product_pc1"), 10, ref("product.product_uom_unit"), ref("product.product_uom_unit"))
+ self.onchange_product_id(cr, uid, [ref("stock_move_test0")], ref("product.product_product_pc1"), ref("stock.stock_location_suppliers"), ref("stock.stock_location_shop0"), False)
+
+-
+ I Check _getSSCC and action_partial_move function of stock.move object
+-
+ !python {model: stock.move }: |
+ context = {"lang": 'en_US', "default_location_dest_id": ref("stock.stock_location_shop0"), "active_model":
+ "stock.move", "search_default_receive": 1, 'product_receive': True, "default_location_id": ref("stock.stock_location_suppliers"),"active_ids":[ref("stock_move_test0")], "tz": False, "active_id":ref("stock_move_test0")}
+ self._getSSCC(cr, uid , context)
+ self.action_partial_move(cr, uid , [ref("stock_move_test0")], context)
+
+-
+ I check write function
+-
+ !python {model: stock.move }: |
+ vals = {"product_qty" : 2, "product_uos_qty": 2}
+ self.write(cr, uid, [ref("stock_move_test0")], vals, {"lang": 'en_US', "default_location_dest_id": ref("stock.stock_location_shop0"), "active_model":
+ "ir.ui.menu", "search_default_receive": 1, 'product_receive': True, "default_location_id": ref("stock.stock_location_suppliers"),"active_ids":[ref("stock_move_tree")], "tz": False, "active_id":ref("stock_move_tree")})
+
+-
+ I check default function
+-
+ !python {model: stock.move }: |
+ self.name_get(cr, uid, [ref("stock_move_test0")], {"lang": 'en_US', "default_location_dest_id": ref("stock.stock_location_shop0"), "active_model":
+ "stock.move", "search_default_receive": 1, 'product_receive': True, "default_location_id": ref("stock.stock_location_suppliers"),"active_ids":[ref("stock_move_test0")], "tz": False, "active_id":ref("stock_move_test0")})
+ ctx = {"lang": 'en_US', "default_location_dest_id": ref("stock.stock_location_shop0"), "active_model":
+ "ir.ui.menu", "search_default_receive": 1, 'product_receive': True, "default_location_id": ref("stock.stock_location_suppliers"),"active_ids":[ref("view_move_form_reception_picking")], "tz": False, "active_id":ref("view_move_form_reception_picking")}
+ self._default_location_destination(cr, uid, ctx)
+ self._default_location_source(cr, uid, ctx)
+
+
diff --git a/addons/stock/wizard/__init__.py b/addons/stock/wizard/__init__.py
index b903f020f82..e37483bfb37 100644
--- a/addons/stock/wizard/__init__.py
+++ b/addons/stock/wizard/__init__.py
@@ -24,8 +24,6 @@ import stock_move
import stock_splitinto
import stock_partial_picking
import stock_partial_move
-import stock_replacement
-import stock_ups
import stock_inventory_merge
import stock_fill_inventory
import stock_inventory_line_split
diff --git a/addons/stock/wizard/stock_change_standard_price.py b/addons/stock/wizard/stock_change_standard_price.py
index d6b7355bb7c..fa36559dddc 100644
--- a/addons/stock/wizard/stock_change_standard_price.py
+++ b/addons/stock/wizard/stock_change_standard_price.py
@@ -69,6 +69,7 @@ class change_standard_price(osv.osv_memory):
return res
+ # onchange_price function is not used anywhere
def onchange_price(self, cr, uid, ids, new_price, context=None):
""" Sets stock input and output account according to the difference
of old price and new price.
diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py
index 395758b121b..a7b2554576b 100644
--- a/addons/stock/wizard/stock_invoice_onshipping.py
+++ b/addons/stock/wizard/stock_invoice_onshipping.py
@@ -135,6 +135,8 @@ class stock_invoice_onshipping(osv.osv_memory):
active_picking = picking_pool.browse(cr, uid, context.get('active_id',False), context=context)
inv_type = picking_pool._get_invoice_type(active_picking)
context['inv_type'] = inv_type
+ if isinstance(onshipdata_obj[0]['journal_id'], tuple):
+ onshipdata_obj[0]['journal_id'] = onshipdata_obj[0]['journal_id'][0]
res = picking_pool.action_invoice_create(cr, uid, active_ids,
journal_id = onshipdata_obj[0]['journal_id'],
group = onshipdata_obj[0]['group'],
diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py
index 42e2ba95acc..0e84997db85 100644
--- a/addons/stock/wizard/stock_move.py
+++ b/addons/stock/wizard/stock_move.py
@@ -23,35 +23,6 @@ from osv import fields, osv
import decimal_precision as dp
-class stock_move_track(osv.osv_memory):
- _name = "stock.move.track"
- _description = "Track moves"
-
- _columns = {
- 'tracking_prefix': fields.char('Tracking prefix', size=64),
- 'quantity': fields.float("Quantity per lot")
- }
-
- _defaults = {
- 'quantity': lambda *x: 1
- }
-
- def track_lines(self, cr, uid, ids, context=None):
- """ To track stock moves lines
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param ids: An ID or list of IDs if we want more than one
- @param context: A standard dictionary
- @return:
- """
- datas = self.read(cr, uid, ids)[0]
- move_obj = self.pool.get('stock.move')
- move_obj._track_lines(cr, uid, context['active_id'], datas, context=context)
- return {'type': 'ir.actions.act_window_close'}
-
-stock_move_track()
-
class stock_move_consume(osv.osv_memory):
_name = "stock.move.consume"
_description = "Consume Products"
diff --git a/addons/stock/wizard/stock_move_view.xml b/addons/stock/wizard/stock_move_view.xml
index 5f4bc1f71c5..3895f93ddc7 100644
--- a/addons/stock/wizard/stock_move_view.xml
+++ b/addons/stock/wizard/stock_move_view.xml
@@ -1,35 +1,6 @@
-
-
- Tracking a move
- stock.move.track
- form
-
-
-
-
-
-
- Tracking a move
- ir.actions.act_window
- stock.move.track
- form
- form
- new
-
-
-
diff --git a/addons/stock/wizard/stock_replacement.py b/addons/stock/wizard/stock_replacement.py
deleted file mode 100644
index 17f4d5a62ab..00000000000
--- a/addons/stock/wizard/stock_replacement.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import time
-
-class stock_replacement(osv.osv_memory):
- """
- This class has been defined for replacement wizard
- """
- _name = "stock.replacement"
- _description = "Stock Replacement"
-
- def get_composant(self, cr, uid, ids, context=None):
- return {}
-
- def replace_composant(self, cr, uid, ids, context=None):
- """ To open a new wizard that acknowledge, a replacement task
- @return: It returns the replacement acknowledgement form
- """
- return {
- 'name': False,
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'stock.replacement.result',
- 'type': 'ir.actions.act_window',
- 'target':'new',
- }
-
-stock_replacement()
-
-class stock_replacement_result(osv.osv_memory):
- """
- This class has been defined for replacement result
- """
- _name = "stock.replacement.result"
- _description = "Stock Replacement result"
-
-stock_replacement_result()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/stock/wizard/stock_replacement_view.xml b/addons/stock/wizard/stock_replacement_view.xml
deleted file mode 100644
index cea5bfedbe8..00000000000
--- a/addons/stock/wizard/stock_replacement_view.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
- Stock Replacement
- stock.replacement
- form
-
-
-
-
-
-
-
-
-
- Stock Replacement result
- stock.replacement.result
- form
-
-
-
-
-
-
-
diff --git a/addons/stock/wizard/stock_ups.py b/addons/stock/wizard/stock_ups.py
deleted file mode 100644
index fb47587f254..00000000000
--- a/addons/stock/wizard/stock_ups.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import netsvc
-from osv import fields, osv
-from tools.translate import _
-
-class stock_ups(osv.osv_memory):
- _name = "stock.ups"
- _description = "Stock ups"
-
- def ups_save(self, cr, uid, ids, context=None):
- return {
- 'name': False,
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'stock.ups.final',
- 'type': 'ir.actions.act_window',
- 'target':'new',
- }
-
- def ups_upload(self, cr, uid, ids, context=None):
- return {
- 'name': False,
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'stock.ups.upload',
- 'type': 'ir.actions.act_window',
- 'target':'new',
- }
-
- _columns = {
- 'weight': fields.float('Lot weight', required=True),
- }
-
- _defaults = {
- 'weight': lambda *a: 3.0,
- }
-stock_ups()
-
-class stock_ups_final(osv.osv_memory):
- _name = "stock.ups.final"
- _description = "Stock ups final"
-
- def create_xmlfile(self, cr, uid, ids, context=None):
- """ Creates xml report file.
- @return: xml file
- """
- data={}
- report = netsvc._group['report']['report.stock.move.lot.ups_xml']
- data['report_type'] = 'raw'
- return {'xmlfile' : report.create(uid, context['active_id'], ids, {})}
-
- _columns = {
- 'xmlfile': fields.binary('XML File'),
- }
-
-stock_ups_final()
-
-class stock_ups_upload(osv.osv_memory):
- _name = "stock.ups.upload"
- _description = "Stock ups upload"
-
- def upload_xmlfile(self, cr, uid, ids, context=None):
- """ Uploads xml report file.
- @return:
- """
- data={}
- report = netsvc._group['report']['report.stock.move.lot.ups_xml']
- data['report_type'] = 'raw'
- fp = file('/tmp/test.xml', 'w').write(report.create(uid, context['active_id'], ids, {}))
- return {'type': 'ir.actions.act_window_close'}
-
-stock_ups_upload()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/stock/wizard/stock_ups_view.xml b/addons/stock/wizard/stock_ups_view.xml
deleted file mode 100644
index cbce721e1b9..00000000000
--- a/addons/stock/wizard/stock_ups_view.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
- Stock ups
- stock.ups
- form
-
-
-
-
-
-
- Stock ups
- stock.ups.final
- form
-
-
-
-
-
-
- Stock ups
- stock.ups.upload
- form
-
-
-
-
-
-
-
-