diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py
index 7e7d31975e5..35b3ed481e9 100644
--- a/addons/delivery/delivery.py
+++ b/addons/delivery/delivery.py
@@ -28,6 +28,17 @@ class delivery_carrier(osv.osv):
_name = "delivery.carrier"
_description = "Carrier and delivery grids"
+ def name_get(self, cr, uid, ids, context={}):
+ if not len(ids):
+ return []
+ order_id = context.get('order_id',False)
+ if not order_id:
+ res = super(delivery_carrier, self).name_get(cr, uid, ids, context=context)
+ else:
+ order = self.pool.get('sale.order').browse(cr, uid, [order_id])[0]
+ currency = order.pricelist_id.currency_id.name or ''
+ res = [(r['id'], r['name']+' ('+(str(r['price']))+' '+currency+')') for r in self.read(cr, uid, ids, ['name', 'price'], context)]
+ return res
def get_price(self, cr, uid, ids, field_name, arg=None, context={}):
res={}
sale_obj=self.pool.get('sale.order')
@@ -94,9 +105,7 @@ class delivery_grid(osv.osv):
}
_order = 'sequence'
-
def get_price(self, cr, uid, id, order, dt, context):
-
total = 0
weight = 0
volume = 0
@@ -112,7 +121,6 @@ class delivery_grid(osv.osv):
def get_price_from_picking(self, cr, uid, id, total, weight, volume, context={}):
grid = self.browse(cr, uid, id, context)
-
price = 0.0
ok = False
diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml
index 16f4a61ed1e..f14d45c79de 100644
--- a/addons/delivery/delivery_view.xml
+++ b/addons/delivery/delivery_view.xml
@@ -289,5 +289,16 @@
+
+ sale.order.multicompany
+ sale.order
+
+
+
+
+
+
+
+
diff --git a/addons/delivery/wizard/delivery_sale_order.py b/addons/delivery/wizard/delivery_sale_order.py
index efc82ae4141..5f066b23bb0 100644
--- a/addons/delivery/wizard/delivery_sale_order.py
+++ b/addons/delivery/wizard/delivery_sale_order.py
@@ -50,7 +50,11 @@ class make_delivery(osv.osv_memory):
res = super(make_delivery, self).default_get(cr, uid, fields, context=context)
order_obj = self.pool.get('sale.order')
for order in order_obj.browse(cr, uid, context.get('active_ids', [])):
- res.update({'carrier_id': order.partner_id.property_delivery_carrier.id})
+ carrier = order.carrier_id.id
+ if not carrier:
+ carrier = order.partner_id.property_delivery_carrier.id
+ res.update({'carrier_id': carrier})
+
return res
def view_init(self, cr , uid , fields, context=None):
diff --git a/addons/delivery/wizard/delivery_sale_order_view.xml b/addons/delivery/wizard/delivery_sale_order_view.xml
index c2609bc3923..6ac0883493f 100644
--- a/addons/delivery/wizard/delivery_sale_order_view.xml
+++ b/addons/delivery/wizard/delivery_sale_order_view.xml
@@ -11,26 +11,28 @@
+
+
+ Delivery Costs
+ ir.actions.act_window
+ delivery.sale.order
+ form
+ form
+
+ new
+
-
-
-
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 0c5a1252d59..7433520234e 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -188,7 +188,7 @@
-
+
diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py
index d1ab1f2b577..20e0d30d8fb 100644
--- a/addons/stock/__openerp__.py
+++ b/addons/stock/__openerp__.py
@@ -62,6 +62,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
"product_data.xml",
"product_view.xml",
"partner_view.xml",
+ "report/report_stock_move_view.xml",
"report/report_stock_view.xml",
"report/report_stock_picking_view.xml",
"security/stock_security.xml",
diff --git a/addons/stock/report/__init__.py b/addons/stock/report/__init__.py
index 6e0bc044d3e..6b7f36a69fc 100644
--- a/addons/stock/report/__init__.py
+++ b/addons/stock/report/__init__.py
@@ -28,6 +28,7 @@ import lot_overview
import lot_overview_all
import report_stock
import report_stock_picking
+import report_stock_move
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/report/report_stock_move.py b/addons/stock/report/report_stock_move.py
new file mode 100755
index 00000000000..b5388b336e6
--- /dev/null
+++ b/addons/stock/report/report_stock_move.py
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import tools
+from osv import fields,osv
+
+
+class report_stock_move(osv.osv):
+ _name = "report.stock.move"
+ _description = "Stock Statistics"
+ _auto = False
+ _columns = {
+ 'date': fields.date('Date', readonly=True),
+ 'year': fields.char('Year', size=4, readonly=True),
+ 'day': fields.char('Day', size=128, readonly=True),
+ 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
+ ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
+ ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
+ 'product_id':fields.many2one('product.product', 'Product', readonly=True),
+ 'location_id':fields.many2one('stock.location', 'Location', readonly=True),
+ 'product_qty':fields.integer('Qty',readonly=True),
+ 'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
+ help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
+ \nThe state is \'Waiting\' if the move is waiting for another one.'),
+
+ }
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'report_stock_move')
+ cr.execute("""
+ create or replace view report_stock_move as (
+ select min(m.id) as id,
+ m.date as date,
+ to_char(date_trunc('day',m.date), 'YYYY') as year,
+ to_char(date_trunc('day',m.date), 'MM') as month,
+ to_char(date_trunc('day',m.date), 'YYYY-MM-DD') as day,
+ m.location_id as location_id,
+ m.product_id as product_id,
+ m.state as state,
+ sum(m.product_qty) as product_qty
+ from stock_move as m group by m.product_id, m.location_id, m.id, m.date, m.state
+ )
+ """)
+report_stock_move()
diff --git a/addons/stock/report/report_stock_move_view.xml b/addons/stock/report/report_stock_move_view.xml
new file mode 100755
index 00000000000..79657da0fc7
--- /dev/null
+++ b/addons/stock/report/report_stock_move_view.xml
@@ -0,0 +1,106 @@
+
+
+
+
+ report.stock.move.tree
+ report.stock.move
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ report.stock.move.graph
+ report.stock.move
+ graph
+
+
+
+
+
+
+
+
+
+ report.stock.move.search
+ report.stock.move
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Stock Moves
+ report.stock.move
+ form
+ tree,graph
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file