Use Null constant from python-sql for comparisons
issue4143 review13701003
This commit is contained in:
1 parent
8d88268e3a
commit
55648dada1
4 files changed
+13
-9
No files matched your search
+4
-3
@@ -1,7 +1,8 @@
|
||||
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
import datetime
|
||||
from sql import Literal
|
||||
|
||||
from sql import Literal, Null
|
||||
from sql.aggregate import Count
|
||||
|
||||
from trytond.model import ModelView, ModelSQL, MatchMixin, fields
|
||||
@@ -212,7 +213,7 @@ class ProductSupplier(ModelSQL, ModelView, MatchMixin):
|
||||
@staticmethod
|
||||
def order_sequence(tables):
|
||||
table, _ = tables[None]
|
||||
return [table.sequence == None, table.sequence]
|
||||
return [table.sequence == Null, table.sequence]
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
@@ -316,7 +317,7 @@ class ProductSupplierPrice(ModelSQL, ModelView, MatchMixin):
|
||||
@staticmethod
|
||||
def order_sequence(tables):
|
||||
table, _ = tables[None]
|
||||
return [table.sequence == None, table.sequence]
|
||||
return [table.sequence == Null, table.sequence]
|
||||
|
||||
@staticmethod
|
||||
def default_quantity():
|
||||
|
||||
+5
-4
@@ -3,7 +3,8 @@
|
||||
import datetime
|
||||
from itertools import chain
|
||||
from decimal import Decimal
|
||||
from sql import Table, Literal
|
||||
|
||||
from sql import Table, Literal, Null
|
||||
from sql.functions import Overlay, Position
|
||||
from sql.aggregate import Count
|
||||
from sql.operators import Concat
|
||||
@@ -288,8 +289,8 @@ class Purchase(Workflow, ModelSQL, ModelView):
|
||||
purchase_line.id))
|
||||
).select(sql_table.id,
|
||||
where=((sql_table.state == 'confirmed')
|
||||
& ((invoice_line.id != None)
|
||||
| (move.id != None))))
|
||||
& ((invoice_line.id != Null)
|
||||
| (move.id != Null))))
|
||||
cursor.execute(*sql_table.update(
|
||||
columns=[sql_table.state],
|
||||
values=['processing'],
|
||||
@@ -1011,7 +1012,7 @@ class PurchaseLine(ModelSQL, ModelView):
|
||||
@staticmethod
|
||||
def order_sequence(tables):
|
||||
table, _ = tables[None]
|
||||
return [table.sequence == None, table.sequence]
|
||||
return [table.sequence == Null, table.sequence]
|
||||
|
||||
@staticmethod
|
||||
def default_type():
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
import datetime
|
||||
|
||||
from sql import Null
|
||||
from sql.operators import Concat
|
||||
|
||||
from trytond.model import Workflow, ModelView, fields
|
||||
@@ -190,7 +192,7 @@ class Move:
|
||||
cursor.execute(*sql_table.update(
|
||||
columns=[sql_table.origin],
|
||||
values=[Concat('purchase.line,', sql_table.purchase_line)],
|
||||
where=sql_table.purchase_line != None))
|
||||
where=sql_table.purchase_line != Null))
|
||||
table.drop_column('purchase_line')
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in new issue
Block a user