summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarshad Modi <hmo@tinyerp.com>2008-10-14 18:53:55 +0530
committerHarshad Modi <hmo@tinyerp.com>2008-10-14 18:53:55 +0530
commit8d7ab9b8f0a58896dba3f82308f0c838dbd52154 (patch)
tree42bcf57dc6562537d2dd8145222ffb061a7d1862
parentd3d6b67054f0c7ae5e52142c8f496465d036e6ab (diff)
* fixed bug on partial packing
* put date fileration on product_margin function on product_margin module bzr revid: hmo@tinyerp.com-20081014132355-z3tkd6n7bjvh9tgo
-rw-r--r--addons/document/document.py8
-rw-r--r--addons/product_margin/product_margin.py4
-rw-r--r--addons/stock/stock.py21
3 files changed, 20 insertions, 13 deletions
diff --git a/addons/document/document.py b/addons/document/document.py
index dfcdffd1431..d7904d31285 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -1,7 +1,9 @@
-#############################################################################
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
-# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers <fp@tiny.Be>
+# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
diff --git a/addons/product_margin/product_margin.py b/addons/product_margin/product_margin.py
index 484204c4c86..260dbc40665 100644
--- a/addons/product_margin/product_margin.py
+++ b/addons/product_margin/product_margin.py
@@ -76,8 +76,8 @@ class product_product(osv.osv):
from account_invoice_line l
left join account_invoice i on (l.invoice_id = i.id)
left join product_template product on (product.id=l.product_id)
- where l.product_id = %s and i.state in ('%s') and i.type in ('%s')
- """%(val.id,"','".join(states),"','".join(invoice_types))
+ where l.product_id = %s and i.state in ('%s') and i.type in ('%s') and i.date_invoice>='%s' and i.date_invoice<='%s'
+ """%(val.id,"','".join(states),"','".join(invoice_types),date_from,date_to)
cr.execute(sql)
result=cr.fetchall()[0]
if 'sale_avg_price' in field_names or 'sale_num_invoiced' in field_names or 'turnover' in field_names or 'sale_expected' in field_names:
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index f0c71c1199f..32b4f6bf57d 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -323,11 +323,14 @@ class stock_picking(osv.osv):
if isinstance(ids, (int, long)):
ids=[ids]
for pick in self.browse(cr, uid, ids, context):
- cr.execute("""update stock_move set
- date_planned=%s
+ sql_str="""update stock_move set
+ date_planned='%s'
where
- picking_id=%d and
- (date_planned=%s or date_planned>%s)""", (value,pick.id,pick.max_date,value))
+ picking_id=%d """ % (value,pick.id)
+
+ if pick.max_date:
+ sql_str += " and (date_planned='"+pick.max_date+"' or date_planned>'"+value+"')"
+ cr.execute(sql_str)
return True
def _set_minimum_date(self, cr, uid, ids, name, value, arg, context):
@@ -335,11 +338,13 @@ class stock_picking(osv.osv):
if isinstance(ids, (int, long)):
ids=[ids]
for pick in self.browse(cr, uid, ids, context):
- cr.execute("""update stock_move set
- date_planned=%s
+ sql_str="""update stock_move set
+ date_planned='%s'
where
- picking_id=%d and
- (date_planned=%s or date_planned<%s)""", (value,pick.id,pick.min_date,value))
+ picking_id=%d """ % (value,pick.id)
+ if pick.min_date:
+ sql_str += " and (date_planned='"+pick.min_date+"' or date_planned<'"+value+"')"
+ cr.execute(sql_str)
return True
def get_min_max_date(self, cr, uid, ids, field_name, arg, context={}):