Mayur Maheshwari(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-stock-coverage-mma into
lp:openobject-addons.
Requested reviews:
Rucha (Open ERP) (rpa-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-stock-coverage-mma/+merge/76546
Hello
stock: yml improvement is done
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-stock-coverage-mma/+merge/76546
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-stock-coverage-mma.
=== modified file 'stock/__openerp__.py'
--- stock/__openerp__.py 2011-07-06 12:29:28 +0000
+++ stock/__openerp__.py 2011-09-22 10:19:00 +0000
@@ -80,6 +80,7 @@
],
'test': ['test/stock_test.yml',
'test/stock_report.yml',
+ 'test/stock_test_wizard.yml',
],
'installable': True,
'active': False,
=== removed file 'stock/report/UPS.xml'
--- stock/report/UPS.xml 2011-01-14 00:11:01 +0000
+++ stock/report/UPS.xml 1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<OpenShipments>
-
- <OpenShipment ShipmentOption="" ProcessStatus="">
-
- <Receiver>
- <CompanyName type="field" name="address_id.partner_id.name" />
- <ContactPerson type="field" name="address_id.name" />
- <AddressLine1 type="field" name="address_id.street" />
- <AddressLine2 type="field" name="address_id.street2" />
- <City type="field" name="address_id.city" />
- <CountryCode type="field" name="address_id.country_id.code" />
- <PostalCode type="field" name="address_id.zip" />
- <StateOrProvince type="field" name="address_id.state_id.name" />
- <Phone type="field" name="address_id.phone" />
- </Receiver>
- <Shipment>
- <ServiceLevel>ES</ServiceLevel>
- <PackageType/>
- <NumberOfPackages>1</NumberOfPackages>
- <ShipmentActualWeight type="data" name="weight"/>
- <DescriptionOfGoods type="field" name="name" />
- <BillingOption>PP</BillingOption>
- </Shipment>
-
- </OpenShipment>
-
-</OpenShipments>
=== modified file 'stock/report/__init__.py'
--- stock/report/__init__.py 2011-01-14 00:11:01 +0000
+++ stock/report/__init__.py 2011-09-22 10:19:00 +0000
@@ -20,7 +20,6 @@
##############################################################################
import product_stock
-import ups
import picking
import lot_overview_all
import report_stock
=== removed file 'stock/report/ups.py'
--- stock/report/ups.py 2011-01-14 00:11:01 +0000
+++ stock/report/ups.py 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# 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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-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:
-
=== modified file 'stock/stock.py'
--- stock/stock.py 2011-09-19 11:28:37 +0000
+++ stock/stock.py 2011-09-22 10:19:00 +0000
@@ -2239,6 +2239,7 @@
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 @@
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
=== modified file 'stock/test/stock_test.yml'
--- stock/test/stock_test.yml 2011-09-16 14:17:54 +0000
+++ stock/test/stock_test.yml 2011-09-22 10:19:00 +0000
@@ -160,8 +160,9 @@
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: stock.product_category_computer0
- cost_method: standard
- list_price: 1000.0
+ cost_method: average
+ list_price: 1500.0
+ standard_price: 1500.0
mes_type: fixed
name: HP CD writers
procure_method: make_to_stock
@@ -175,6 +176,108 @@
uom_po_id: product.product_uom_unit
property_account_expense: account_account_productpurchase0
property_account_income: account_account_productsale0
+ valuation: real_time
+ property_stock_account_input: account_account_productpurchase0
+ property_stock_account_output: account_account_productsale0
+
+-
+ I create Stock Production Lot for product HP CD writers.
+-
+ !record {model: stock.production.lot, id: stock_production_lot0}:
+ product_id: stock.product_product_hpcdwriters0
+ date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
+ name: 0000001
+
+-
+ I trace the Stock Production Lot for product HP CD writers.
+-
+ !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 change product quantity for product HP CD writers.
+-
+ !record {model: stock.change.product.qty, id: stock_change_product_qty0}:
+ product_id: stock.product_product_hpcdwriters0
+ new_quantity: 100
+ location_id: stock.stock_location_stock
+ prodlot_id: stock.stock_production_lot0
+
+-
+ I apply the new quantity on product HP CD writers.
+-
+ !python {model: stock.change.product.qty }: |
+ context = {"lang": 'en_US', "active_model":
+ "product.product", "active_ids": [ref("stock.product_product_hpcdwriters0")], "tz": False, "active_id":ref('stock.product_product_hpcdwriters0')}
+ 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("stock.product_product_hpcdwriters0"), "tz": False, "active_id":ref('stock.product_product_hpcdwriters0')})
+
+-
+ I check quantity on product HP CD writers is update or not.
+-
+ !python {model: product.product }: |
+ pro_obj = self.browse(cr, uid, ref("product_product_hpcdwriters0"))
+ assert (pro_obj.qty_available == 100) , "quantity is not updated"
+
+-
+ I Read quantity on product HP CD writers.
+-
+ !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("stock.product_product_hpcdwriters0")], 'product_id':ref("stock.product_product_hpcdwriters0"), 'active_id': ref("stock.product_product_hpcdwriters0")})
+
+-
+ 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 Product By location chart for stock.location.product Object.
+-
+ !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 open product chart.
+-
+ !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 open product form from stock.location object .
+-
+ !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 change product standard price for product HP CD writers.
+-
+ !record {model: stock.change.standard.price, id: stock_change_standard_price0}:
+ new_price: 1515
+ stock_account_input: account_account_receivable0
+ stock_account_output: account_account_payable0
+ stock_journal: account_journal_purchasejournal0
+ enable_stock_in_out_acc: True
+
+-
+ I apply the new product standard price on product HP CD writers.
+-
+ !python {model: stock.change.standard.price }: |
+ context = {"lang": 'en_US', "active_model":
+ "product.product", "active_ids": [ref("stock.product_product_hpcdwriters0")], "tz": False, "active_id":ref('stock.product_product_hpcdwriters0')}
+ 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 +285,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_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')])
+ 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 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: stock.product_product_hpcdwriters0
+ product_qty: 20.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: 20.0
+ product_uom: product.product_uom_unit
+ name: Physical inventory
+ state: draft
+
+-
+ I merge inventory .
+-
+ !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: stock.product_product_hppaviliondesktoppcs0
+ 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('stock.product_product_hpcdwriters0'), 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.
-
!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'
- 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]
- })
--
-
+ - name: '00002-stock-test'
+ quantity: 5
+ line_exist_ids:
+ - name: '00003-stock-test'
+ quantity: 5
+ product_id: stock.product_product_hppaviliondesktoppcs0
+ product_uom: product.product_uom_unit
+ use_exist: False
+ qty: 10
+
+-
+ 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 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 cancel the Inventory for HP CD writers.
+-
+ !python {model: stock.inventory}: |
+ self.action_cancel_inventary(cr,uid,[ref('stock_inventory_physicalinventoy0')])
+
+-
+ I change inventory state to draft for HP CD writers.
+-
+ !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 +414,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
+ product_id: stock.product_product_hpcdwriters0
+ 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 +454,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.
--
- !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)]= {
+ 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 }: |
+ 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,
+ }
+ 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,
- 'product_uom': move.product_uom.id,
+ }
+ 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.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)
+ self.pool.get('stock.return.picking').create_returns(cr, uid, [return_pick_id], context)
=== added file 'stock/test/stock_test_wizard.yml'
--- stock/test/stock_test_wizard.yml 1970-01-01 00:00:00 +0000
+++ stock/test/stock_test_wizard.yml 2011-09-22 10:19:00 +0000
@@ -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)
+
+
=== modified file 'stock/wizard/__init__.py'
--- stock/wizard/__init__.py 2011-01-14 00:11:01 +0000
+++ stock/wizard/__init__.py 2011-09-22 10:19:00 +0000
@@ -24,8 +24,6 @@
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
=== modified file 'stock/wizard/stock_change_standard_price.py'
--- stock/wizard/stock_change_standard_price.py 2011-01-14 00:11:01 +0000
+++ stock/wizard/stock_change_standard_price.py 2011-09-22 10:19:00 +0000
@@ -69,6 +69,7 @@
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.
=== modified file 'stock/wizard/stock_invoice_onshipping.py'
--- stock/wizard/stock_invoice_onshipping.py 2011-09-08 08:38:24 +0000
+++ stock/wizard/stock_invoice_onshipping.py 2011-09-22 10:19:00 +0000
@@ -135,6 +135,8 @@
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'],
=== modified file 'stock/wizard/stock_move.py'
--- stock/wizard/stock_move.py 2011-09-19 10:35:23 +0000
+++ stock/wizard/stock_move.py 2011-09-22 10:19:00 +0000
@@ -23,35 +23,6 @@
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"
=== modified file 'stock/wizard/stock_move_view.xml'
--- stock/wizard/stock_move_view.xml 2011-09-19 10:35:23 +0000
+++ stock/wizard/stock_move_view.xml 2011-09-22 10:19:00 +0000
@@ -1,35 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
-
- <record id="view_stock_move_track_wizard" model="ir.ui.view">
- <field name="name">Tracking a move</field>
- <field name="model">stock.move.track</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Tracking a move">
- <field name="tracking_prefix" colspan="4"/>
- <field name="quantity" colspan="4"/>
- <newline/>
- <separator string="" colspan="4" />
- <button icon='gtk-cancel' special="cancel"
- string="_Cancel" />
- <button name="track_lines" string="Ok"
- type="object" icon="gtk-ok" />
- </form>
- </field>
- </record>
-
- <record id="track_line_old" model="ir.actions.act_window">
- <field name="name">Tracking a move</field>
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">stock.move.track</field>
- <field name="view_type">form</field>
- <field name="view_mode">form</field>
- <field name="target">new</field>
- </record>
-
-
<!-- Consume, scrap move -->
<record id="view_stock_move_consume_wizard" model="ir.ui.view">
=== removed file 'stock/wizard/stock_replacement.py'
--- stock/wizard/stock_replacement.py 2011-01-14 00:11:01 +0000
+++ stock/wizard/stock_replacement.py 1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# 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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-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:
-
=== removed file 'stock/wizard/stock_replacement_view.xml'
--- stock/wizard/stock_replacement_view.xml 2011-01-14 00:11:01 +0000
+++ stock/wizard/stock_replacement_view.xml 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
- <data>
- <record id="view_stock_replacement" model="ir.ui.view">
- <field name="name">Stock Replacement</field>
- <field name="model">stock.replacement</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Replace a component">
- <label string="Component" colspan="4"/>
- <separator string="" colspan="4" />
- <button icon='gtk-cancel' special="cancel" string="_Cancel" />
- <button name="replace_composant" string="Replace" type="object" />
- </form>
- </field>
- </record>
-
- <act_window name="Stock Replacement"
- res_model="stock.replacement"
- src_model=""
- view_mode="form"
- target="new"
- key2="client_action_multi"
- id="action_view_stock_replacement"/>
-
-
- <record id="view_stock_replacement_result" model="ir.ui.view">
- <field name="name">Stock Replacement result</field>
- <field name="model">stock.replacement.result</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Replace result">
- <label string="Replacing successful !" colspan="4"/>
- <separator string="" colspan="4" />
- <button special="cancel" string="Ok" />
- </form>
- </field>
- </record>
-
- </data>
-</openerp>
=== removed file 'stock/wizard/stock_ups.py'
--- stock/wizard/stock_ups.py 2011-01-14 00:11:01 +0000
+++ stock/wizard/stock_ups.py 1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# 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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-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:
-
=== removed file 'stock/wizard/stock_ups_view.xml'
--- stock/wizard/stock_ups_view.xml 2011-01-14 00:11:01 +0000
+++ stock/wizard/stock_ups_view.xml 1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
- <data>
-
- <record id="view_stock_ups" model="ir.ui.view">
- <field name="name">Stock ups</field>
- <field name="model">stock.ups</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="UPS XML generator">
- <separator string="UPS generator" colspan="4"/>
- <field name="weight" />
- <separator string="" colspan="4" />
- <button icon='gtk-cancel' special="cancel" string="_Cancel" />
- <button name="ups_save" string="Get xml file" type="object" />
- <button name="ups_upload" string="Upload xml file" type="object" />
- </form>
- </field>
- </record>
-
- <record id="view_stock_ups_final" model="ir.ui.view">
- <field name="name">Stock ups</field>
- <field name="model">stock.ups.final</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="UPS XML generator">
- <separator string="Save the attached file" colspan="4" />
- <field name="xmlfile" />
- <button special="cancel" string="End" />
- <button name="create_xmlfile" string="create xml file" type="object" />
- </form>
- </field>
- </record>
-
- <record id="view_stock_ups_upload" model="ir.ui.view">
- <field name="name">Stock ups</field>
- <field name="model">stock.ups.upload</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="UPS XML generator">
- <separator string="File uploaded" colspan="4" />
- <button special="cancel" string="End" />
- <button name="upload_xmlfile" string="Upload xml file" type="object" />
- </form>
- </field>
- </record>
-
- <act_window name="Stock ups"
- res_model="stock.ups"
- src_model=""
- view_mode="form"
- target="new"
- key2="client_action_multi"
- id="action_view_stock_ups"/>
-</data>
-</openerp>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp