Fix flake8 errors and warnings
We add the flake8 configuration used so we ensure everyone uses the same. We remove the usage of __all__ for non public API. When possible, we rationalize the class name according to its __name__ and module. issue9082 review297061002
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ def register():
|
||||
account.Journal,
|
||||
module='account_asset', type_='model')
|
||||
Pool.register(
|
||||
purchase.PurchaseLine,
|
||||
purchase.Line,
|
||||
module='account_asset', type_='model', depends=['purchase'])
|
||||
Pool.register(
|
||||
asset.CreateMoves,
|
||||
|
||||
@@ -19,12 +19,6 @@ from trytond.wizard import (Wizard, StateView, StateTransition, StateReport,
|
||||
from trytond.tools import grouped_slice
|
||||
from trytond.modules.company import CompanyReport
|
||||
|
||||
__all__ = ['Asset', 'AssetLine', 'AssetUpdateMove',
|
||||
'CreateMovesStart', 'CreateMoves',
|
||||
'UpdateAssetStart', 'UpdateAssetShowDepreciation', 'UpdateAsset',
|
||||
'AssetDepreciationTable',
|
||||
'PrintDepreciationTableStart', 'PrintDepreciationTable']
|
||||
|
||||
|
||||
def date2datetime(date):
|
||||
return datetime.datetime.combine(date, datetime.time())
|
||||
@@ -67,7 +61,7 @@ class Asset(Workflow, ModelSQL, ModelView):
|
||||
supplier_invoice_line = fields.Many2One('account.invoice.line',
|
||||
'Supplier Invoice Line',
|
||||
domain=[
|
||||
If(Eval('product', None) == None,
|
||||
If(~Eval('product', None),
|
||||
('product', '=', -1),
|
||||
('product', '=', Eval('product', -1)),
|
||||
),
|
||||
@@ -991,8 +985,9 @@ class AssetDepreciationTable(CompanyReport):
|
||||
|
||||
@cached_property
|
||||
def update_lines(self):
|
||||
filter_ = lambda l: (l.account.type.expense
|
||||
and self.start_date < l.move.date <= self.end_date)
|
||||
def filter_(l):
|
||||
return (l.account.type.expense
|
||||
and self.start_date < l.move.date <= self.end_date)
|
||||
return list(filter(filter_,
|
||||
(l for m in self.asset.update_moves for l in m.lines)))
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ from trytond.pyson import Eval
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
__all__ = ['InvoiceLine']
|
||||
|
||||
|
||||
class InvoiceLine(metaclass=PoolMeta):
|
||||
__name__ = 'account.invoice.line'
|
||||
|
||||
@@ -7,8 +7,6 @@ from trytond.pool import PoolMeta, Pool
|
||||
from trytond.modules.account_product.product import (
|
||||
account_used, template_property)
|
||||
|
||||
__all__ = ['Category', 'CategoryAccount', 'Template', 'Product']
|
||||
|
||||
|
||||
class Category(metaclass=PoolMeta):
|
||||
__name__ = 'product.category'
|
||||
|
||||
+2
-4
@@ -5,14 +5,12 @@ from trytond.pool import PoolMeta
|
||||
|
||||
from trytond.modules.account_product.exceptions import AccountError
|
||||
|
||||
__all__ = ['PurchaseLine']
|
||||
|
||||
|
||||
class PurchaseLine(metaclass=PoolMeta):
|
||||
class Line(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.line'
|
||||
|
||||
def get_invoice_line(self):
|
||||
invoice_lines = super(PurchaseLine, self).get_invoice_line()
|
||||
invoice_lines = super().get_invoice_line()
|
||||
if (self.product
|
||||
and self.product.type == 'assets'
|
||||
and self.product.depreciable):
|
||||
|
||||
@@ -81,8 +81,8 @@ setup(name=name,
|
||||
keywords='tryton account asset',
|
||||
package_dir={'trytond.modules.account_asset': '.'},
|
||||
packages=(
|
||||
['trytond.modules.account_asset'] +
|
||||
['trytond.modules.account_asset.%s' % p for p in find_packages()]
|
||||
['trytond.modules.account_asset']
|
||||
+ ['trytond.modules.account_asset.%s' % p for p in find_packages()]
|
||||
),
|
||||
package_data={
|
||||
'trytond.modules.account_asset': (info.get('xml', [])
|
||||
@@ -96,7 +96,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)',
|
||||
|
||||
Reference in New Issue
Block a user