diff --git a/inventory.py b/inventory.py index 4371e129ea..6d1277ddef 100644 --- a/inventory.py +++ b/inventory.py @@ -1,5 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level #of this repository contains the full copyright notices and license terms. +from sql import Null + from trytond.model import Workflow, ModelView, ModelSQL, fields from trytond.pyson import Not, Equal, Eval, Or, Bool from trytond import backend @@ -273,7 +275,7 @@ class InventoryLine(ModelSQL, ModelView): # Migration from 3.0: use Move origin if table.column_exist('move'): cursor.execute(*sql_table.select(sql_table.id, sql_table.move, - where=sql_table.move != None)) + where=sql_table.move != Null)) for line_id, move_id in cursor.fetchall(): cursor.execute(*move_table.update( columns=[move_table.origin], diff --git a/move.py b/move.py index 2eb8151547..5c90c257c3 100644 --- a/move.py +++ b/move.py @@ -4,7 +4,8 @@ import datetime import operator from decimal import Decimal from functools import partial -from sql import Literal, Union, Column + +from sql import Literal, Union, Column, Null from sql.aggregate import Sum from sql.conditionals import Coalesce from sql.operators import Concat @@ -345,7 +346,7 @@ class Move(Workflow, ModelSQL, ModelView): columns=[sql_table.shipment], values=[Concat(model + ',', Column(sql_table, column))], - where=Column(sql_table, column) != None)) + where=Column(sql_table, column) != Null)) table.drop_column(column) # Add index on create_date @@ -889,7 +890,7 @@ class Move(Workflow, ModelSQL, ModelView): context.get('stock_assign') and 'assigned' or 'done']) & ( ( - (move.effective_date == None) + (move.effective_date == Null) & (move.planned_date <= context['stock_date_end']) ) | (move.effective_date <= context['stock_date_end']) @@ -905,7 +906,7 @@ class Move(Workflow, ModelSQL, ModelView): or 'done']) & ( ( - (move.effective_date == None) + (move.effective_date == Null) & (move.planned_date <= today) ) | (move.effective_date <= today) @@ -914,7 +915,7 @@ class Move(Workflow, ModelSQL, ModelView): | (move.state.in_(['done', 'assigned', 'draft']) & ( ( - (move.effective_date == None) + (move.effective_date == Null) & (Coalesce(move.planned_date, datetime.date.max) <= context['stock_date_end']) & (Coalesce(move.planned_date, datetime.date.max) @@ -934,11 +935,11 @@ class Move(Workflow, ModelSQL, ModelView): move.state.in_(['done', 'assigned', 'draft']) & ( ( - (move.effective_date == None) + (move.effective_date == Null) & ( (move.planned_date >= context['stock_date_start']) - | (move.planned_date == None) + | (move.planned_date == Null) ) ) | (move.effective_date >= context['stock_date_start']) @@ -950,10 +951,10 @@ class Move(Workflow, ModelSQL, ModelView): move.state.in_(['done', 'assigned', 'draft']) & ( ( - (move.effective_date == None) + (move.effective_date == Null) & ( (move.planned_date >= today) - | (move.planned_date == None) + | (move.planned_date == Null) ) ) | (move.effective_date >= today) @@ -965,14 +966,14 @@ class Move(Workflow, ModelSQL, ModelView): or 'done']) & ( ( - (move.effective_date == None) + (move.effective_date == Null) & ( ( (move.planned_date >= context['stock_date_start']) & (move.planned_date < today) ) - | (move.planned_date == None) + | (move.planned_date == Null) ) ) | ( diff --git a/product.py b/product.py index f0e8fdfc17..67c166cceb 100644 --- a/product.py +++ b/product.py @@ -2,7 +2,8 @@ #this repository contains the full copyright notices and license terms. import datetime from decimal import Decimal -from sql import Literal + +from sql import Literal, Null from sql.aggregate import Max from sql.functions import Now from sql.conditionals import Coalesce @@ -261,7 +262,7 @@ class ProductQuantitiesByWarehouse(ModelSQL, ModelView): where=(move.product == product_id) & (move.from_location.in_(warehouse_query) | move.to_location.in_(warehouse_query)) - & (Coalesce(move.effective_date, move.planned_date) != None), + & (Coalesce(move.effective_date, move.planned_date) != Null), group_by=(date_column, move.product)) @classmethod diff --git a/setup.py b/setup.py index 433d0313a9..d89c2aa29f 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ if minor_version % 2: 'hg+http://hg.tryton.org/modules/%s#egg=%s-%s' % ( name[8:], name, version)) -requires = ['python-sql'] +requires = ['python-sql >= 0.4'] for dep in info.get('depends', []): if not re.match(r'(ir|res|webdav)(\W|$)', dep): requires.append(get_require_version('trytond_%s' % dep))