diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000000..bb03d08a82 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +ignore=E123,E124,E126,E128,W503 diff --git a/__init__.py b/__init__.py index 1b6c17a14f..eaf8a1dcb7 100644 --- a/__init__.py +++ b/__init__.py @@ -2,14 +2,14 @@ # this repository contains the full copyright notices and license terms. from trytond.pool import Pool -from .sale import * +from . import sale def register(): Pool.register( - SalePromotion, - SalePromotion_Product, - SalePromotion_ProductCategory, - Sale, - SaleLine, + sale.Promotion, + sale.Promotion_Product, + sale.Promotion_ProductCategory, + sale.Sale, + sale.Line, module='sale_promotion', type_='model') diff --git a/sale.py b/sale.py index 043758ec5e..11459abd74 100644 --- a/sale.py +++ b/sale.py @@ -16,9 +16,6 @@ from trytond.tools import decistmt from trytond.modules.product import price_digits from .exceptions import FormulaError -__all__ = ['Sale', 'SaleLine', - 'SalePromotion', 'SalePromotion_Product', 'SalePromotion_ProductCategory'] - class Sale(metaclass=PoolMeta): __name__ = 'sale.sale' @@ -70,7 +67,7 @@ class Sale(metaclass=PoolMeta): promotion.apply(self) -class SaleLine(metaclass=PoolMeta): +class Line(metaclass=PoolMeta): __name__ = 'sale.line' draft_unit_price = fields.Numeric('Draft Unit Price', @@ -82,7 +79,7 @@ class SaleLine(metaclass=PoolMeta): ]) -class SalePromotion( +class Promotion( DeactivableMixin, ModelSQL, ModelView, MatchMixin): 'Sale Promotion' __name__ = 'sale.promotion' @@ -149,7 +146,7 @@ class SalePromotion( @classmethod def validate(cls, promotions): - super(SalePromotion, cls).validate(promotions) + super().validate(promotions) for promotion in promotions: promotion.check_formula() @@ -215,7 +212,7 @@ class SalePromotion( pattern = pattern.copy() if self.quantity > pattern.pop('quantity'): return False - return super(SalePromotion, self).match(pattern) + return super().match(pattern) def is_valid_sale_line(self, line): @@ -278,7 +275,7 @@ class SalePromotion( return max(simple_eval(decistmt(self.formula), **context), Decimal(0)) -class SalePromotion_Product(ModelSQL): +class Promotion_Product(ModelSQL): 'Sale Promotion - Product' __name__ = 'sale.promotion-product.product' @@ -288,7 +285,7 @@ class SalePromotion_Product(ModelSQL): required=True, ondelete='CASCADE') -class SalePromotion_ProductCategory(ModelSQL): +class Promotion_ProductCategory(ModelSQL): "Sale Promotion - Product Category" __name__ = 'sale.promotion-product.category' diff --git a/setup.py b/setup.py index 2b5218d28d..f647ce08c0 100755 --- a/setup.py +++ b/setup.py @@ -79,8 +79,8 @@ setup(name=name, keywords='tryton sale promotion', package_dir={'trytond.modules.sale_promotion': '.'}, packages=( - ['trytond.modules.sale_promotion'] + - ['trytond.modules.sale_promotion.%s' % p for p in find_packages()] + ['trytond.modules.sale_promotion'] + + ['trytond.modules.sale_promotion.%s' % p for p in find_packages()] ), package_data={ 'trytond.modules.sale_promotion': (info.get('xml', []) @@ -93,7 +93,8 @@ setup(name=name, 'Intended Audience :: Developers', 'Intended Audience :: Financial and Insurance Industry', 'Intended Audience :: Legal Industry', - 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', + 'License :: OSI Approved :: ' + 'GNU General Public License v3 or later (GPLv3+)', 'Natural Language :: Bulgarian', 'Natural Language :: Catalan', 'Natural Language :: Chinese (Simplified)',