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 d9ea8c85ed..b826af8772 100644 --- a/__init__.py +++ b/__init__.py @@ -2,36 +2,36 @@ # this repository contains the full copyright notices and license terms. from trytond.pool import Pool -from .sale import * +from . import sale from . import product -from .stock import * -from .configuration import * -from .invoice import * +from . import stock +from . import configuration +from . import invoice from . import party from . import sale_reporting def register(): Pool.register( - Move, - Sale, - SaleIgnoredInvoice, - SaleRecreatedInvoice, - SaleLine, - SaleLineTax, - SaleLineIgnoredMove, - SaleLineRecreatedMove, + stock.Move, + sale.Sale, + sale.SaleIgnoredInvoice, + sale.SaleRecreatedInvoice, + sale.SaleLine, + sale.SaleLineTax, + sale.SaleLineIgnoredMove, + sale.SaleLineRecreatedMove, product.Template, product.Product, product.SaleContext, - ShipmentOut, - ShipmentOutReturn, - HandleShipmentExceptionAsk, - HandleInvoiceExceptionAsk, - ReturnSaleStart, - Configuration, - ConfigurationSequence, - ConfigurationSaleMethod, + stock.ShipmentOut, + stock.ShipmentOutReturn, + sale.HandleShipmentExceptionAsk, + sale.HandleInvoiceExceptionAsk, + sale.ReturnSaleStart, + configuration.Configuration, + configuration.ConfigurationSequence, + configuration.ConfigurationSaleMethod, sale_reporting.Context, sale_reporting.Customer, sale_reporting.CustomerTimeseries, @@ -45,19 +45,19 @@ def register(): sale_reporting.Subdivision, sale_reporting.SubdivisionTimeseries, sale_reporting.Region, - Invoice, - InvoiceLine, + invoice.Invoice, + invoice.Line, module='sale', type_='model') Pool.register( - OpenCustomer, - HandleShipmentException, - HandleInvoiceException, - ReturnSale, - ModifyHeader, - party.PartyReplace, - party.PartyErase, + sale.OpenCustomer, + sale.HandleShipmentException, + sale.HandleInvoiceException, + sale.ReturnSale, + sale.ModifyHeader, + party.Replace, + party.Erase, sale_reporting.OpenRegion, module='sale', type_='wizard') Pool.register( - SaleReport, + sale.SaleReport, module='sale', type_='report') diff --git a/configuration.py b/configuration.py index 1cfd47fa11..5685118d14 100644 --- a/configuration.py +++ b/configuration.py @@ -9,8 +9,6 @@ from trytond.tools.multivalue import migrate_property from trytond.modules.company.model import ( CompanyMultiValueMixin, CompanyValueMixin) -__all__ = ['Configuration', - 'ConfigurationSequence', 'ConfigurationSaleMethod'] sale_invoice_method = fields.Selection( 'get_sale_invoice_methods', "Sale Invoice Method") sale_shipment_method = fields.Selection( diff --git a/invoice.py b/invoice.py index caa76cdb73..1ee2d09539 100644 --- a/invoice.py +++ b/invoice.py @@ -8,8 +8,6 @@ from trytond.model.exceptions import AccessError from trytond.pool import Pool, PoolMeta from trytond.transaction import Transaction -__all__ = ['Invoice', 'InvoiceLine'] - def process_sale(func): @wraps(func) @@ -102,21 +100,21 @@ class Invoice(metaclass=PoolMeta): return super(Invoice, cls).draft(invoices) -class InvoiceLine(metaclass=PoolMeta): +class Line(metaclass=PoolMeta): __name__ = 'account.invoice.line' @property def origin_name(self): pool = Pool() SaleLine = pool.get('sale.line') - name = super(InvoiceLine, self).origin_name + name = super().origin_name if isinstance(self.origin, SaleLine): name = self.origin.sale.rec_name return name @classmethod def _get_origin(cls): - models = super(InvoiceLine, cls)._get_origin() + models = super()._get_origin() models.append('sale.line') return models @@ -128,6 +126,6 @@ class InvoiceLine(metaclass=PoolMeta): invoices = (l.invoice for l in cls.browse(lines) if l.type == 'line' and l.invoice) sales = set(s for i in invoices for s in i.sales) - super(InvoiceLine, cls).delete(lines) + super().delete(lines) if sales: Sale.__queue__.process(sales) diff --git a/party.py b/party.py index 5790afa0f5..ba82115b69 100644 --- a/party.py +++ b/party.py @@ -5,27 +5,25 @@ from trytond.pool import PoolMeta, Pool from trytond.modules.party.exceptions import EraseError -__all__ = ['PartyReplace', 'PartyErase'] - -class PartyReplace(metaclass=PoolMeta): +class Replace(metaclass=PoolMeta): __name__ = 'party.replace' @classmethod def fields_to_replace(cls): - return super(PartyReplace, cls).fields_to_replace() + [ + return super().fields_to_replace() + [ ('sale.sale', 'party'), ('sale.sale', 'shipment_party'), ] -class PartyErase(metaclass=PoolMeta): +class Erase(metaclass=PoolMeta): __name__ = 'party.erase' def check_erase_company(self, party, company): pool = Pool() Sale = pool.get('sale.sale') - super(PartyErase, self).check_erase_company(party, company) + super().check_erase_company(party, company) sales = Sale.search([ ['OR', diff --git a/sale_reporting.py b/sale_reporting.py index 9d64dc7458..beb762c401 100644 --- a/sale_reporting.py +++ b/sale_reporting.py @@ -20,14 +20,6 @@ from trytond.pyson import Eval, If from trytond.wizard import Wizard, StateTransition, StateAction from trytond.i18n import lazy_gettext -__all__ = ['Context', - 'Customer', 'CustomerTimeseries', - 'Product', 'ProductTimeseries', - 'Category', 'CategoryTimeseries', 'CategoryTree', - 'Country', 'CountryTimeseries', - 'Subdivision', 'SubdivisionTimeseries', - 'Region', 'OpenRegion'] - def pairwise(iterable): a, b = tee(iterable) diff --git a/setup.py b/setup.py index bccb59fb9a..5d3c64262c 100755 --- a/setup.py +++ b/setup.py @@ -79,8 +79,8 @@ setup(name=name, keywords='tryton sale', package_dir={'trytond.modules.sale': '.'}, packages=( - ['trytond.modules.sale'] + - ['trytond.modules.sale.%s' % p for p in find_packages()] + ['trytond.modules.sale'] + + ['trytond.modules.sale.%s' % p for p in find_packages()] ), package_data={ 'trytond.modules.sale': (info.get('xml', []) @@ -94,7 +94,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)', diff --git a/stock.py b/stock.py index 8d34c306f4..226f94f19f 100644 --- a/stock.py +++ b/stock.py @@ -8,8 +8,6 @@ from trytond.model.exceptions import AccessError from trytond.transaction import Transaction from trytond.pool import Pool, PoolMeta -__all__ = ['ShipmentOut', 'ShipmentOutReturn', 'Move'] - def process_sale(moves_field): def _process_sale(func):