diff --git a/addons/sale_delivery_report/report/shipping.rml b/addons/sale_delivery_report/report/shipping.rml
index 7b02c71c7f8..30061c03352 100644
--- a/addons/sale_delivery_report/report/shipping.rml
+++ b/addons/sale_delivery_report/report/shipping.rml
@@ -161,7 +161,7 @@
[[ o.sale_id and o.sale_id.name ]]
- [[ o.sale_id and o.sale_id.date_order ]]
+ [[ o.sale_id and formatLang(o.sale_id.date_order,date_time = True) ]]
|
[[ formatLang(o.min_date,date_time = True) ]]
diff --git a/addons/stock/report/__init__.py b/addons/stock/report/__init__.py
index 9bddb1854ff..f69fc033c45 100644
--- a/addons/stock/report/__init__.py
+++ b/addons/stock/report/__init__.py
@@ -25,6 +25,8 @@ import product_stock
import lot_location
import ups
import picking
+import lot_overview
+import lot_overview_all
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/report/lot_location.py b/addons/stock/report/lot_location.py
index 931ddd909c9..e20f89bb81f 100644
--- a/addons/stock/report/lot_location.py
+++ b/addons/stock/report/lot_location.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
-# OpenERP, Open Source Management Solution
+# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
# $Id$
#
@@ -26,33 +26,23 @@ from report import report_sxw
class lot_location(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(lot_location, self).__init__(cr, uid, name, context)
+ self.grand_total = 0.0
+
self.localcontext.update({
'time': time,
'process':self.process,
+ 'qty_total':self._qty_total,
})
def process(self,location_id):
- res = {}
location_obj = pooler.get_pool(self.cr.dbname).get('stock.location')
- product_obj = pooler.get_pool(self.cr.dbname).get('product.product')
+ data = location_obj._product_get_report(self.cr,self.uid, [location_id])
+ data['location_name'] = location_obj.read(self.cr, self.uid, [location_id],['name'])[0]['name']
+ self.grand_total += data['total']
+ return [data]
- res['location_name'] = pooler.get_pool(self.cr.dbname).get('stock.location').read(self.cr, self.uid, [location_id],['name'])[0]['name']
-
- prod_info = location_obj._product_get(self.cr, self.uid, location_id)
-
- res['product'] = []
- for prod in product_obj.browse(self.cr, self.uid, prod_info.keys()):
- if prod_info[prod.id]:
- res['product'].append({'prod_name': prod.name, 'prod_qty': prod_info[prod.id]})
- if not res['product']:
- res['product'].append({'prod_name': '', 'prod_qty': ''})
- location_child = location_obj.read(self.cr, self.uid, [location_id], ['child_ids'])
- list=[]
- list.append(res)
- for child_id in location_child[0]['child_ids']:
- list.extend(self.process(child_id))
-
- return list
+ def _qty_total(self):
+ return str( self.grand_total)
report_sxw.report_sxw('report.lot.location', 'stock.location', 'addons/stock/report/lot_location.rml', parser=lot_location)
diff --git a/addons/stock/report/lot_location.rml b/addons/stock/report/lot_location.rml
index abf27ec97e6..a075637955f 100644
--- a/addons/stock/report/lot_location.rml
+++ b/addons/stock/report/lot_location.rml
@@ -1,3 +1,118 @@
- | Location | Product | Quantity | [[ repeatIn(objects,'o') ]][[ repeatIn(process(o.id),'ob') ]][[ ob ['location_name'] ]]| | [[ repeatIn(ob['product'], 'p') ]][[ p['prod_name'] ]] | [[ p['prod_qty'] ]] |
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Location |
+ Product |
+ Quantity |
+
+
+ [[ repeatIn(objects,'o') ]]
+
+ [[ repeatIn(process(o.id),'ob') ]]
+
+
+ | [[ ob['location_name'] ]] |
+ [[ ob['product'] or 'No products in this Location !' ]] |
+ |
+ |
+
+
+ | [[ repeatIn(ob['product'], 'p') ]] |
+ [[ p['prod_name'] ]] |
+ [[ p['prod_qty'] ]] |
+ [[ p['uom'] ]] |
+
+
+
+
+ |
+ Total : |
+ [[ ob['total'] ]] |
+ Units |
+
+
+ |
+ |
+ |
+ |
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+ | Grand Total: |
+ |
+ [[ qty_total() ]] |
+ Units |
+
+
+
+
diff --git a/addons/stock/report/lot_overview.py b/addons/stock/report/lot_overview.py
new file mode 100644
index 00000000000..3ecd26476df
--- /dev/null
+++ b/addons/stock/report/lot_overview.py
@@ -0,0 +1,57 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import pooler
+import time
+from report import report_sxw
+
+class lot_overview(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(lot_overview, self).__init__(cr, uid, name, context)
+ self.price_total = 0.0
+ self.grand_total = 0.0
+ self.localcontext.update({
+ 'time': time,
+ 'process':self.process,
+ 'price_total': self._price_total,
+ 'grand_total_price':self._grand_total,
+ })
+
+ def process(self,location_id):
+ location_obj = pooler.get_pool(self.cr.dbname).get('stock.location')
+ data = location_obj._product_get_report(self.cr,self.uid, [location_id])
+ data['location_name'] = location_obj.read(self.cr, self.uid, [location_id],['name'])[0]['name']
+ self.price_total = 0.0
+ self.price_total += data['total_price']
+ self.grand_total += data['total_price']
+ return [data]
+
+ def _price_total(self):
+ return str( self.price_total)
+
+ def _grand_total(self):
+ return str( self.grand_total)
+
+report_sxw.report_sxw('report.lot.stock.overview', 'stock.location', 'addons/stock/report/lot_overview.rml', parser=lot_overview)
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/stock/report/lot_overview.rml b/addons/stock/report/lot_overview.rml
new file mode 100644
index 00000000000..65c48fa43c1
--- /dev/null
+++ b/addons/stock/report/lot_overview.rml
@@ -0,0 +1,135 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Location |
+ Product |
+ Variants |
+ Quantity |
+ UoM |
+ Unit Price |
+ Value |
+
+
+ [[ repeatIn(objects,'o') ]]
+
+ [[ repeatIn(process(o.id),'ob') ]]
+
+
+ | [[ ob['location_name'] ]] |
+ [[ ob['product'] or 'No products in this Location !' ]] |
+ |
+ |
+ |
+ |
+ |
+
+
+ | [[ repeatIn(ob['product'],'p') ]] |
+ [[ p['prod_name'] ]] |
+ [[ p['variants'] ]] |
+ [[ p['prod_qty'] ]] |
+ [[ p['uom'] ]] |
+ [[ p['price'] ]] |
+ [[ p['price_value'] ]] |
+
+
+
+
+ |
+ Total: |
+ |
+ |
+ |
+ |
+ [[ price_total() ]] |
+
+
+
+
+
+
+
+
+
+
+ | Grand Total: |
+ |
+ |
+ |
+ |
+ |
+ [[ grand_total_price() ]] |
+
+
+
+
diff --git a/addons/stock/report/lot_overview.xml b/addons/stock/report/lot_overview.xml
deleted file mode 100644
index 4fa56808938..00000000000
--- a/addons/stock/report/lot_overview.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/stock/report/lot_overview.xsl b/addons/stock/report/lot_overview.xsl
deleted file mode 100644
index 0244bcaa609..00000000000
--- a/addons/stock/report/lot_overview.xsl
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | Product | Variants | Amount | UoM | Unit Price | Value |
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/addons/stock/report/lot_overview_all.py b/addons/stock/report/lot_overview_all.py
new file mode 100644
index 00000000000..2f349d9bd93
--- /dev/null
+++ b/addons/stock/report/lot_overview_all.py
@@ -0,0 +1,57 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import pooler
+import time
+from report import report_sxw
+
+class lot_overview_all(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(lot_overview_all, self).__init__(cr, uid, name, context)
+ self.price_total = 0.0
+ self.grand_total = 0.0
+ self.localcontext.update({
+ 'time': time,
+ 'process':self.process,
+ 'price_total': self._price_total,
+ 'grand_total_price':self._grand_total,
+ })
+
+ def process(self,location_id):
+ location_obj = pooler.get_pool(self.cr.dbname).get('stock.location')
+ data = location_obj._product_get_all_report(self.cr,self.uid, [location_id])
+ data['location_name'] = location_obj.read(self.cr, self.uid, [location_id],['name'])[0]['name']
+ self.price_total = 0.0
+ self.price_total += data['total_price']
+ self.grand_total += data['total_price']
+ return [data]
+
+ def _price_total(self):
+ return str( self.price_total)
+
+ def _grand_total(self):
+ return str( self.grand_total)
+
+report_sxw.report_sxw('report.lot.stock.overview_all', 'stock.location', 'addons/stock/report/lot_overview_all.rml', parser=lot_overview_all)
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/stock/report/lot_overview_all.rml b/addons/stock/report/lot_overview_all.rml
new file mode 100644
index 00000000000..e848ba89f6a
--- /dev/null
+++ b/addons/stock/report/lot_overview_all.rml
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Location |
+ Code |
+ Product |
+ Variants |
+ Amount |
+ UoM |
+ UnitPrice |
+ Value |
+
+
+ [[repeatIn(objects,'o')]]
+
+ [[ repeatIn(process(o.id),'ob') ]]
+
+
+ | [[ ob['location_name'] ]] |
+ |
+ [[ ob['product'] or 'No products in this Location' ]] |
+ |
+ |
+ |
+ |
+ |
+
+
+ | [[ repeatIn(ob['product'],'p') ]] |
+ [[ p['code'] ]] |
+ [[ p['prod_name'] ]] |
+ [[ p['variants'] ]] |
+ [[ p['prod_qty'] ]] |
+ [[ p['uom'] ]] |
+ [[ p['price'] ]] |
+ [[ p['price_value'] ]] |
+
+
+
+
+
+
+
+ |
+ Total: |
+ |
+ |
+ |
+ |
+ |
+ [[ price_total() ]] |
+
+
+
+
+
+
+
+
+ | Grand Total: |
+ |
+ |
+ |
+ |
+ |
+ |
+ [[ grand_total_price() ]] |
+
+
+
+
diff --git a/addons/stock/report/lot_overview_all.xml b/addons/stock/report/lot_overview_all.xml
deleted file mode 100644
index a7c19977499..00000000000
--- a/addons/stock/report/lot_overview_all.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/stock/report/lot_overview_all.xsl b/addons/stock/report/lot_overview_all.xsl
deleted file mode 100644
index c78b8f63bfa..00000000000
--- a/addons/stock/report/lot_overview_all.xsl
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | Code | Product | Variants | Amount | UoM | Unit Price | Value |
-
-
-
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/addons/stock/report/picking.rml b/addons/stock/report/picking.rml
index d9e50d2b5ba..203ccf64fee 100644
--- a/addons/stock/report/picking.rml
+++ b/addons/stock/report/picking.rml
@@ -134,10 +134,10 @@
|
- [[ (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 ]]
- [[ (picking.address_id and picking.address_id.title) or '' ]] [[ (picking.address_id and picking.address_id.name) or '' ]]
- [[ (picking.address_id and picking.address_id.street) or '' ]]
- [[ (picking.address_id and picking.address_id.zip) or '' ]] [[ (picking.address_id and picking.address_id.city) or '' ]] [[ (picking.address_id and picking.address_id.state_id and picking.address_id.state_id.name) or '' ]]
+ [[ (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 ]]
+ [[ (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 '' ]]
+ [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.street) or '' ]]
+ [[ (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 '' ]]
[[ (picking.address_id and picking.address_id.country_id and picking.address_id.country_id.name) or '' ]]
|
@@ -176,7 +176,7 @@
Expected Shipping Date
-
+ weight
|
@@ -186,20 +186,20 @@
[[ picking.origin ]]
- [[ (picking.address_id and picking.address_id.title) or '' ]] [[ (picking.address_id and picking.address_id.name) or '' ]]
+ [[ (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 '' ]]
|
- [[ formatLang(picking.min_date,date_time = True) ]]
+ [[ formatLang(picking.min_date,date_time = True) ]]
|
-
+ [[ formatLang(picking.weight) ]]
|
-
+
|
Description
@@ -218,28 +218,30 @@
|
-
+
+
+
[[ repeatIn([line for line in picking.move_lines if (line.state == 'assigned' )],'move_lines') ]]
-
+
|
[ [[ move_lines.product_id.default_code ]] ] [[ move_lines.product_id.name ]]
|
- [[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]
+ [[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]
|
[[ move_lines.state ]]
|
- [[ move_lines.product_qty ]]
+ [[ formatLang(move_lines.product_qty) ]]
|
[[ move_lines.product_uom.name ]]
|
- [[ (move_lines.location_id and move_lines.location_id.name) or '' ]]
+ [[ (((picking.type == 'out') and move_lines.location_id.name) or ((picking.type == 'in') and move_lines.location_dest_id.name) or ((picking.type == 'internal') and (move_lines.location_id.name + '-' + move_lines.location_dest_id.name)) or '' ) ]]
|
@@ -250,31 +252,31 @@
- Non Assigned Products: [[ (line.state == 'assigned') and removeParentNode('para') ]]
+ Non Assigned Products: [[ ((line.state == 'assigned') or (line.state == 'done')) and removeParentNode('para') ]]
- [[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]]
-
+ [[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]]
+
|
[ [[ move_lines.product_id.default_code ]] ] [[ move_lines.product_id.name ]]
|
- [[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]
+ [[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]
|
[[ move_lines.state ]]
|
- [[ move_lines.product_qty ]]
+ [[ formatLang(move_lines.product_qty) ]]
|
[[ move_lines.product_uom.name ]]
|
- [[ (move_lines.location_id and move_lines.location_id.name) or '' ]]
+ [[ (((picking.type == 'out') and move_lines.location_id.name) or ((picking.type == 'in') and move_lines.location_dest_id.name) or ((picking.type == 'internal') and (move_lines.location_id.name + '-' + move_lines.location_dest_id.name)) or '' ) ]]
|
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 352709ed0a7..dd5f0a89fc9 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -205,8 +205,11 @@ class stock_location(osv.osv):
products_by_id.setdefault(product.id, [])
products_by_id[product.id] = product
- result = []
+ result = {}
+ result['product'] = []
for id in ids:
+ quantity_total = 0.0
+ total_price = 0.0
for uom_id in products_by_uom.keys():
fnc = self._product_get
if recursive:
@@ -219,14 +222,20 @@ class stock_location(osv.osv):
if not qty[product_id]:
continue
product = products_by_id[product_id]
- result.append({
+ quantity_total += qty[product_id]
+ price = qty[product_id] * product.standard_price
+ total_price += price
+ result['product'].append({
'price': product.standard_price,
- 'name': product.name,
+ 'prod_name': product.name,
'code': product.default_code, # used by lot_overview_all report!
'variants': product.variants or '',
'uom': product.uom_id.name,
- 'amount': qty[product_id],
+ 'prod_qty': qty[product_id],
+ 'price_value':price,
})
+ result['total'] = quantity_total
+ result['total_price'] = total_price
return result
def _product_get_multi_location(self, cr, uid, ids, product_ids=False, context={}, states=['done'], what=('in', 'out')):
@@ -791,7 +800,7 @@ class stock_production_lot(osv.osv):
''')
res.update(dict(cr.fetchall()))
return res
-
+
def _stock_search(self, cr, uid, obj, name, args):
locations = self.pool.get('stock.location').search(cr, uid, [('usage','=','internal')])
cr.execute('''select
@@ -803,12 +812,12 @@ class stock_production_lot(osv.osv):
location_id in ('''+','.join(map(str, locations)) +''')
group by
prodlot_id
- having sum(name) ''' + str(args[0][1]) + ''' ''' + str(args[0][2])
+ having sum(name) ''' + str(args[0][1]) + ''' ''' + str(args[0][2])
)
res = cr.fetchall()
ids = [('id','in',map(lambda x:x[0], res))]
return ids
-
+
_columns = {
'name': fields.char('Serial', size=64, required=True),
'ref': fields.char('Internal Ref', size=64),
diff --git a/addons/stock/stock_report.xml b/addons/stock/stock_report.xml
index c5ddcf0ed38..ed71ca90635 100644
--- a/addons/stock/stock_report.xml
+++ b/addons/stock/stock_report.xml
@@ -9,11 +9,11 @@
-
+
-
+