summaryrefslogtreecommitdiff
path: root/addons/stock
diff options
context:
space:
mode:
authoratp (Open ERP) <atp@tinyerp.co.in>2010-06-22 10:45:44 +0530
committeratp (Open ERP) <atp@tinyerp.co.in>2010-06-22 10:45:44 +0530
commitb0efd26edd9f4e2aa75424b787ea46d2be15cd04 (patch)
treee78cdb693e62a5c9a17f77a395eec51fb34becbf /addons/stock
parent46bb1ea51be702758d68a5f69db32c82dbccf9bd (diff)
parent2319190c5a20cb8095f85cacca89a33164ba93d7 (diff)
[MERGE]: merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2
bzr revid: atp@tinyerp.co.in-20100622051544-c7hig73zk2at66cy
Diffstat (limited to 'addons/stock')
-rw-r--r--addons/stock/__openerp__.py8
-rw-r--r--addons/stock/board_warehouse_view.xml50
-rw-r--r--addons/stock/i18n/es.po125
-rw-r--r--addons/stock/i18n/nl.po2
-rw-r--r--addons/stock/i18n/pl.po2
-rw-r--r--addons/stock/product.py18
-rw-r--r--addons/stock/report/__init__.py1
-rw-r--r--addons/stock/report/packing.rml317
-rw-r--r--addons/stock/report/picking.py1
-rw-r--r--addons/stock/report/product_stock.py16
-rw-r--r--addons/stock/report/report_stock_move_view.xml6
-rw-r--r--addons/stock/report/report_stock_picking_view.xml5
-rw-r--r--addons/stock/security/ir.model.access.csv13
-rw-r--r--addons/stock/stock.py166
-rw-r--r--addons/stock/stock_report.xml1
-rw-r--r--addons/stock/stock_view.xml315
-rw-r--r--addons/stock/wizard/__init__.py1
-rw-r--r--addons/stock/wizard/stock_move.py9
-rw-r--r--addons/stock/wizard/stock_move_view.xml24
-rw-r--r--addons/stock/wizard/stock_partial_picking.py32
-rw-r--r--addons/stock/wizard/stock_splitinto.py84
-rw-r--r--addons/stock/wizard/stock_splitinto_view.xml31
22 files changed, 950 insertions, 277 deletions
diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py
index 32adb5e84d2..157e126be4a 100644
--- a/addons/stock/__openerp__.py
+++ b/addons/stock/__openerp__.py
@@ -34,6 +34,11 @@ Thanks to the double entry management, the inventory controlling is powerful and
* Bar code supported
* Rapid detection of mistakes through double entry system
* Traceability (upstream/downstream, production lots, serial number, ...)
+* Dashboard for warehouse that includes:
+ * Products to receive in delay (date < = today)
+ * Procurement in exception
+ * Graph : Number of Receive products vs planned (bar graph on week par day)
+ * Graph : Number of Delivery products vs planned (bar graph on week par day)
""",
"website" : "http://www.openerp.com",
"depends" : ["product", "account"],
@@ -50,6 +55,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
"wizard/stock_invoice_onshipping_view.xml",
"wizard/stock_inventory_merge_view.xml",
"wizard/stock_location_product_view.xml",
+ "wizard/stock_splitinto_view.xml",
"wizard/stock_inventory_line_split_view.xml",
"wizard/stock_change_standard_price_view.xml",
"wizard/stock_traceability_view.xml",
@@ -63,9 +69,11 @@ Thanks to the double entry management, the inventory controlling is powerful and
"product_view.xml",
"partner_view.xml",
"report/report_stock_move_view.xml",
+ "report/report_stock_picking_view.xml",
"report/report_stock_view.xml",
"security/stock_security.xml",
"security/ir.model.access.csv",
+ "board_warehouse_view.xml"
],
'test': ['test/stock_test.yml'],
'installable': True,
diff --git a/addons/stock/board_warehouse_view.xml b/addons/stock/board_warehouse_view.xml
new file mode 100644
index 00000000000..0c13e83cd84
--- /dev/null
+++ b/addons/stock/board_warehouse_view.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="note_warehouse_type" model="board.note.type">
+ <field name="name">Warehouse</field>
+ </record>
+
+ <record id="action_reception_picking_move_board" model="ir.actions.act_window">
+ <field name="name">Reception Picking Stock Move</field>
+ <field name="res_model">stock.move</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="domain">[('picking_id','!=',False),('picking_id.type','=','in'),('date','&lt;=',time.strftime('%Y-%m-%d 23:59:59'))]</field>
+ <field name="view_id" ref="stock.view_move_tree_reception_picking"/>
+ </record>
+
+ <record id="board_warehouse_form" model="ir.ui.view">
+ <field name="name">board.warehouse.form</field>
+ <field name="model">board.board</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Warehouse board">
+ <hpaned position="100">
+ <child1>
+ <action colspan="4" name="%(action_reception_picking_move_board)d" string="Products To Receive" />
+ </child1>
+
+ <child2>
+ <action colspan="4" name="%(stock.action_move_graph_reception_picking)d" string="Number of Products to receive Vs planned" width="510"/>
+ <action colspan="4" name="%(stock.action_move_delivery_products_planned)d" string="Delivery Products Vs Planned" width="510"/>
+ </child2>
+ </hpaned>
+ </form>
+ </field>
+ </record>
+
+ <record id="open_board_warehouse" model="ir.actions.act_window">
+ <field name="name">Warehouse Dashboard</field>
+ <field name="res_model">board.board</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="view_id" ref="board_warehouse_form"/>
+ </record>
+
+ <menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
+ <menuitem id="menu_board_warehouse_main" name="Warehouse" parent="base.dashboard"/>
+ <menuitem action="open_board_warehouse" icon="terp-graph" id="menu_board_warehouse" parent="menu_board_warehouse_main" sequence="1"/>
+ </data>
+</openerp> \ No newline at end of file
diff --git a/addons/stock/i18n/es.po b/addons/stock/i18n/es.po
index 563a23a48e9..a7e23b3e396 100644
--- a/addons/stock/i18n/es.po
+++ b/addons/stock/i18n/es.po
@@ -7,14 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-05-18 13:11+0000\n"
-"Last-Translator: Jordi Esteve (www.zikzakmedia.com) "
-"<jesteve@zikzakmedia.com>\n"
+"PO-Revision-Date: 2010-06-17 23:43+0000\n"
+"Last-Translator: mikel <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-05-19 05:11+0000\n"
+"X-Launchpad-Export-Date: 2010-06-18 03:32+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: stock
@@ -30,12 +29,12 @@ msgstr "Ubicación encadenada si fija"
#. module: stock
#: selection:stock.location,icon:0
msgid "STOCK_SAVE"
-msgstr "Guardar existencia"
+msgstr "STOCK_SAVE"
#. module: stock
#: model:stock.location,name:stock.stock_location_15
msgid "Sub Products"
-msgstr "Sub Producto"
+msgstr "Sub productos"
#. module: stock
#: selection:stock.location,icon:0
@@ -45,7 +44,7 @@ msgstr "terp-account"
#. module: stock
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
-msgstr "Nombre de modelo no válido en la definición de acción."
+msgstr "Nombre de modelo no válido en la definición de la acción."
#. module: stock
#: model:ir.module.module,shortdesc:stock.module_meta_information
@@ -104,7 +103,7 @@ msgstr "Rellenar inventario para una determinada ubicación"
#: view:stock.picking:0
#: field:stock.picking.move.wizard,picking_id:0
msgid "Packing list"
-msgstr "Lista Picking"
+msgstr "Albarán"
#. module: stock
#: rml:lot.stock.overview:0
@@ -142,7 +141,7 @@ msgstr "Empresa"
#. module: stock
#: help:product.product,track_incoming:0
msgid "Force to use a Production Lot during receptions"
-msgstr "Forzar a usar un lote de producción durante la recepción"
+msgstr "Fuerza a usar un lote de producción durante la recepción"
#. module: stock
#: field:stock.move,move_history_ids:0
@@ -160,12 +159,12 @@ msgstr "Lote de producción"
#. module: stock
#: selection:stock.location,icon:0
msgid "STOCK_NEW"
-msgstr "Nueva existencia"
+msgstr "STOCK_NEW"
#. module: stock
#: selection:stock.location,icon:0
msgid "STOCK_CANCEL"
-msgstr "Cancelar existencia"
+msgstr "STOCK_CANCEL"
#. module: stock
#: selection:stock.location,usage:0
@@ -190,7 +189,7 @@ msgstr "Valor stock real"
#. module: stock
#: view:stock.move:0
msgid "UOM"
-msgstr "UOM"
+msgstr "UdM"
#. module: stock
#: selection:stock.move,state:0
@@ -207,17 +206,17 @@ msgstr "Hacer envíos parciales"
#. module: stock
#: wizard_view:stock.partial_picking,end2:0
msgid "Packing result"
-msgstr "Resultado empaquetado"
+msgstr "Resultado albarán"
#. module: stock
#: selection:stock.location,icon:0
msgid "STOCK_QUIT"
-msgstr "Quitar existencias"
+msgstr "STOCK_QUIT"
#. module: stock
#: field:stock.warehouse,lot_output_id:0
msgid "Location Output"
-msgstr "Localizacion de salidas"
+msgstr "Ubicación de salida"
#. module: stock
#: selection:stock.location,icon:0
@@ -278,7 +277,7 @@ msgstr "Empaquetado"
#. module: stock
#: rml:stock.picking.list:0
msgid "Order(Origin)"
-msgstr "Orden (origen)"
+msgstr "Pedido (origen)"
#. module: stock
#: rml:lot.location:0
@@ -291,12 +290,12 @@ msgstr "Gran Total"
#: view:stock.location:0
#: field:stock.location,comment:0
msgid "Additional Information"
-msgstr "Información Adicional"
+msgstr "Información adicional"
#. module: stock
#: selection:stock.invoice_onshipping,init,type:0
msgid "Customer Refund"
-msgstr "Reembolso del cliente"
+msgstr "Factura rectificativa (abono) de cliente"
#. module: stock
#: selection:stock.location,icon:0
@@ -350,12 +349,12 @@ msgstr "Clientes"
#. module: stock
#: selection:stock.location,icon:0
msgid "STOCK_UNDERLINE"
-msgstr "Existencia bajo lineas"
+msgstr "STOCK_UNDERLINE"
#. module: stock
#: view:stock.picking.move.wizard:0
msgid "Move Lines"
-msgstr "Líneas de movimiento"
+msgstr "Líneas movimiento"
#. module: stock
#: wizard_field:stock.fill_inventory,init,recursive:0
@@ -401,7 +400,7 @@ msgstr "terp-graph"
#. module: stock
#: selection:stock.location,icon:0
msgid "STOCK_PREFERENCES"
-msgstr "Existencias prioritarias"
+msgstr "STOCK_PREFERENCES"
#. module: stock
#: rml:lot.location:0
@@ -420,7 +419,7 @@ msgstr "Procesar ahora"
#. module: stock
#: field:stock.location,address_id:0
msgid "Location Address"
-msgstr "Dirección de la ubicación"
+msgstr "Dirección ubicación"
#. module: stock
#: help:stock.move,prodlot_id:0
@@ -451,7 +450,7 @@ msgstr "Propiedades de stock"
#. module: stock
#: wizard_button:stock.partial_picking,init,split:0
msgid "Make Picking"
-msgstr "Empaquetar"
+msgstr "Realizar albarán"
#. module: stock
#: model:stock.location,name:stock.location_procurement
@@ -477,7 +476,7 @@ msgstr "Id producto"
#. module: stock
#: view:res.partner:0
msgid "Sales & Purchases"
-msgstr "Ventas & Compras"
+msgstr "Ventas y Compras"
#. module: stock
#: selection:stock.invoice_onshipping,init,type:0
@@ -558,12 +557,12 @@ msgstr "Reporte de inventario por lotes de producción"
#. module: stock
#: field:stock.location,stock_virtual:0
msgid "Virtual Stock"
-msgstr "Existencia virtual"
+msgstr "Stock virtual"
#. module: stock
#: selection:stock.location,usage:0
msgid "View"
-msgstr "Ver"
+msgstr "Vista"
#. module: stock
#: selection:stock.location,icon:0
@@ -594,7 +593,7 @@ msgstr "STOCK_GOTO_BOTTOM"
#: model:ir.actions.act_window,name:stock.action_picking_form
#: model:ir.ui.menu,name:stock.menu_action_picking_form
msgid "New Reception Packing"
-msgstr "Nueva recepcion de paquete"
+msgstr "Nuevo albarán de entrada"
#. module: stock
#: wizard_field:stock.move.track,init,quantity:0
@@ -607,7 +606,7 @@ msgstr "Cantidad por lote"
#: view:stock.move:0
#: view:stock.picking:0
msgid "Stock Moves"
-msgstr "Movimientos de existencias"
+msgstr "Movimientos de stock"
#. module: stock
#: field:product.template,property_stock_production:0
@@ -647,7 +646,7 @@ msgstr "STOCK_DIALOG_QUESTION"
#. module: stock
#: selection:stock.location,chained_auto_packing:0
msgid "Manual Operation"
-msgstr "Manual de operación"
+msgstr "Operación manual"
#. module: stock
#: field:stock.picking,date_done:0
@@ -750,7 +749,7 @@ msgstr "Revisiones de lote de producción"
#. module: stock
#: view:stock.picking:0
msgid "Packing Done"
-msgstr "Paquete realizado"
+msgstr "Albarán realizado"
#. module: stock
#: selection:stock.move,state:0
@@ -764,7 +763,7 @@ msgstr "En espera"
#: model:ir.ui.menu,name:stock.menu_action_picking_tree7
#: model:ir.ui.menu,name:stock.menu_picking_waiting
msgid "Available Packing"
-msgstr "Empaquetado disponible"
+msgstr "Albarán disponible"
#. module: stock
#: model:ir.model,name:stock.model_stock_warehouse
@@ -817,7 +816,7 @@ msgstr "STOCK_CONNECT"
#: model:ir.ui.menu,name:stock.menu_action_picking_all
#: wizard_field:stock.picking.make,init,pickings:0
msgid "Packing"
-msgstr "Empaquetado/Albarán"
+msgstr "Albarán"
#. module: stock
#: selection:stock.location,icon:0
@@ -923,7 +922,7 @@ msgstr "Fecha creación"
#. module: stock
#: selection:stock.picking,type:0
msgid "Sending Goods"
-msgstr "Enviar mercancías"
+msgstr "Envío mercancías"
#. module: stock
#: view:stock.picking:0
@@ -990,7 +989,7 @@ msgstr "STOCK_APPLY"
#. module: stock
#: wizard_view:stock.partial_picking,end2:0
msgid "The packing has been successfully made !"
-msgstr "¡El paquete ha sido realizado correctamente!"
+msgstr "¡El albarán ha sido realizado correctamente!"
#. module: stock
#: field:stock.move,address_id:0
@@ -1133,7 +1132,7 @@ msgstr "STOCK_HARDDISK"
#. module: stock
#: model:ir.actions.act_window,name:stock.act_relate_picking
msgid "Related Picking"
-msgstr "Paquete relacionado"
+msgstr "Albarán relacionado"
#. module: stock
#: field:stock.incoterms,name:0
@@ -1177,7 +1176,7 @@ msgstr "STOCK_COPY"
#. module: stock
#: selection:stock.invoice_onshipping,init,type:0
msgid "Supplier Refund"
-msgstr "Factura de abono de proveedor"
+msgstr "Factura rectificativa (abono) de proveedor"
#. module: stock
#: model:ir.model,name:stock.model_stock_move
@@ -1193,7 +1192,7 @@ msgstr "Cuenta salida stock"
#. module: stock
#: selection:stock.location,chained_auto_packing:0
msgid "Automatic No Step Added"
-msgstr "Automático paso no añadido"
+msgstr "Mov. automático, paso no añadido"
#. module: stock
#: wizard_view:stock.location.products,init:0
@@ -1302,7 +1301,7 @@ msgstr "Método entrega"
#. module: stock
#: model:ir.actions.wizard,name:stock.partial_picking
msgid "Partial packing"
-msgstr "Empaquetado parcial"
+msgstr "Albarán parcial"
#. module: stock
#: selection:stock.location,icon:0
@@ -1589,7 +1588,7 @@ msgstr "Cantidad (UdV)"
#: model:ir.actions.act_window,name:stock.action_picking_tree5
#: model:ir.ui.menu,name:stock.menu_action_picking_tree5
msgid "Packing to Process"
-msgstr "Paquetes a procesar"
+msgstr "Albaranes a procesar"
#. module: stock
#: selection:stock.location,icon:0
@@ -1599,7 +1598,7 @@ msgstr "STOCK_MEDIA_STOP"
#. module: stock
#: view:stock.move:0
msgid "Set Available"
-msgstr "Fijar disponible"
+msgstr "Cambiar a disponible"
#. module: stock
#: model:ir.actions.wizard,name:stock.make_picking
@@ -1803,13 +1802,13 @@ msgstr "Altura (Z)"
#: field:stock.inventory.line,product_uom:0
#: field:stock.move,product_uom:0
msgid "Product UOM"
-msgstr "UdM del producto"
+msgstr "UdM producto"
#. module: stock
#: rml:lot.stock.overview:0
#: rml:lot.stock.overview_all:0
msgid "Variants"
-msgstr "Variante"
+msgstr "Variantes"
#. module: stock
#: field:stock.location,posx:0
@@ -1936,8 +1935,9 @@ msgstr ""
"Se utiliza sólo si selecciona un tipo de ubicación encadenada.\n"
"La opción 'Movimiento automático' creará un movimiento de stock después del "
"actual que se validará automáticamente. Con 'Operación manual', el "
-"movimiento de stock debe ser validado por un trabajador. Con 'Automático "
-"paso no añadido', la ubicación se reemplaza en el movimiento original."
+"movimiento de stock debe ser validado por un trabajador. Con 'Mov. "
+"automático, paso no añadido', la ubicación se reemplaza en el movimiento "
+"original."
#. module: stock
#: field:stock.location,icon:0
@@ -2190,7 +2190,7 @@ msgstr "STOCK_JUSTIFY_CENTER"
#: model:ir.ui.menu,name:stock.menu_action_picking_tree3
#: model:ir.ui.menu,name:stock.menu_action_picking_tree8
msgid "Confirmed Packing Waiting Availability"
-msgstr "Paquete confirmado esperando disponibilidad"
+msgstr "Albarán confirmado esperando disponibilidad"
#. module: stock
#: field:stock.location,posy:0
@@ -2309,7 +2309,7 @@ msgstr "Cerrar"
#. module: stock
#: model:ir.actions.report.xml,name:stock.report_move_labels
msgid "Print Item Labels"
-msgstr "Imprimir etiquetas de elementos"
+msgstr "Imprimir etiquetas"
#. module: stock
#: view:stock.move:0
@@ -2428,36 +2428,3 @@ msgstr "Estado de movimientos"
#: model:stock.location,name:stock.stock_location_locations
msgid "Physical Locations"
msgstr "Ubicaciones físicas"
-
-#~ msgid ""
-#~ "OpenERP Stock Management module can manage multi-warehouses, multi and "
-#~ "structured stock locations.\n"
-#~ "Thanks to the double entry management, the inventory controlling is powerful "
-#~ "and flexible:\n"
-#~ "* Moves history and planning,\n"
-#~ "* Different inventory methods (FIFO, LIFO, ...)\n"
-#~ "* Stock valuation (standard or average price, ...)\n"
-#~ "* Robustness faced with Inventory differences\n"
-#~ "* Automatic reordering rules (stock level, JIT, ...)\n"
-#~ "* Bar code supported\n"
-#~ "* Rapid detection of mistakes through double entry system\n"
-#~ "* Traceability (upstream/downstream, production lots, serial number, ...)\n"
-#~ " "
-#~ msgstr ""
-#~ "El módulo de gestión de stocks de OpenERP puede gestionar multi-almacenes y "
-#~ "multi-ubicaciones jerárquicas de stock.\n"
-#~ "Gracias a la gestión de partida doble, el control de inventario es potente y "
-#~ "flexible:\n"
-#~ "* Historial de movimientos y planificación,\n"
-#~ "* Métodos de inventario diferentes (FIFO, LIFO ...)\n"
-#~ "* Valoración de existencias (estándar o precio medio ...)\n"
-#~ "* Robustez frente a las diferencias de inventario\n"
-#~ "* Reglas automáticas de abastecimiento (nivel de stock mínimo, JIT ...)\n"
-#~ "* Soporte a código de barras\n"
-#~ "* Detección rápida de errores a través de sistema de partida doble\n"
-#~ "* Trazabilidad (hacia arriba/abajo, lotes de producción, número de serie "
-#~ "...)\n"
-#~ " "
-
-#~ msgid "Stock Management"
-#~ msgstr "Gestión de inventario"
diff --git a/addons/stock/i18n/nl.po b/addons/stock/i18n/nl.po
index 445249906e7..b23167068e2 100644
--- a/addons/stock/i18n/nl.po
+++ b/addons/stock/i18n/nl.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-06-15 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-06-18 03:32+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: stock
diff --git a/addons/stock/i18n/pl.po b/addons/stock/i18n/pl.po
index c1d33bc694d..bf7f8757a7b 100644
--- a/addons/stock/i18n/pl.po
+++ b/addons/stock/i18n/pl.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-06-15 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-06-18 03:32+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: stock
diff --git a/addons/stock/product.py b/addons/stock/product.py
index 9a19d3e84c3..df34b9b86a1 100644
--- a/addons/stock/product.py
+++ b/addons/stock/product.py
@@ -242,11 +242,11 @@ class product_product(osv.osv):
cr.execute(
'select sum(product_qty), product_id, product_uom '\
'from stock_move '\
- 'where location_id <> ANY(%s)'\
- 'and location_dest_id =ANY(%s)'\
- 'and product_id =ANY(%s)'\
- 'and state in %s' + (date_str and 'and '+date_str+' ' or '') +''\
- 'group by product_id,product_uom',(location_ids,location_ids,ids,tuple(states),)
+ 'where location_id NOT IN %s'\
+ 'and location_dest_id IN %s'\
+ 'and product_id IN %s'\
+ 'and state IN %s' + (date_str and 'and '+date_str+' ' or '') +''\
+ 'group by product_id,product_uom',(tuple(location_ids),tuple(location_ids),tuple(ids),tuple(states),)
)
results = cr.fetchall()
if 'out' in what:
@@ -254,11 +254,11 @@ class product_product(osv.osv):
cr.execute(
'select sum(product_qty), product_id, product_uom '\
'from stock_move '\
- 'where location_id = ANY(%s)'\
- 'and location_dest_id <> ANY(%s) '\
- 'and product_id =ANY(%s)'\
+ 'where location_id IN %s'\
+ 'and location_dest_id NOT IN %s '\
+ 'and product_id IN %s'\
'and state in %s' + (date_str and 'and '+date_str+' ' or '') + ''\
- 'group by product_id,product_uom',(location_ids,location_ids,ids,tuple(states),)
+ 'group by product_id,product_uom',(tuple(location_ids),tuple(location_ids),tuple(ids),tuple(states),)
)
results2 = cr.fetchall()
uom_obj = self.pool.get('product.uom')
diff --git a/addons/stock/report/__init__.py b/addons/stock/report/__init__.py
index 381644fcd32..ab4b2e16599 100644
--- a/addons/stock/report/__init__.py
+++ b/addons/stock/report/__init__.py
@@ -26,5 +26,6 @@ import picking
import lot_overview
import lot_overview_all
import report_stock
+import report_stock_picking
import report_stock_move
diff --git a/addons/stock/report/packing.rml b/addons/stock/report/packing.rml
new file mode 100644
index 00000000000..c2cceb26238
--- /dev/null
+++ b/addons/stock/report/packing.rml
@@ -0,0 +1,317 @@
+<?xml version="1.0"?>
+<document filename="test.pdf">
+ <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
+ <pageTemplate id="first">
+ <frame id="first" x1="0.0" y1="57.0" width="538" height="728"/>
+ </pageTemplate>
+ </template>
+ <stylesheet>
+ <blockTableStyle id="Standard_Outline">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Address_detail">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Title_String">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Header_Order_Reference_Tbl">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Content_Order_Reference_Table">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Move_Line_Header">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Move_Line_Contect_Assign_State">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Move_Line_Content_Other_State">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
+ </blockTableStyle>
+ <initialize>
+ <paraStyle name="all" alignment="justify"/>
+ </initialize>
+ <paraStyle name="Standard" fontName="Times-Roman"/>
+ <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Caption" fontName="Times-Italic" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Index" fontName="Times-Roman"/>
+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Table Contents" fontName="Times-Roman"/>
+ <paraStyle name="Footer" fontName="Times-Roman"/>
+ <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
+ <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
+ <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_5cm_Above_Space" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_1cm_above_space" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="3.0" spaceAfter="0.0"/>
+ </stylesheet>
+ <images/>
+ <story>
+ <para style="terp_default_8">[[ repeatIn(objects,'picking') ]] </para>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="269.0,269.0" style="Table_Address_detail">
+ <tr>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ (picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.title) or '' ]] [[ picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.name ]]</para>
+ <para style="terp_default_9">[[ picking.address_id and picking.address_id.street or '' ]]</para>
+ <para style="terp_default_9">[[ picking.address_id and picking.address_id.zip or '' ]] [[ picking.address_id and picking.address_id.city or '']]</para>
+
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">[[ picking.sale_id and picking.sale_id.partner_shipping_id and 'Shipping Address :' or removeParentNode('para') ]] </para>
+ <para style="terp_default_9">[[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.title) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.name) or '' ]] </para>
+ <para style="terp_default_9">[[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.street) or '' ]] </para>
+ <para style="terp_default_9">[[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.zip) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.city) or '' ]] [[ (picking.address_id and picking.address_id.state_id and picking.address_id.state_id.name) or '' ]] </para>
+ <para style="terp_default_9">[[ (picking.address_id and picking.address_id.country_id and picking.address_id.country_id.name) or '' ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_5cm_Above_Space">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_5cm_Above_Space">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_5cm_Above_Space">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="538.0" style="Table_Title_String">
+ <tr>
+ <td>
+ <para style="terp_header">Packing List: [[ picking.name ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_5cm_Above_Space">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_5cm_Above_Space">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="123.0,134.0,133.0,134.0" style="Header_Order_Reference_Tbl">
+ <tr>
+ <td>
+ <para style="terp_tblheader_General_Centre">Order(Origin)</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_General_Centre">Recipient</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_General_Centre">Expected Shipping Date </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_General_Centre"> Weight</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="123.0,134.0,133.0,134.0" style="Content_Order_Reference_Table">
+ <tr>
+ <td>
+ <para style="terp_default_Centre_8">[[ picking.origin ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Centre_8">[[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.title) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.name) or '' ]] </para>
+ </td>
+ <td>
+ <para style="terp_default_Centre_8">[[ formatLang(picking.min_date,date_time = True) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Centre_8">[[ 'weight' in picking._columns.keys() and picking.weight or '']] </para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_5cm_Above_Space">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="196.0,68.0,56.0,61.0,73.0,70.0" repeatRows="1" style="Move_Line_Header">
+ <tr>
+ <td>
+ <para style="terp_tblheader_Details">Description</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Centre">Tracking Lot</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Centre">Lot</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">State</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Centre">Quantity</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">Location</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ <section>
+ <para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state == 'assigned' )],'move_lines') ]]</para>
+ <blockTable colWidths="197.0,68.0,61.0,57,46.0,26.0,74.0" style="Move_Line_Contect_Assign_State">
+ <tr>
+ <td>
+ <para style="terp_default_9">[ [[ move_lines.product_id.default_code ]] ] [[ move_lines.product_id.name ]] [[ move_lines.product_id.variants or '']] </para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ move_lines.tracking_id and move_lines.tracking_id.name or '' ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ move_lines.state ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ move_lines.product_qty ]] </para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ move_lines.product_uom.name ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ (move_lines.location_id and move_lines.location_id.name) or '' ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ </section>
+ <para style="terp_default_5cm_Above_Space">[[ (line.state == 'done' or line.state == 'confirmed') and removeParentNode('para') ]]</para>
+ <para style="terp_default_Bold_9">Non Assigned Products: [[ ( line.state == 'assigned' or line.state == 'done' or line.state == 'confirmed' ) and removeParentNode('para') ]]</para>
+ <para style="terp_default_1cm_above_space">[[ (line.state == 'done' or line.state == 'confirmed') and removeParentNode('para') ]]</para>
+ <section>
+ <para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]]</para>
+ <blockTable colWidths="257.0,57.0,62.0,46.0,26.0,74.0" style="Move_Line_Content_Other_State">
+ <tr>
+ <td>
+ <para style="terp_default_9">[ [[ move_lines.product_id.default_code ]] ] [[ move_lines.product_id.name ]] [[ move_lines.product_id.variants or '']]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ move_lines.state ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ move_lines.product_qty ]] </para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ move_lines.product_uom.name ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ (move_lines.location_id and move_lines.location_id.name) or '' ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ </section>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <para style="Standard">
+ <font color="white"> </font>
+ </para>
+ </story>
+</document>
diff --git a/addons/stock/report/picking.py b/addons/stock/report/picking.py
index 8ab08a5016c..4dcbac4b9a0 100644
--- a/addons/stock/report/picking.py
+++ b/addons/stock/report/picking.py
@@ -32,4 +32,5 @@ class picking(report_sxw.rml_parse):
})
report_sxw.report_sxw('report.stock.picking.list','stock.picking','addons/stock/report/picking.rml',parser=picking)
+report_sxw.report_sxw('report.stock.packing.list','stock.picking','addons/stock/report/packing.rml',parser=picking)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/report/product_stock.py b/addons/stock/report/product_stock.py
index f9a61a8989a..e55405381b4 100644
--- a/addons/stock/report/product_stock.py
+++ b/addons/stock/report/product_stock.py
@@ -71,10 +71,10 @@ class report_stock(report_int):
cr.execute("select sum(r.product_qty * u.factor), r.date_planned, r.product_id "
"from stock_move r left join product_uom u on (r.product_uom=u.id) "
- "where state in %s"
- "and location_id=ANY(%s)"
- "and product_id=ANY(%s)"
- "group by date_planned,product_id",(('confirmed','assigned','waiting'),loc_ids ,product_ids,))
+ "where state IN %s"
+ "and location_id IN %s"
+ "and product_id IN %s"
+ "group by date_planned,product_id",(('confirmed','assigned','waiting'),tuple(loc_ids) ,tuple(product_ids),))
for (qty, dt, prod_id) in cr.fetchall():
if dt<=dt_from:
dt= (datetime.now() + relativedelta(days=1)).strftime('%Y-%m-%d')
@@ -85,10 +85,10 @@ class report_stock(report_int):
cr.execute("select sum(r.product_qty * u.factor), r.date_planned, r.product_id "
"from stock_move r left join product_uom u on (r.product_uom=u.id) "
- "where state in %s"
- "and location_dest_id=ANY(%s)"
- "and product_id=ANY(%s)"
- "group by date_planned,product_id",(('confirmed','assigned','waiting'),loc_ids ,product_ids,))
+ "where state IN %s"
+ "and location_dest_id IN %s"
+ "and product_id IN %s"
+ "group by date_planned,product_id",(('confirmed','assigned','waiting'),tuple(loc_ids) ,tuple(product_ids),))
for (qty, dt, prod_id) in cr.fetchall():
if dt<=dt_from:
diff --git a/addons/stock/report/report_stock_move_view.xml b/addons/stock/report/report_stock_move_view.xml
index e8ec9ed2983..a8ca0df98dc 100644
--- a/addons/stock/report/report_stock_move_view.xml
+++ b/addons/stock/report/report_stock_move_view.xml
@@ -98,7 +98,7 @@
<separator orientation="vertical"/>
<filter string="Company" name="group_state" icon="terp-stock_effects-object-colorize" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
- <filter string="Day" icon="terp-go-month" context="{'group_by':'day'}"/>
+ <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'date_planned'}"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
</group>
@@ -124,7 +124,7 @@
<field name="search_view_id" ref="view_stock_search"/>
<field name="context">{'contact_display': 'partner', 'search_default_month':1, 'search_default_group_product':1,'search_default_done':1,'group_by':[], 'group_by_no_leaf':1}</field>
</record>
- <menuitem action="action_stock_move_report" id="menu_action_stock_move_report" parent="next_id_61" sequence="5"/>
+ <menuitem action="action_stock_move_report" id="menu_action_stock_move_report" parent="next_id_61" sequence="3"/>
<!-- Inventory Control -->
@@ -219,7 +219,7 @@
<field name="search_view_id" eval="False"/>
<field name="context">{'contact_display': 'partner', 'search_default_real':1, 'search_default_location_type_internal':1,'search_default_group_product':1,'search_default_group_location':1,'group_by':[], 'group_by_no_leaf':1}</field>
</record>
- <menuitem action="action_stock_inventory_report" id="menu_action_stock_inventory_report" parent="next_id_61" sequence="5"/>
+ <menuitem action="action_stock_inventory_report" id="menu_action_stock_inventory_report" parent="next_id_61" sequence="4"/>
</data>
diff --git a/addons/stock/report/report_stock_picking_view.xml b/addons/stock/report/report_stock_picking_view.xml
index a14298ff771..b8e5d4ff868 100644
--- a/addons/stock/report/report_stock_picking_view.xml
+++ b/addons/stock/report/report_stock_picking_view.xml
@@ -83,7 +83,7 @@
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="Invoice Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'invoice_state'}"/>
<separator orientation="vertical"/>
- <filter string="Day" icon="terp-go-month" domain="[]" context="{'group_by':'day'}"/>
+ <filter string="Day" icon="terp-go-today" domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-go-year" domain="[]" context="{'group_by':'year'}"/>
</group>
@@ -129,7 +129,8 @@
<field name="act_window_id" ref="action_report_report_stock_picking"/>
</record>
- <menuitem name="Picking" action="action_report_report_stock_picking" id="menu_report_report_stock_pickings_tree" parent="next_id_61"/>
+ <menuitem name="Picking" action="action_report_report_stock_picking"
+ id="menu_report_report_stock_pickings_tree" parent="stock.next_id_61" sequence="5"/>
</data>
</openerp>
diff --git a/addons/stock/security/ir.model.access.csv b/addons/stock/security/ir.model.access.csv
index 9265ac0b2c9..7ecb0b833e9 100644
--- a/addons/stock/security/ir.model.access.csv
+++ b/addons/stock/security/ir.model.access.csv
@@ -5,6 +5,8 @@
"access_stock_warehouse_user","stock.warehouse.user","model_stock_warehouse","base.group_user",1,0,0,0
"access_stock_location_manager","stock.location.manager","model_stock_location","stock.group_stock_manager",1,1,1,1
"access_stock_location_user","stock.location.user","model_stock_location","base.group_user",1,0,0,0
+"access_stock_journal_user","stock.journal.user","model_stock_journal","base.group_user",1,0,0,0
+"access_stock_journal_manager","stock.journal.manager","model_stock_journal","stock.group_stock_manager",1,1,1,1
"access_stock_picking_move_wizard","stock.picking.move.wizard","model_stock_picking_move_wizard","stock.group_stock_user",1,1,1,1
"access_stock_tracking","stock.tracking","model_stock_tracking","stock.group_stock_user",1,1,1,0
"access_stock_picking","stock.picking","model_stock_picking","stock.group_stock_user",1,1,1,1
@@ -40,3 +42,14 @@
"access_stock_inventory_merge","stock.inventory.merge","model_stock_inventory_merge","stock.group_stock_user",1,0,0,0
"access_stock_change_standard_price","stock.change.standard.price","model_stock_change_standard_price","stock.group_stock_user",1,0,0,0
"access_action_traceability","action.traceability","model_action_traceability","stock.group_stock_user",1,0,0,0
+"access_stock_split_into","stock.split.into","model_stock_split_into","stock.group_stock_user",1,0,0,0
+"access_stock_split_into_manager","stock.split.into","model_stock_split_into","stock.group_stock_manager",1,1,1,1
+"access_report_stock_move","report.stock.move","model_report_stock_move","stock.group_stock_user",1,1,1,1
+"access_report_stock_inventory","report.stock.inventory","model_report_stock_inventory","stock.group_stock_user",1,1,1,1
+"access_stock_replacement","stock.replacement","model_stock_replacement","stock.group_stock_user",1,1,1,1
+"access_stock_replacement_result","stock.replacement.result","model_stock_replacement_result","stock.group_stock_user",1,1,1,1
+"access_stock_ups","stock.ups","model_stock_ups","stock.group_stock_user",1,1,1,1
+"access_stock_ups_final","stock.ups.final","model_stock_ups_final","stock.group_stock_user",1,1,1,1
+"access_stock_ups_upload","stock.ups.upload","model_stock_ups_upload","stock.group_stock_user",1,1,1,1
+"access_stock_split_into","stock.split.into","model_stock_split_into","stock.group_stock_user",1,1,1,0
+"access_stock_split_into_manager","stock.split.into","model_stock_split_into","stock.group_stock_manager",1,1,1,1
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index ddfe4808dba..b86a46ac1f0 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -49,6 +49,17 @@ class stock_incoterms(osv.osv):
stock_incoterms()
+class stock_journal(osv.osv):
+ _name = "stock.journal"
+ _description = "Stock Journal"
+ _columns = {
+ 'name': fields.char('Stock Journal', size=32, required=True),
+ 'user_id': fields.many2one('res.users','Responsible'),
+ }
+ _defaults = {
+ 'user_id': lambda s,c,u,ctx: u
+ }
+stock_journal()
#----------------------------------------------------------
# Stock Location
@@ -111,7 +122,7 @@ class stock_location(osv.osv):
return res
def product_detail(self, cr, uid, id, field, context={}):
- """ Finds detail of product like price type, currency and then calculates its price.
+ """ Finds detail of product like price type, currency and then calculates its price.
@param field: Field name
@return: Calculated price
"""
@@ -142,7 +153,7 @@ class stock_location(osv.osv):
def _product_value(self, cr, uid, ids, field_names, arg, context={}):
""" Calculates real and virtual stock value of a product.
- @param field_names: Name of field
+ @param field_names: Name of field
@return: Dictionary of values
"""
result = {}
@@ -159,7 +170,6 @@ class stock_location(osv.osv):
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the stock location without removing it."),
'usage': fields.selection([('supplier', 'Supplier Location'), ('view', 'View'), ('internal', 'Internal Location'), ('customer', 'Customer Location'), ('inventory', 'Inventory'), ('procurement', 'Procurement'), ('production', 'Production'), ('transit', 'Transit Location for Inter-Companies Transfers')], 'Location Type', required=True),
'allocation_method': fields.selection([('fifo', 'FIFO'), ('lifo', 'LIFO'), ('nearest', 'Nearest')], 'Allocation Method', required=True),
-
'complete_name': fields.function(_complete_name, method=True, type='char', size=100, string="Location Name"),
'stock_real': fields.function(_product_qty_available, method=True, type='float', string='Real Stock', multi="stock"),
@@ -169,6 +179,7 @@ class stock_location(osv.osv):
'location_id': fields.many2one('stock.location', 'Parent Location', select=True, ondelete='cascade'),
'child_ids': fields.one2many('stock.location', 'location_id', 'Contains'),
+ 'chained_journal_id': fields.many2one('stock.journal', 'Chained Journal'),
'chained_location_id': fields.many2one('stock.location', 'Chained Location If Fixed'),
'chained_location_type': fields.selection([('none', 'None'), ('customer', 'Customer'), ('fixed', 'Fixed Location')],
'Chained Location Type', required=True),
@@ -181,6 +192,8 @@ class stock_location(osv.osv):
"validated automatically. With 'Manual Operation', the stock move has to be validated "\
"by a worker. With 'Automatic No Step Added', the location is replaced in the original move."
),
+ 'chained_picking_type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery')], 'Shipping Type', help="Shipping type specify of the chained move, goods coming in or going out."),
+ 'chained_company_id': fields.many2one('res.company', 'Chained Company', help='Set here the belonging company of the chained move'),
'chained_delay': fields.integer('Chained lead time (days)'),
'address_id': fields.many2one('res.partner.address', 'Location Address'),
'icon': fields.selection(tools.icons, 'Icon', size=64),
@@ -225,7 +238,7 @@ class stock_location(osv.osv):
elif location.chained_location_type == 'fixed':
result = location.chained_location_id
if result:
- return result, location.chained_auto_packing, location.chained_delay
+ return result, location.chained_auto_packing, location.chained_delay, location.chained_journal_id and location.chained_journal_id.id or False, location.chained_company_id and location.chained_company_id.id or False, location.chained_picking_type
return result
def picking_type_get(self, cr, uid, from_location, to_location, context={}):
@@ -312,13 +325,13 @@ class stock_location(osv.osv):
result['total_price'] = total_price
return result
- def _product_get_multi_location(self, cr, uid, ids, product_ids=False, context={},
+ def _product_get_multi_location(self, cr, uid, ids, product_ids=False, context={},
states=['done'], what=('in', 'out')):
- """
+ """
@param product_ids: Ids of product
@param states: List of states
@param what: Tuple of
- @return:
+ @return:
"""
product_obj = self.pool.get('product.product')
context.update({
@@ -332,7 +345,7 @@ class stock_location(osv.osv):
"""
@param product_ids:
@param states:
- @return:
+ @return:
"""
ids = id and [id] or []
return self._product_get_multi_location(cr, uid, ids, product_ids, context, states)
@@ -354,7 +367,7 @@ class stock_location(osv.osv):
# [ (tracking_id, product_qty, location_id) ]
#
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context={}):
- """
+ """
@param product_id: Id of product
@param product_qty: Quantity of product
@return: List of Values or False
@@ -400,7 +413,7 @@ class stock_tracking(osv.osv):
def get_create_tracking_lot(self, cr, uid, ids, tracking_lot):
"""
@param tracking_lot: Name of tracking lot
- @return:
+ @return:
"""
tracking_lot_list = self.search(cr, uid, [('name', '=', tracking_lot)],
limit=1)
@@ -432,7 +445,7 @@ class stock_tracking(osv.osv):
'move_ids': fields.one2many('stock.move', 'tracking_id', 'Moves Tracked'),
'date': fields.datetime('Created Date', required=True),
}
-
+
_defaults = {
'active': lambda *a: 1,
'name': make_sscc,
@@ -471,7 +484,7 @@ class stock_picking(osv.osv):
""" Calculates planned date if it is greater than 'value'.
@param name: Name of field
@param value: Value of field
- @param arg: User defined argument
+ @param arg: User defined argument
@return: True or False
"""
if not value:
@@ -493,7 +506,7 @@ class stock_picking(osv.osv):
""" Calculates planned date if it is less than 'value'.
@param name: Name of field
@param value: Value of field
- @param arg: User defined argument
+ @param arg: User defined argument
@return: True or False
"""
if not value:
@@ -526,9 +539,9 @@ class stock_picking(osv.osv):
from
stock_move
where
- picking_id=ANY(%s)
+ picking_id IN %s
group by
- picking_id""",(ids,))
+ picking_id""",(tuple(ids),))
for pick, dt1, dt2 in cr.fetchall():
res[pick]['min_date'] = dt1
res[pick]['max_date'] = dt2
@@ -546,7 +559,7 @@ class stock_picking(osv.osv):
}
new_id = super(stock_picking, self).create(cr, user, vals, context)
if not vals.get('auto_picking', False):
- message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals['name'] or "n/a") + "' "+ _("created.")
+ message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals['name'] or "n/a") + _(" with origin")+" '" + (vals['origin'] or "n/a") + "' "+ _("is created.")
self.log(cr, user, new_id, message)
return new_id
@@ -557,7 +570,7 @@ class stock_picking(osv.osv):
'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the picking without removing it."),
'note': fields.text('Notes'),
-
+ 'stock_journal_id': fields.many2one('stock.journal','Stock Journal'),
'location_id': fields.many2one('stock.location', 'Location', help="Keep empty if you produce at the location where the finished products are needed." \
"Set a location if you produce at a fixed location. This can be a partner location " \
"if you subcontract the manufacturing operations."),
@@ -589,7 +602,7 @@ class stock_picking(osv.osv):
("2binvoiced", "To Be Invoiced"),
("none", "Not from Picking")], "Invoice Status",
select=True, required=True, readonly=True, states={'draft': [('readonly', False)]}),
- 'company_id': fields.many2one('res.company', 'Company', required=True,select=1),
+ 'company_id': fields.many2one('res.company', 'Company', required=True, select=1),
}
_defaults = {
'name': lambda self, cr, uid, context: '/',
@@ -599,7 +612,7 @@ class stock_picking(osv.osv):
'type': lambda *a: 'in',
'invoice_state': lambda *a: 'none',
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
- 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock_picking', context=c)
+ 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.picking', context=c)
}
def copy(self, cr, uid, id, default=None, context={}):
@@ -609,7 +622,7 @@ class stock_picking(osv.osv):
picking_obj = self.browse(cr, uid, [id], context)[0]
if ('name' not in default) or (picking_obj.name=='/'):
seq_obj_name = 'stock.picking.' + picking_obj.type
- default['name'] = self.pool.get('ir.sequence').get(cr, uid, seq_obj_name)
+ default['name'] = self.pool.get('ir.sequence').get(cr, uid, seq_obj_name)
return super(stock_picking, self).copy(cr, uid, id, default, context)
@@ -621,7 +634,7 @@ class stock_picking(osv.osv):
def action_confirm(self, cr, uid, ids, context={}):
""" Confirms picking.
- @return: True
+ @return: True
"""
self.write(cr, uid, ids, {'state': 'confirmed'})
todo = []
@@ -697,7 +710,7 @@ class stock_picking(osv.osv):
return True
def cancel_assign(self, cr, uid, ids, *args):
- """ Cancels picking and moves.
+ """ Cancels picking and moves.
@return: True
"""
wf_service = netsvc.LocalService("workflow")
@@ -759,6 +772,8 @@ class stock_picking(osv.osv):
ids2 = [move.id for move in pick.move_lines]
self.pool.get('stock.move').action_cancel(cr, uid, ids2, context)
self.write(cr, uid, ids, {'state': 'cancel', 'invoice_state': 'none'})
+ message = _('Picking') + " '" + pick.name + "' "+_("is cancelled")
+ self.log(cr, uid, id, message)
return True
#
@@ -790,7 +805,7 @@ class stock_picking(osv.osv):
return False
def _get_payment_term(self, cr, uid, picking):
- """ Gets payment term from partner.
+ """ Gets payment term from partner.
@return: Payment term
"""
partner_obj = self.pool.get('res.partner')
@@ -840,7 +855,7 @@ class stock_picking(osv.osv):
def _get_taxes_invoice(self, cr, uid, move_line, type):
""" Gets taxes on invoice
@param move_line: Stock move lines
- @param type: Type of invoice
+ @param type: Type of invoice
@return: Taxes Ids for the move line
"""
if type in ('in_invoice', 'in_refund'):
@@ -911,7 +926,8 @@ class stock_picking(osv.osv):
'name': (invoice.name or '') + ', ' + (picking.name or ''),
'origin': (invoice.origin or '') + ', ' + (picking.name or '') + (picking.origin and (':' + picking.origin) or ''),
'comment': (comment and (invoice.comment and invoice.comment+"\n"+comment or comment)) or (invoice.comment and invoice.comment or ''),
- 'date_invoice':context.get('date_inv',False)
+ 'date_invoice':context.get('date_inv',False),
+ 'user_id':picking.sale_id.user_id and picking.sale_id.user_id.id or False
}
invoice_obj.write(cr, uid, [invoice_id], invoice_vals, context=context)
else:
@@ -928,6 +944,7 @@ class stock_picking(osv.osv):
'fiscal_position': partner.property_account_position.id,
'date_invoice': context.get('date_inv',False),
'company_id': picking.company_id.id,
+ 'user_id':picking.sale_id.user_id and picking.sale_id.user_id.id or False
}
cur_id = self.get_currency_id(cr, uid, picking)
if cur_id:
@@ -1040,12 +1057,12 @@ class stock_picking(osv.osv):
def do_partial(self, cr, uid, ids, partial_datas, context={}):
""" Makes partial picking and moves done.
@param partial_datas : Dictionary containing details of partial picking
- like partner_id, address_id, delivery_date,
+ like partner_id, address_id, delivery_date,
delivery moves with product_id, product_qty, uom
@return: Dictionary of values
"""
res = {}
-
+
move_obj = self.pool.get('stock.move')
product_obj = self.pool.get('product.product')
currency_obj = self.pool.get('res.currency')
@@ -1217,7 +1234,7 @@ class stock_production_lot(osv.osv):
from
stock_report_prodlots
where
- location_id =ANY(%s) and prodlot_id =ANY(%s) group by prodlot_id''',(locations,ids,))
+ location_id IN %s and prodlot_id IN %s group by prodlot_id''',(tuple(locations),tuple(ids),))
res.update(dict(cr.fetchall()))
return res
@@ -1232,8 +1249,8 @@ class stock_production_lot(osv.osv):
from
stock_report_prodlots
where
- location_id =ANY(%s) group by prodlot_id
- having sum(name) '''+ str(args[0][1]) + str(args[0][2]),(locations,))
+ location_id IN %s group by prodlot_id
+ having sum(name) '''+ str(args[0][1]) + str(args[0][2]),(tuple(locations),))
res = cr.fetchall()
ids = [('id', 'in', map(lambda x: x[0], res))]
return ids
@@ -1262,7 +1279,7 @@ stock_production_lot()
class stock_production_lot_revision(osv.osv):
_name = 'stock.production.lot.revision'
_description = 'Production lot revisions'
-
+
_columns = {
'name': fields.char('Revision Name', size=64, required=True),
'description': fields.text('Description'),
@@ -1289,6 +1306,7 @@ stock_production_lot_revision()
# location_dest_id is only used for predicting futur stocks
#
class stock_move(osv.osv):
+
def _getSSCC(self, cr, uid, context={}):
cr.execute('select id from stock_tracking where create_uid=%s order by id desc limit 1', (uid,))
res = cr.fetchone()
@@ -1366,7 +1384,7 @@ class stock_move(osv.osv):
\nThe state is \'Waiting\' if the move is waiting for another one.'),
'price_unit': fields.float('Unit Price',
digits_compute= dp.get_precision('Account')),
- 'company_id': fields.many2one('res.company', 'Company', required=True,select=1),
+ 'company_id': fields.many2one('res.company', 'Company', required=True, select=1),
'partner_id': fields.related('picking_id','address_id','partner_id',type='many2one', relation="res.partner", string="Partner"),
'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Order"),
'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin"),
@@ -1392,7 +1410,8 @@ class stock_move(osv.osv):
move_list = self.pool.get('stock.move').read(cr, uid, context['move_line'][0], ['location_dest_id'])
return move_list and move_list['location_dest_id'][0] or False
if context.get('address_out_id', False):
- return self.pool.get('res.partner.address').browse(cr, uid, context['address_out_id'], context).partner_id.property_stock_customer.id
+ property_out = self.pool.get('res.partner.address').browse(cr, uid, context['address_out_id'], context).partner_id.property_stock_customer
+ return property_out and property_out.id or False
return False
def _default_location_source(self, cr, uid, context={}):
@@ -1438,7 +1457,7 @@ class stock_move(osv.osv):
cursor.commit()
return res
- def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False,
+ def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False,
loc_id=False, product_id=False, context=None):
""" On change of production lot gives a warning message.
@param prodlot_id: Changed production lot id
@@ -1461,13 +1480,13 @@ class stock_move(osv.osv):
}
return {'warning': warning}
- def onchange_quantity(self, cr, uid, ids, product_id, product_qty,
+ def onchange_quantity(self, cr, uid, ids, product_id, product_qty,
product_uom, product_uos):
""" On change of product quantity finds UoM and UoS quantities
@param product_id: Product id
@param product_qty: Changed Quantity of product
@param product_uom: Unit of measure of product
- @param product_uos: Unit of sale of product
+ @param product_uos: Unit of sale of product
@return: Dictionary of values
"""
result = {
@@ -1487,13 +1506,13 @@ class stock_move(osv.osv):
return {'value': result}
- def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,
+ def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,
loc_dest_id=False, address_id=False):
""" On change of product id, if finds UoM, UoS, quantity and UoS quantity.
@param prod_id: Changed Product id
@param loc_id: Source location id
@param loc_id: Destination location id
- @param address_id: Address id of partner
+ @param address_id: Address id of partner
@return: Dictionary of values
"""
if not prod_id:
@@ -1558,8 +1577,9 @@ class stock_move(osv.osv):
def create_chained_picking(self, cr, uid, moves, context):
new_moves = []
+ res_obj = self.pool.get('res.company')
for picking, todo in self._chain_compute(cr, uid, moves, context).items():
- ptype = self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
+ ptype = todo[0][1][5] and todo[0][1][5] or self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
pick_name = ''
if ptype == 'delivery':
pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.delivery')
@@ -1570,17 +1590,20 @@ class stock_move(osv.osv):
'note': picking.note,
'move_type': picking.move_type,
'auto_picking': todo[0][1][1] == 'auto',
+ 'stock_journal_id': todo[0][1][3],
+ 'company_id': todo[0][1][4] or res_obj._company_default_get(cr, uid, 'stock.company', context),
'address_id': picking.address_id.id,
+
'invoice_state': 'none'
})
- for move, (loc, auto, delay) in todo:
- # Is it smart to copy ? May be it's better to recreate ?
+ for move, (loc, auto, delay, journal, company_id, ptype) in todo:
new_id = self.pool.get('stock.move').copy(cr, uid, move.id, {
'location_id': move.location_dest_id.id,
'location_dest_id': loc.id,
'date_moved': time.strftime('%Y-%m-%d'),
'picking_id': pickid,
'state': 'waiting',
+ 'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context) ,
'move_history_ids': [],
'date_planned': (datetime.strptime(move.date_planned, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'),
'move_history_ids2': []}
@@ -1666,6 +1689,33 @@ class stock_move(osv.osv):
wf_service.trg_write(uid, 'stock.picking', pick_id, cr)
return count
+ def setlast_tracking(self, cr, uid, ids, context=None):
+ new_move = []
+ update_val = {}
+ ir_sequence_obj = self.pool.get('ir.sequence')
+ tracking_obj = self.pool.get('stock.tracking')
+ tracking = False
+ tracking = context.get('tracking', False)
+ # import pdb; pdb.set_trace()
+ if tracking:
+ tracking_id = tracking_obj.search(cr, uid, ['name','=', tracking])
+ if prodlot_id:
+ update_val['prodlot_id'] = prodlot_id
+ else:
+ tracking_id = tracking_obj.create(cr, uid, {'name': tracking}, {'product_id': self.browse(cr, uid, ids)[0].product_id.id})
+ update_val['tracking_id'] = tracking_id
+ else:
+ last_track = [line.tracking_id for line in self.browse(cr, uid, ids)[0].picking_id.move_lines if line.tracking_id]
+ if not last_track:
+ track_ids= tracking_obj.search(cr, uid, [])
+ last_track = [track for track in tracking_obj.browse(cr, uid, track_ids)]
+ last_track.sort(key=lambda p: p.date, reverse=True)
+ last_track_id = last_track and last_track[0].id
+ update_val['tracking_id'] = last_track_id
+ self.write(cr, uid, ids, update_val)
+ return True
+
+
#
# Cancel move => cancel others move and pickings
#
@@ -1741,13 +1791,13 @@ class stock_move(osv.osv):
def action_done(self, cr, uid, ids, context={}):
""" Makes the move done and if all moves are done, it will finish the picking.
- @return:
+ @return:
"""
track_flag = False
picking_ids = []
product_uom_obj = self.pool.get('product.uom')
price_type_obj = self.pool.get('product.price.type')
- product_obj=self.pool.get('product.product')
+ product_obj=self.pool.get('product.product')
move_obj = self.pool.get('account.move')
for move in self.browse(cr, uid, ids):
if move.picking_id: picking_ids.append(move.picking_id.id)
@@ -1777,7 +1827,7 @@ class stock_move(osv.osv):
journal_id, acc_src, acc_dest, acc_variation, amount = self._get_accounting_values(cr, uid, move, context)
lines = [(journal_id, self.create_account_move(cr, uid, move, acc_dest, acc_variation, amount, context))]
- elif ((move.location_id.usage == 'supplier' and move.location_dest_id.usage == 'internal') or (move.location_id.usage == 'transit' and move.location_dest_id.usage == 'internal')):
+ elif ((move.location_id.usage == 'supplier' and move.location_dest_id.usage == 'internal') or (move.location_id.usage == 'transit' and move.location_dest_id.usage == 'internal')):
if move.location_dest_id.company_id:
context.update({'force_company': move.location_dest_id.company_id.id})
journal_id, acc_src, acc_dest, acc_variation, amount = self._get_accounting_values(cr, uid, move, context)
@@ -1810,17 +1860,26 @@ class stock_move(osv.osv):
self.write(cr, uid, ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S'), 'tracking_id': tracking_lot or False})
picking_obj = self.pool.get('stock.picking')
+
for pick in picking_obj.browse(cr, uid, picking_ids):
if all(move.state == 'done' for move in pick.move_lines):
picking_obj.action_done(cr, uid, [pick.id])
+ for (id,name) in picking_obj.name_get(cr, uid, picking_ids):
+ message = _('Picking ') + " '" + name + "' "+ _("is processed")
+ self.log(cr, uid, id, message)
+
wf_service = netsvc.LocalService("workflow")
for id in ids:
wf_service.trg_trigger(uid, 'stock.move', id, cr)
+
+ for pick in picking_obj.browse(cr, uid, picking_ids):
+ if len([move.state == 'done' for move in pick.move_lines]) == len(pick.move_lines):
+ wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr)
return True
-
+
def create_account_move(self, cr, uid, move,account_id,account_variation,amount, context=None):
-
+
partner_id = move.picking_id.address_id and (move.picking_id.address_id.partner_id and move.picking_id.address_id.partner_id.id or False) or False
lines=[(0, 0, {
'name': move.name,
@@ -1831,7 +1890,7 @@ class stock_move(osv.osv):
'ref': move.picking_id and move.picking_id.name or False,
'date': time.strftime('%Y-%m-%d') ,
'partner_id': partner_id,
- }),
+ }),
(0, 0, {
'name': move.name,
'product_id': move.product_id and move.product_id.id or False,
@@ -1841,7 +1900,7 @@ class stock_move(osv.osv):
'ref': move.picking_id and move.picking_id.name or False,
'date': time.strftime('%Y-%m-%d') ,
'partner_id': partner_id,
- })]
+ })]
return lines
def unlink(self, cr, uid, ids, context=None):
if context is None:
@@ -2031,7 +2090,7 @@ class stock_move(osv.osv):
def do_partial(self, cr, uid, ids, partial_datas, context={}):
""" Makes partial pickings and moves done.
@param partial_datas: Dictionary containing details of partial picking
- like partner_id, address_id, delivery_date, delivery
+ like partner_id, address_id, delivery_date, delivery
moves with product_id, product_qty, uom
"""
res = {}
@@ -2176,7 +2235,7 @@ class stock_inventory(osv.osv):
""" Creates a stock move from an inventory line
@param inventory_line:
@param move_vals:
- @return:
+ @return:
"""
return self.pool.get('stock.move').create(cr, uid, move_vals)
@@ -2203,7 +2262,7 @@ class stock_inventory(osv.osv):
'prodlot_id': lot_id,
'date': inv.date,
'date_planned': inv.date,
- 'state': 'assigned'
+ 'state': 'done'
}
if change > 0:
value.update( {
@@ -2223,9 +2282,6 @@ class stock_inventory(osv.osv):
'product_qty': line.product_qty
})
move_ids.append(self._inventory_line_hook(cr, uid, line, value))
- if len(move_ids):
- self.pool.get('stock.move').action_done(cr, uid, move_ids,
- context=context)
self.write(cr, uid, [inv.id], {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S'), 'move_ids': [(6, 0, move_ids)]})
return True
@@ -2268,7 +2324,7 @@ class stock_inventory_line(osv.osv):
""" Changes UoM and name if product_id changes.
@param location_id: Location id
@param product: Changed product_id
- @param uom: UoM product
+ @param uom: UoM product
@return: Dictionary of changed values
"""
if not product:
diff --git a/addons/stock/stock_report.xml b/addons/stock/stock_report.xml
index 3084e8527a7..547ed785cd1 100644
--- a/addons/stock/stock_report.xml
+++ b/addons/stock/stock_report.xml
@@ -3,6 +3,7 @@
<data>
<report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Future Stock Forecast"/>
<report id="report_picking_list" model="stock.picking" name="stock.picking.list" string="Picking list" rml="stock/report/picking.rml"/>
+ <report id="report_packing_list" model="stock.picking" name="stock.packing.list" string="Packing list" rml="stock/report/packing.rml"/>
<report id="report_move_labels" model="stock.move" name="stock.move.label" string="Item Labels" xml="stock/report/lot_move_label.xml" xsl="stock/report/lot_move_label.xsl"/>
<report auto="False" id="report_location_overview" model="stock.location" name="lot.stock.overview" string="Location Overview" rml="stock/report/lot_overview.rml" groups="base.group_extended"/>
<report auto="False" id="report_lot_location" model="stock.location" name="lot.location" rml="stock/report/lot_location.rml" string="Lots by location"/>
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 0e26df8bdf9..e8ffe0a577a 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
- <menuitem icon="terp-stock" id="menu_stock_root" name="Warehouse" sequence="2"/>
+ <menuitem icon="terp-stock" id="menu_stock_root" name="Warehouse" sequence="5"/>
<menuitem id="menu_stock_warehouse_mgmt" name="Warehouse Management" parent="menu_stock_root" sequence="1"/>
- <menuitem id="menu_stock_products_moves" name="Products Moves" parent="menu_stock_root" sequence="5"/>
- <menuitem id="menu_stock_product" name="Product" parent="menu_stock_root" sequence="4"/>
+ <menuitem id="menu_stock_products_moves" name="Products Moves" parent="menu_stock_root" sequence="7"/>
+ <menuitem id="menu_stock_product" name="Product" parent="menu_stock_root" sequence="6"/>
<menuitem action="product.product_normal_action" id="menu_stock_products_menu" parent="menu_stock_product" sequence="1"/>
<menuitem id="menu_stock_configuration" name="Configuration" parent="menu_stock_root" sequence="15"/>
- <menuitem id="menu_stock_inventory_control" name="Inventory Control" parent="menu_stock_root" sequence="3"/>
+ <menuitem id="menu_warehouse_config" name="Warehouse mangement" parent="menu_stock_configuration" sequence="1"/>
+ <menuitem id="menu_stock_inventory_control" name="Inventory Control" parent="menu_stock_root" sequence="4"/>
<record id="stock_inventory_line_tree" model="ir.ui.view">
<field name="name">stock.inventory.line.tree</field>
@@ -181,7 +182,7 @@
<field name="view_type">form</field>
<field name="view_id" ref="view_tracking_tree"/>
</record>
- <menuitem id="menu_traceability" name="Traceability" parent="menu_stock_root" sequence="2"/>
+ <menuitem id="menu_traceability" name="Traceability" parent="menu_stock_root" sequence="3"/>
<menuitem action="action_tracking_form" id="menu_action_tracking_form"
groups="base.group_extended"
parent="menu_traceability"/>
@@ -313,6 +314,7 @@
<field name="product_qty" />
<field name="product_uom" string="UOM"/>
<field name="prodlot_id" groups="base.group_extended"/>
+ <field groups="base.group_extended" name="tracking_id"/>
<field name="product_packaging" domain="[('product_id','=',product_id)]" groups="base.group_extended"/>
<field name="picking_id"/>
<field name="location_id" />
@@ -321,6 +323,7 @@
<field name="date_planned" string="Date"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
+ <button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
</tree>
</field>
</record>
@@ -336,6 +339,7 @@
<field name="product_qty" />
<field name="product_uom" string="UOM"/>
<field name="prodlot_id" groups="base.group_extended"/>
+ <field groups="base.group_extended" name="tracking_id"/>
<field name="product_packaging" domain="[('product_id','=',product_id)]" groups="base.group_extended"/>
<field name="picking_id"/>
<field name="location_id" />
@@ -420,6 +424,9 @@
<field name="chained_location_id"/>
<field name="chained_auto_packing"/>
<field name="chained_delay"/>
+ <field name="chained_journal_id"/>
+ <field name="chained_picking_type"/>
+ <field name="chained_company_id" widget="selection"/>
</group>
<group col="2" colspan="2">
<separator string="Localization" colspan="2"/>
@@ -475,7 +482,7 @@
<field name="view_id" ref="view_location_tree2"/>
<field name="context">{'full':1, 'search_default_in_location':1}</field>
</record>
- <menuitem action="action_location_form" id="menu_action_location_form" parent="menu_stock_configuration" />
+ <menuitem action="action_location_form" id="menu_action_location_form" parent="menu_warehouse_config" />
<record id="view_location_tree" model="ir.ui.view">
<field name="name">stock.location.tree</field>
@@ -535,7 +542,7 @@
<field name="view_type">form</field>
<field name="view_id" ref="view_warehouse_tree"/>
</record>
- <menuitem action="action_warehouse_form" id="menu_action_warehouse_form" parent="menu_stock_configuration"/>
+ <menuitem action="action_warehouse_form" id="menu_action_warehouse_form" parent="menu_warehouse_config"/>
<record id="stock_picking_move_wizard_form" model="ir.ui.view">
<field name="name">stock.picking.move.wizard.form</field>
@@ -603,37 +610,46 @@
<field name="arch" type="xml">
<form string="Picking list">
<group colspan="4" col="6">
-
<field name="name" readonly="1"/>
-<!-- <field name="address_id" context="{'contact_display' : 'partner'}" groups="base.group_extended"/>-->
<field name="origin"/>
-
<field name="backorder_id" groups="base.group_extended" readonly="1"/>
<field name="date"/>
<field name="min_date"/>
<field name="type"/>
+ <field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
- <tree colors="grey:state in ('cancel')" string="Stock Moves">
+ <tree colors="grey:state in ('cancel')" string="Stock Moves" editable="top">
<field name="name" string="Move Name"/>
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="UOM"/>
<field name="picking_id"/>
<field name="prodlot_id" groups="base.group_extended"/>
+ <button
+ name="%(stock.track_line)d"
+ string="Split in production lots"
+ groups="base.group_extended"
+ type="action" icon="terp-stock_effects-object-colorize"
+ states="draft,waiting,confirmed,assigned" />
+ <field groups="base.group_extended" name="tracking_id"/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize"
+ states="draft,assigned,confirmed,done"/>
+ <button name="setlast_tracking" string="Set Last Tracking" type="object"
+ attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ icon="terp-stock_effects-object-colorize"
+ groups="base.group_extended"
+ states="draft,assigned,confirmed,done"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date_planned"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
- <button
- name="%(stock.track_line)d"
- string="Split in production lots"
- type="action" icon="terp-stock_effects-object-colorize"
- states="draft,waiting,confirmed,assigned" />
<button name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
@@ -662,10 +678,18 @@
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
<field groups="base.group_extended" name="tracking_id"/>
+
<newline/>
<label/>
- <button name="%(track_line)d" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize"/>
+ <button name="%(track_line)d" string="Split in production lots"
+ states="draft,waiting,confirmed,assigned"
+ type="action" icon="terp-stock_effects-object-colorize"
+ groups="base.group_extended" />
<button name="%(move_scrap)d" string="Scrap Move Line" type="action" icon="gtk-justify-fill"/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ states="draft,assigned,confirmed,done"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize" />
<separator colspan="4" string="Move State"/>
<field name="state"/>
<group colspan="2">
@@ -715,10 +739,9 @@
<separator orientation="vertical"/>
<filter icon="terp-accessories-archiver-minus" string="Back Order" domain="[('backorder_id', '&lt;&gt;', False)]" help="Has Back Order" />
<separator orientation="vertical"/>
- <field name="location_id"/>
- <field name="location_dest_id"/>
<field name="name"/>
<field name="address_id"/>
+ <field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="8">
@@ -761,19 +784,30 @@
<field name="backorder_id" groups="base.group_extended" readonly="1"/>
<field name="date" />
<field name="min_date"/>
- <field name="type" invisible="1"/>
+ <field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
+ <field name="type" invisible="1"/>
</group>
<notebook colspan="4">
<page string="General Information">
- <field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
- <tree colors="grey:state in ('cancel')" string="Stock Moves">
+ <field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}" >
+ <tree colors="grey:state in ('cancel')" string="Stock Moves" editable="top">
<field name="name" string="Move Name"/>
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="UOM"/>
<field name="picking_id" />
<field name="prodlot_id" groups="base.group_extended"/>
+ <field groups="base.group_extended" name="tracking_id"/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ states="draft,assigned,confirmed,done"
+ groups="base.group_extended"/>
+ <button name="setlast_tracking" string="Set Last Tracking" type="object"
+ attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize"
+ states="draft,assigned,confirmed,done"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date_planned"/>
@@ -806,11 +840,23 @@
<field name="date_planned"/>
<field name="date_expected" string="Date Expected"/>
<field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]"/>
+ <newline/>
<field name="prodlot_id" groups="base.group_extended"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
<field groups="base.group_extended" name="tracking_id"/>
+
+ <label/>
+ <button name="%(track_line)d" string="Split in production lots"
+ groups="base.group_extended"
+ states="draft,waiting,confirmed,assigned"
+ type="action" icon="terp-stock_effects-object-colorize"/>
+ <label/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize"
+ states="draft,assigned,confirmed,done"/>
<separator colspan="4" string="Move State"/>
<field name="state"/>
<group colspan="2">
@@ -863,6 +909,7 @@
<field name="name"/>
<field name="address_id"/>
<field name="origin"/>
+ <field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
@@ -901,7 +948,7 @@
<field name="view_mode">calendar</field>
<field name="act_window_id" ref="action_picking_tree_delivery"/>
</record>
- <menuitem action="action_picking_tree_delivery" id="menu_action_picking_tree_delivery" parent="menu_stock_warehouse_mgmt" sequence="20"/>
+ <menuitem action="action_picking_tree_delivery" id="menu_action_picking_tree_delivery" parent="menu_stock_warehouse_mgmt" sequence="1"/>
#
# Sending Products
@@ -939,12 +986,13 @@
<field name="backorder_id" readonly="1"/>
<field name="origin" readonly="1"/>
<field name="type" invisible="1"/>
+ <field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="General Information">
- <field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
- <tree colors="grey:state in ('cancel')" string="Stock Moves">
+ <field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}" >
+ <tree colors="grey:state in ('cancel')" string="Stock Moves" editable="top">
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="UOM"/>
@@ -953,23 +1001,23 @@
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" />
<field name="prodlot_id" groups="base.group_extended"/>
- <button name="%(track_line)d" string="Split" type="action"
- icon="gtk-justify-fill" attrs="{'invisible': [('prodlot_id','&lt;&gt;',False)]}"
- states="assigned,confirmed,done"
+ <button name="%(track_line)d" string="Split in production lots" type="action"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('prodlot_id','&lt;&gt;',False)]}"
+ states="draft,assigned,confirmed,done"
groups="base.group_extended"/>
+ <field name="tracking_id" groups="base.group_extended"/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ icon="terp-stock_effects-object-colorize"
+ groups="base.group_extended"
+ states="draft,assigned,confirmed,done"/>
+ <button name="setlast_tracking" string="Set Last Tracking" type="object"
+ attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize"
+ states="draft,assigned,confirmed,done"/>
<field name="location_id"/>
<field name="date_planned"/>
<field name="state"/>
- <button
- name="%(stock.track_line)d"
- string="Split in production lots"
- type="action" icon="terp-stock_effects-object-colorize"
- states="draft,waiting,confirmed,assigned" />
- <button
- name="%(stock.move_scrap)d"
- string="Scrap Products" type="action"
- icon="gtk-convert"
- states="draft,waiting,confirmed,assigned" />
<button name="%(action_partial_move)d" string="Partial" type="action" states="confirmed,assigned" icon="gtk-justify-fill"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
</tree>
@@ -989,13 +1037,23 @@
<field name="date_planned"/>
<field name="date_expected" string="Date Expected"/>
<field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]"/>
+ <newline/>
<field name="prodlot_id" groups="base.group_extended"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
<field groups="base.group_extended" name="tracking_id"/>
<label/>
- <button name="%(track_line)d" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize"/>
+ <button name="%(track_line)d" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize"
+ states="draft,assigned,confirmed,done"
+ groups="base.group_extended"
+ />
+ <label/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize"
+ states="draft,assigned,confirmed,done"/>
+ <label/>
<separator colspan="4" string="Move State"/>
<field name="state"/>
<group colspan="2">
@@ -1048,6 +1106,7 @@
<field name="name"/>
<field name="address_id" />
<field name="origin"/>
+ <field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<newline/>
@@ -1088,7 +1147,7 @@
<field name="view_mode">calendar</field>
<field name="act_window_id" ref="action_picking_tree"/>
</record>
- <menuitem action="action_picking_tree" id="menu_action_picking_tree" parent="menu_stock_warehouse_mgmt" sequence="5"/>
+ <menuitem action="action_picking_tree" id="menu_action_picking_tree" parent="menu_stock_warehouse_mgmt" sequence="3"/>
<record id="view_picking_in_tree" model="ir.ui.view">
<field name="name">stock.picking.in.tree</field>
@@ -1125,24 +1184,35 @@
<field name="type"/>
<field name="min_date" readonly="1"/>
<field name="invoice_state" string="Invoice Control"/>
+ <field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="General Information">
- <field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id}">
- <tree colors="grey:state in ('cancel')" string="Stock Moves">
- <field name="product_id"/>
- <field name="product_qty"/>
- <field name="product_uom" string="Product Unit of Measure"/>
+ <field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id}" >
+ <tree colors="grey:state in ('cancel')" string="Stock Moves" editable="top">
+ <field name="product_id" readonly="1"/>
+ <field name="product_qty" readonly="1"/>
+ <field name="product_uom" string="UOM" readonly="1"/>
<field name="location_dest_id"/>
<field name="prodlot_id" groups="base.group_extended"/>
- <field name="state"/>
- <button
+ <button
name="%(stock.track_line)d"
- string="Split in production lots"
+ string="Split in production ii lots"
+ groups="base.group_extended"
type="action" icon="terp-stock_effects-object-colorize"
states="draft,waiting,confirmed,assigned" />
- <button name="%(stock.move_scrap)d"
+ <field name="tracking_id" groups="base.group_extended"/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ states="draft,assigned,confirmed,done"/>
+ <button name="setlast_tracking" string="Set Last Tracking" type="object"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ states="draft,assigned,confirmed,done"/>
+ <field name="state"/>
+ <button name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" />
@@ -1156,23 +1226,23 @@
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom"/>
- <field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field groups="product.group_uos" name="product_uos_qty"/>
<field colspan="4" invisible="1" name="name" />
<field groups="base.group_extended" name="date_planned"/>
- <field name="date_expected" groups="base.group_extended" string="Date Expected"/>
- <newline/>
+ <field name="date_expected" groups="base.group_extended" string="Date Expected"/>
+ <field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<newline/>
- <field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]"/>
<newline/>
- <field name="prodlot_id" groups="base.group_extended"
- context="{'location_id':location_id, 'product_id':product_id}"
- domain="[('product_id','=?',product_id)]"
- on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
+ <field name="prodlot_id" groups="base.group_extended" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=?',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
<field groups="base.group_extended" name="tracking_id"/>
+
<newline/>
<label/>
- <button groups="base.group_extended" name="%(track_line)d" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize"/>
+ <button groups="base.group_extended" name="267" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize"/>
+ <label/>
+ <button name="275" string="Split Stock Moves" type="action"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}" states="draft,assigned,confirmed,done"/>
<separator colspan="4" string="Move State"/>
<field name="state"/>
<group colspan="2">
@@ -1220,6 +1290,7 @@
<field name="name"/>
<field name="address_id"/>
<field name="origin"/>
+ <field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" widget="selection" groups="base.group_multi_company" />
</group>
<newline/>
@@ -1263,7 +1334,7 @@
<field name="view_mode">calendar</field>
<field name="act_window_id" ref="action_picking_tree4"/>
</record>
- <menuitem action="action_picking_tree4" id="menu_action_picking_tree4" parent="menu_stock_warehouse_mgmt" sequence="1"/>
+ <menuitem action="action_picking_tree4" id="menu_action_picking_tree4" parent="menu_stock_warehouse_mgmt" sequence="2"/>
<record id="view_picking_internal_search" model="ir.ui.view">
<field name="name">stock.picking.internal.search</field>
@@ -1277,6 +1348,7 @@
<separator orientation="vertical"/>
<field name="name"/>
<field name="origin"/>
+ <field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" widget="selection"/>
</group>
<newline/>
@@ -1301,7 +1373,7 @@
<field name="context">{'contact_display': 'partner',"search_default_confirmed":1}</field>
<field name="search_view_id" ref="view_picking_internal_search"/>
</record>
- <menuitem action="action_picking_tree6" id="menu_action_picking_tree6" parent="menu_stock_warehouse_mgmt" sequence="2"/>
+ <menuitem action="action_picking_tree6" id="menu_action_picking_tree6" parent="menu_stock_warehouse_mgmt" sequence="4"/>
<record id="view_move_tree" model="ir.ui.view">
<field name="name">stock.move.tree</field>
@@ -1309,7 +1381,7 @@
<field name="type">tree</field>
<field eval="6" name="priority"/>
<field name="arch" type="xml">
- <tree colors="grey:state in ('cancel');red:(state not in ('cancel','done')) and date_planned > current_date" string="Moves">
+ <tree colors="grey:state in ('cancel');red:(state not in ('cancel','done')) and date_planned > current_date" string="Moves" editable="top">
<field name="picking_id" select="1"/>
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
@@ -1319,15 +1391,25 @@
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" />
<field name="prodlot_id" groups="base.group_extended"/>
- <button name="%(track_line)d" string="Split" type="action"
- icon="gtk-justify-fill" attrs="{'invisible': [('prodlot_id','&lt;&gt;',False)]}"
- states="assigned,confirmed"
+ <button name="%(track_line)d" string="Split in Production Lots" type="action"
+ icon="gtk-justify-fill"
+ states="draft,waiting,confirmed,assigned"
groups="base.group_extended"/>
+ <field groups="base.group_extended" name="tracking_id"/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ states="draft,assigned,confirmed,done"/>
+ <button name="setlast_tracking" string="Set Last Tracking" type="object"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ states="draft,assigned,confirmed,done"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date_planned"/>
<field name="date_expected"/>
<field name="state"/>
+ <button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
</tree>
</field>
</record>
@@ -1377,7 +1459,19 @@
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
- <button name="%(track_line)d" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize" colspan="2" />
+ <newline/>
+ <group colspan="4" col="4">
+ <label/>
+ <button name="%(track_line)d"
+ groups="base.group_extended"
+ states="draft,waiting,confirmed,assigned"
+ string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize" colspan="2" />
+ <label/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ states="draft,assigned,confirmed,done"/>
+ </group>
</group>
</page>
</notebook>
@@ -1460,17 +1554,26 @@
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" />
<field name="prodlot_id" groups="base.group_extended"/>
- <button name="%(track_line)d" string="Split" type="action"
- icon="gtk-justify-fill" attrs="{'invisible': [('prodlot_id','&lt;&gt;',False)]}"
- states="assigned,confirmed,done"
+ <button name="%(track_line)d" string="Split in production lots" type="action"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('prodlot_id','&lt;&gt;',False)]}"
+ states="draft,waiting,confirmed,assigned"
+ context="{'default_use_exist': picking_id.type=='in'}"
groups="base.group_extended"/>
+ <field name="tracking_id" groups="base.group_extended"/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ states="draft,assigned,confirmed,done"/>
+ <button name="setlast_tracking" string="Set Last Tracking" type="object"
+ attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize"
+ states="draft,assigned,confirmed,done"/>
<field name="date_planned"/>
<field name="backorder_id" groups="base.group_extended"/>
<field name="state"/>
- <button name="%(track_line)d" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize" states="draft,waiting,confirmed,assigned"/>
<button name="%(action_partial_move)d" string="Partial" type="action" states="assigned" icon="gtk-justify-fill"/>
- <button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
- <button name="action_done" states="assigned" string="Done" type="object" icon="gtk-jump-to"/>
+ <button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
</tree>
</field>
</record>
@@ -1499,19 +1602,24 @@
<field name="date_expected"/>
<field name="priority"/>
<field name="address_id" context="{'contact_display':'partner'}"/>
- <newline/>
<field name="picking_id"/>
<newline/>
<field name="prodlot_id" groups="base.group_extended"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
- <field name="tracking_id"/>
+ <field groups="base.group_extended" name="tracking_id"/>
<newline/>
- <group col="2" colspan="2">
- <label/>
- <button name="%(track_line)d" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize"/>
- </group>
+ <label/>
+ <button name="%(track_line)d" string="Split in production lots"
+ states="draft,waiting,confirmed,assigned"
+ groups="base.group_extended"
+ type="action" icon="terp-stock_effects-object-colorize"/>
+ <label/>
+ <button name="%(split_into)d" string="Split Stock Moves" type="action"
+ groups="base.group_extended"
+ icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
+ states="draft,assigned,confirmed,done"/>
<separator colspan="4" string="Move State"/>
<field name="state"/>
<group col="5" colspan="2">
@@ -1556,6 +1664,10 @@
<separator orientation="vertical"/>
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_planned'}" />
</group>
+ <newline/>
+ <group expand="0" string="Extended options..." groups="base.group_extended">
+ <field name="tracking_id" context="{'tracking': self}" domain="[]" />
+ </group>
</search>
</field>
</record>
@@ -1620,7 +1732,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
-<!-- <menuitem action="action_incoterms_tree" id="menu_action_incoterms_tree" parent="menu_stock_configuration"/>-->
+<!-- <menuitem action="action_incoterms_tree" id="menu_action_incoterms_tree" parent="menu_warehouse_config"/>-->
<act_window
context="{'location': active_id}"
@@ -1799,5 +1911,52 @@
<menuitem action="action_reception_picking_move" id="menu_action_pdct_in" parent="menu_stock_products_moves" sequence="1"/>
<menuitem action="action_out_picking_move" id="menu_action_pdct_out" parent="menu_stock_products_moves" sequence="2"/>
+
+
+ <record id="view_stock_journal_filter" model="ir.ui.view">
+ <field name="name">stock.journal.filter</field>
+ <field name="model">stock.journal</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Stock Journal">
+ <field name="name"/>
+ <field name="user_id"/>
+ </search>
+ </field>
+ </record>
+ <record model="ir.ui.view" id="view_stock_journal_tree">
+ <field name="name">Stock Journals</field>
+ <field name="model">stock.journal</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Stock Journal">
+ <field name="name"/>
+ <field name="user_id"/>
+ </tree>
+ </field>
+ </record>
+ <record model="ir.ui.view" id="view_stock_journal_form">
+ <field name="name">Stock Journals</field>
+ <field name="model">stock.journal</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Stock Journal">
+ <field name="name"/>
+ <field name="user_id"/>
+ </form>
+ </field>
+ </record>
+ <record id="action_stock_journal_form" model="ir.actions.act_window">
+ <field name="name">Stock Journals</field>
+ <field name="res_model">stock.journal</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="view_type">form</field>
+ </record>
+ <menuitem
+ action="action_stock_journal_form"
+ id="menu_action_stock_journal_form"
+ groups="base.group_extended"
+ parent="menu_warehouse_config" />
+
</data>
</openerp>
diff --git a/addons/stock/wizard/__init__.py b/addons/stock/wizard/__init__.py
index 82825000eaa..a211de96780 100644
--- a/addons/stock/wizard/__init__.py
+++ b/addons/stock/wizard/__init__.py
@@ -21,6 +21,7 @@
import stock_traceability
import stock_move
+import stock_splitinto
import stock_partial_picking
import stock_partial_move
import stock_replacement
diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py
index 8616f939bb8..d66972fd36b 100644
--- a/addons/stock/wizard/stock_move.py
+++ b/addons/stock/wizard/stock_move.py
@@ -179,13 +179,18 @@ class split_in_production_lot(osv.osv_memory):
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
if 'product_id' in fields:
res.update({'product_id': move.product_id.id})
+ if 'product_uom' in fields:
+ res.update({'product_uom': move.product_uom.id})
if 'qty' in fields:
res.update({'qty': move.product_qty})
+ if 'use_exist' in fields:
+ res.update({'use_exist': (move.picking_id and move.picking_id.type=='out' and True) or False})
return res
_columns = {
'qty': fields.integer('Quantity'),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
+ 'product_uom': fields.many2one('product.uom', 'Product UOM'),
'line_ids': fields.one2many('stock.move.split.lines', 'lot_id', 'Lots Number'),
'line_exist_ids': fields.one2many('stock.move.split.lines.exist', 'lot_id', 'Lots Existing Numbers'),
'use_exist' : fields.boolean('Use Exist'),
@@ -244,7 +249,6 @@ class split_in_production_lot(osv.osv_memory):
}
if quantity_rest > 0:
current_move = move_obj.copy(cr, uid, move.id, default_val)
- move_obj.action_confirm(cr, uid, [current_move])
new_move.append(current_move)
if quantity_rest == 0:
current_move = move.id
@@ -258,7 +262,7 @@ class split_in_production_lot(osv.osv_memory):
prodlot_id = prodlot_obj.create(cr, uid, {'name': line.name},
# 'prefix' : line.name},
{'product_id': move.product_id.id})
- move_obj.write(cr, uid, [current_move], {'prodlot_id': prodlot_id})
+ move_obj.write(cr, uid, [current_move], {'prodlot_id': prodlot_id, 'state':move.state})
prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
# ref = '%d' % (move.id)
# if prodlot.ref:
@@ -269,6 +273,7 @@ class split_in_production_lot(osv.osv_memory):
if quantity_rest > 0:
update_val['product_qty'] = quantity_rest
update_val['product_uos_qty'] = uos_qty_rest
+ update_val['state'] = move.state
move_obj.write(cr, uid, [move.id], update_val)
return new_move
split_in_production_lot()
diff --git a/addons/stock/wizard/stock_move_view.xml b/addons/stock/wizard/stock_move_view.xml
index bba27bfe9c7..71626e7d161 100644
--- a/addons/stock/wizard/stock_move_view.xml
+++ b/addons/stock/wizard/stock_move_view.xml
@@ -103,14 +103,24 @@
<field name="model">stock.move.split</field>
<field name="type">form</field>
<field name="arch" type="xml">
- <form string="Split in lots">
- <field name="product_id" colspan="4" readonly="1"/>
- <newline/>
- <field name="use_exist"/>
- <field name="qty" readonly="1"/>
+ <form string="Split in lots">
+ <field name="product_id" colspan="4" readonly="1"/>
+ <newline/>
+ <group colspan="4" col="4">
+ <group colspan="1" col="2">
+ <field name="use_exist"/>
+ </group>
+ <group colspan="1" col="2">
+ <field name="qty" readonly="1"/>
+ </group>
+ <group colspan="1" col="2">
+ <field name="product_uom" readonly="1"/>
+ </group>
+ </group>
+
<group colspan="4" attrs="{'invisible':[('use_exist','=',True)]}">
<field name="line_ids" colspan="4" nolabel="1">
- <tree string="Lots Number" editable="top">
+ <tree string="Lots Number" editable="bottom">
<field name="name" string="Lots"/>
<field name="quantity" />
</tree>
@@ -122,7 +132,7 @@
</group>
<group colspan="4" attrs="{'invisible':[('use_exist','!=',True)]}">
<field name="line_exist_ids" colspan="4" nolabel="1">
- <tree string="Lots Number" editable="top">
+ <tree string="Lots Number" editable="bottom">
<field name="prodlot_id" string="Lots" domain="[('product_id','=',parent.product_id)]"/>
<field name="quantity" />
</tree>
diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py
index 1326050dd7d..c81e8bbf2eb 100644
--- a/addons/stock/wizard/stock_partial_picking.py
+++ b/addons/stock/wizard/stock_partial_picking.py
@@ -30,9 +30,6 @@ class stock_partial_picking(osv.osv_memory):
_description = "Partial Picking"
_columns = {
'date': fields.datetime('Date', required=True),
- 'partner_id': fields.many2one('res.partner',string="Partner", required=True),
- 'address_id': fields.many2one('res.partner.address', 'Delivery Address', help="Address where goods are to be delivered", required=True),
- 'type': fields.char("Type", size=3),
}
def view_init(self, cr, uid, fields_list, context=None):
@@ -66,12 +63,6 @@ class stock_partial_picking(osv.osv_memory):
_moves_arch_lst = """<form string="Deliver Products">
<separator colspan="4" string="Delivery Information"/>
<field name="date" colspan="4" />
- <group colspan="4" attrs="{'invisible':[('type','=','in')]}">
- <field name="partner_id" attrs="{'required':[('type','!=','in')]}" />
- <field name="address_id" attrs="{'required':[('type','!=','in')]}"/>
- <field name="type" invisible="1"/>
- <newline/>
- </group>
<separator colspan="4" string="Move Detail"/>
"""
_moves_fields = result['fields']
@@ -160,30 +151,9 @@ class stock_partial_picking(osv.osv_memory):
if 'date' in fields:
res.update({'date': time.strftime('%Y-%m-%d %H:%M:%S')})
for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
- if 'partner_id' in fields:
- res.update({'partner_id': pick.address_id.partner_id and pick.address_id.partner_id.id or False })
- if 'address_id' in fields:
- res.update({'address_id': pick.address_id.id})
for m in pick.move_lines:
if m.state in ('done', 'cancel'):
continue
- res['type'] = m.picking_id and m.picking_id.type or ''
- address_ids = list(set([(pick.address_id and pick.address_id.id, pick.address_id and pick.address_id.partner_id and pick.address_id.partner_id.id) for pick in pick_obj.browse(cr, uid, context.get('active_ids', []))]))
- address_ids1 = list(set([(pick.address_id and pick.address_id.id, pick.address_id and pick.address_id.partner_id and pick.address_id.partner_id.id) for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])) if pick.address_id]))
- if len(address_ids1) == 1:
- if m.picking_id and m.picking_id.type=='out':
- res['address_id'] = address_ids[0] and address_ids[0][0] or False
- res['partner_id'] = address_ids[0][1] or False
- if m.picking_id and m.picking_id.type=='in':
- res['partner_id'] = m.company_id.partner_id.id or False
- partner_company = m.company_id.partner_id and m.company_id.partner_id
- if partner_company:
- address_default = [add.id for add in m.company_id.partner_id.address if add.type=='default']
- address_delivery = [add.id for add in m.company_id.partner_id.address if add.type=='delivery']
- if len(address_delivery):
- res['address_id'] = address_delivery and address_delivery[0] or False
- else:
- res['address_id'] = address_default and address_default[0] or False
if 'move%s_product_id'%(m.id) in fields:
res['move%s_product_id'%(m.id)] = m.product_id.id
if 'move%s_product_qty'%(m.id) in fields:
@@ -223,8 +193,6 @@ class stock_partial_picking(osv.osv_memory):
picking_ids = context.get('active_ids', False)
partial = self.browse(cr, uid, ids[0], context)
partial_datas = {
- 'partner_id' : partial.partner_id and partial.partner_id.id or False,
- 'address_id' : partial.address_id and partial.address_id.id or False,
'delivery_date' : partial.date
}
for pick in pick_obj.browse(cr, uid, picking_ids):
diff --git a/addons/stock/wizard/stock_splitinto.py b/addons/stock/wizard/stock_splitinto.py
new file mode 100644
index 00000000000..9c01f380247
--- /dev/null
+++ b/addons/stock/wizard/stock_splitinto.py
@@ -0,0 +1,84 @@
+# -*- 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 _
+
+
+class stock_split_into(osv.osv_memory):
+ _name = "stock.split.into"
+ _description = "Split into"
+
+ def default_get(self, cr, uid, fields, context=None):
+ """ Get default values
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param fields: List of fields for default value
+ @param context: A standard dictionary
+ @return: Default values of fields
+ """
+ res = super(stock_split_into, self).default_get(cr, uid, fields, context=context)
+ move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
+ if 'quantity' in fields:
+ res.update({'quantity': move.product_qty})
+ return res
+
+ _columns = {
+ 'quantity': fields.integer('Quantity'),
+ }
+ _defaults = {
+ 'quantity': lambda *x: 1,
+ }
+
+ def split(self, cr, uid, data, context=None):
+ rec_id = context and context.get('active_ids', False)
+ move_obj = self.pool.get('stock.move')
+ new_move = []
+ update_val = {}
+ value_to_split = self.browse(cr, uid, data[0], context)
+ quantity = value_to_split.quantity or 0.0
+ ir_sequence_obj = self.pool.get('ir.sequence')
+ track_obj = self.pool.get('stock.tracking')
+ for move in move_obj.browse(cr, uid, rec_id):
+ move_qty = move.product_qty
+ uos_qty_rest = move.product_uos_qty
+ quantity_rest = move_qty - quantity
+ if (quantity_rest == 0) or (quantity <= 0) :
+ continue
+ sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.tracking')
+ tracking_id = track_obj.create(cr, uid, {'name': sequence}, {'product_id': move.product_id.id})
+ uos_qty = quantity / move_qty * move.product_uos_qty
+ uos_qty_rest = quantity_rest / move_qty * move.product_uos_qty
+ default_val = {
+ 'product_qty': quantity_rest,
+ 'product_uos_qty': uos_qty,
+ 'state': move.state
+ }
+ current_move = move_obj.copy(cr, uid, move.id, default_val)
+ new_move.append(current_move)
+ update_val['product_qty'] = quantity
+ update_val['tracking_id'] = tracking_id
+ update_val['product_uos_qty'] = uos_qty_rest
+ move_obj.write(cr, uid, [move.id], update_val)
+ return {}
+stock_split_into()
+
diff --git a/addons/stock/wizard/stock_splitinto_view.xml b/addons/stock/wizard/stock_splitinto_view.xml
new file mode 100644
index 00000000000..50555eea926
--- /dev/null
+++ b/addons/stock/wizard/stock_splitinto_view.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="view_stock_move_split_wizard" model="ir.ui.view">
+ <field name="name">Split move</field>
+ <field name="model">stock.split.into</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Split Move">
+ <separator string="Set quantity to split your palets" colspan="4"/>
+ <field name="quantity"/>
+ <button icon='gtk-cancel' special="cancel"
+ string="Cancel" />
+ <button name="split" string="Ok"
+ type="object" icon="gtk-ok" />
+ </form>
+ </field>
+ </record>
+
+ <record id="split_into" model="ir.actions.act_window">
+ <field name="name">Split into</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">stock.split.into</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ </record>
+
+ </data>
+</openerp>