From 68eb13ed88bd546af68c4745f7b8aa81eee1e05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 5 Oct 2013 12:17:26 +0200 Subject: [PATCH] Fix flake8 --- location.py | 3 ++- move.py | 10 +++++----- period.py | 10 ++++++---- tests/__init__.py | 2 ++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/location.py b/location.py index 516dd82f75..2d9afdf422 100644 --- a/location.py +++ b/location.py @@ -97,7 +97,8 @@ class Location(ModelSQL, ModelView): cls._order.insert(0, ('name', 'ASC')) cls._error_messages.update({ 'invalid_type_for_moves': ('Location "%s" with existing moves ' - 'cannot be changed to a type that does not support moves.'), + 'cannot be changed to a type that does not support moves.' + ), 'child_of_warehouse': ('Location "%(location)s" must be a ' 'child of warehouse "%(warehouse)s".'), }) diff --git a/move.py b/move.py index 1f30cb07aa..e13b9d1975 100644 --- a/move.py +++ b/move.py @@ -3,7 +3,7 @@ import datetime import operator from decimal import Decimal -from functools import reduce, partial +from functools import partial from sql import Column from sql.operators import Concat @@ -447,9 +447,9 @@ class Move(Workflow, ModelSQL, ModelView): @classmethod def get_shipment(cls): - Model = Pool().get('ir.model') + IrModel = Pool().get('ir.model') models = cls._get_shipment() - models = Model.search([ + models = IrModel.search([ ('model', 'in', models), ]) return [(None, '')] + [(m.model, m.name) for m in models] @@ -461,9 +461,9 @@ class Move(Workflow, ModelSQL, ModelView): @classmethod def get_origin(cls): - Model = Pool().get('ir.model') + IrModel = Pool().get('ir.model') models = cls._get_origin() - models = Model.search([ + models = IrModel.search([ ('model', 'in', models), ]) return [(None, '')] + [(m.model, m.name) for m in models] diff --git a/period.py b/period.py index e48933b049..7ba3eb9cb5 100644 --- a/period.py +++ b/period.py @@ -34,7 +34,8 @@ class Period(Workflow, ModelSQL, ModelView): cls._error_messages.update({ 'close_period_future_today': ('You can not close a period ' 'in the future or today.'), - 'close_period_assigned_move': ('You can not close a period when ' + 'close_period_assigned_move': ( + 'You can not close a period when ' 'there still are assigned moves.'), }) cls._transitions |= set(( @@ -68,13 +69,14 @@ class Period(Workflow, ModelSQL, ModelView): @ModelView.button @Workflow.transition('draft') def draft(cls, periods): + in_max = Transaction().cursor.IN_MAX for grouping in cls.groupings(): Cache = cls.get_cache(grouping) caches = [] - for i in xrange(0, len(periods), Transaction().cursor.IN_MAX): + for i in xrange(0, len(periods), in_max): caches.append(Cache.search([ - ('period', 'in', [p.id for p in - periods[i:i + Transaction().cursor.IN_MAX]]), + ('period', 'in', + [p.id for p in periods[i:i + in_max]]), ], order=[])) Cache.delete(list(chain(*caches))) diff --git a/tests/__init__.py b/tests/__init__.py index dfff549c33..2349560ca6 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -2,3 +2,5 @@ #this repository contains the full copyright notices and license terms. from .test_stock import suite + +__all__ = ['suite']