Skip to content
Snippets Groups Projects
Commit 60e96f419da8 authored by Houzefa Abbasbhay's avatar Houzefa Abbasbhay :slight_smile:
Browse files

Code formatting (flake8 valid)

parent 794ab1ed229d
No related branches found
No related tags found
No related merge requests found
......@@ -82,9 +82,11 @@
# Create a field that will be used for replacement in the view
if analytic:
nmspc['analytic_dimensions'] = fields.Char(
string = u"Analytic Dimensions",
compute = api.one(lambda self : setattr(self, 'analytic_dimensions', '')),
readonly=True
string=u"Analytic Dimensions",
compute=api.one(lambda self: (
setattr(self, 'analytic_dimensions', '')
)),
readonly=True,
)
col_pattern = '{pre}{n}_{suf}'
......@@ -247,9 +249,9 @@
use_inherits = dimension.get('use_inherits', None)
if use_inherits is None:
use_inherits = not (
any(field in nmspc for field in ('name', 'nd_id'))
or nmspc.get('_inherits', False)
or nmspc.get('_inherit', False)
any(field in nmspc for field in ('name', 'nd_id')) or
nmspc.get('_inherits', False) or
nmspc.get('_inherit', False)
)
use_code_name_methods = dimension.get('use_code_name_methods', False)
......@@ -293,8 +295,8 @@
for string, model_col, code_col, dtype, req, default in rel_cols:
nmspc[model_col] = getattr(fields, dtype)(
string = string,
related = ".".join([column, code_col]),
string=string,
related=".".join([column, code_col]),
relation="analytic.code",
required=req,
store=True
......@@ -309,7 +311,6 @@
# Set _register to False in order to prevent its instantiation.
superclass = type(superclass_name, bases, {'_register': False})
# We must keep the old api here !!!!!!!
# If we switch to the new, the method is call through a wrapper
# then, 'self' is a !#@*ing (!) object of the same type of __cls__
......@@ -379,7 +380,7 @@
# unless the 'force_code_id' context key is passed as True.
force_code_id = vals.pop(column, False)
if context and context.get('force_code_id', False) == True:
if context and context.get('force_code_id', False):
self._force_code(cr, uid, force_code_id, code_vals, context)
vals[column] = force_code_id
......@@ -434,7 +435,7 @@
# unless the 'force_code_id' context key is passed as True.
force_code_id = vals.pop(column, False)
if context and context.get('force_code_id', False) == True:
if context and context.get('force_code_id', False):
self._force_code(cr, uid, force_code_id, code_vals, context)
vals[column] = force_code_id
......@@ -481,7 +482,7 @@
if not force_code_id:
raise ValueError(
"An analytic code ID MUST be specified if the " \
"An analytic code ID MUST be specified if the "
"force_code_id key is enabled in the context"
)
force_code_dim = code_osv.read(
......@@ -489,7 +490,7 @@
)['nd_id'][0]
if force_code_dim != self._bound_dimension_id:
raise ValueError(
"If specified, codes must belong to the bound " \
"If specified, codes must belong to the bound "
"analytic dimension {}".format(dimension_name)
)
if code_vals:
......
# -*- coding: utf-8 -*-
# flake8: noqa
##############################################################################
#
# OpenERP, Open Source Management Solution
......
......@@ -51,9 +51,9 @@
for anc in self:
blacklist = (company.id for company in anc.blacklist_ids)
to_write = None
if anc.disabled_per_company and company_id not in blacklist:
to_write = [(4, company_id)] # Link.
elif not anc.disabled_per_company and company_id in blacklist:
to_write = [(3, company_id)] # Unlink.
......@@ -55,9 +55,9 @@
to_write = None
if anc.disabled_per_company and company_id not in blacklist:
to_write = [(4, company_id)] # Link.
elif not anc.disabled_per_company and company_id in blacklist:
to_write = [(3, company_id)] # Unlink.
if to_write:
anc.write({'blacklist_ids': to_write})
......@@ -91,10 +91,10 @@
string=u"Dimension",
ondelete='cascade',
required=True,
)
)
active = fields.Boolean(
u"Active",
help=(
u"Determines whether an analytic code is in the referential."
),
......@@ -95,10 +95,10 @@
active = fields.Boolean(
u"Active",
help=(
u"Determines whether an analytic code is in the referential."
),
default = lambda *a: True
default=lambda *a: True
)
view_type = fields.Boolean(
u"View type",
......@@ -106,7 +106,7 @@
u"Determines whether an analytic code is not selectable (but "
u"still in the referential)."
),
default = lambda *a: False
default=lambda *a: False
)
blacklist_ids = fields.Many2many(
'res.company',
......@@ -117,11 +117,11 @@
help=u"Companies the code is hidden in.",
)
disabled_per_company = fields.Boolean(
string = u"Disable in my company",
compute = _read_disabled_per_company,
inverse = _write_disabled_per_company,
search = _search_disabled_per_company,
string=u"Disable in my company",
compute=_read_disabled_per_company,
inverse=_write_disabled_per_company,
search=_search_disabled_per_company,
help=(
u"Determines whether an analytic code is disabled for the "
u"current company."
),
......@@ -124,8 +124,8 @@
help=(
u"Determines whether an analytic code is disabled for the "
u"current company."
),
default = lambda *a: False
default=lambda *a: False
)
nd_name = fields.Char(
......@@ -129,7 +129,7 @@
)
nd_name = fields.Char(
related = 'nd_id.name',
related='nd_id.name',
string=u"Dimension Name",
store=False
)
......
......@@ -18,7 +18,7 @@
#
##############################################################################
from openerp import models, fields, api
from openerp import models, fields
from openerp.addons.oemetasl import OEMetaSL
from openerp.tools import config
......@@ -51,8 +51,8 @@
translate=config.get_misc('analytic', 'translate', False),
required=True,
)
nc_ids = fields.One2many(
comodel_name='analytic.code',
inverse_name='nd_id',
string=u"Codes")
......@@ -55,8 +55,8 @@
nc_ids = fields.One2many(
comodel_name='analytic.code',
inverse_name='nd_id',
string=u"Codes")
ns_id = fields.One2many(
comodel_name='analytic.structure',
inverse_name='nd_id',
......
......@@ -55,7 +55,10 @@
]
count = self.search_count(domain)
if count > 1:
raise exceptions.ValidationError(u"One dimension per Analysis slot per object when the structure is common to all companies.")
raise exceptions.ValidationError(
u"One dimension per Analysis slot per object when the "
u"structure is common to all companies."
)
model_name = fields.Char(
u"Object",
......@@ -78,7 +81,7 @@
company_id = fields.Many2one(
'res.company',
u"Company",
default = lambda *a: False
default=(lambda *a: False),
)
_sql_constraints = [
......@@ -256,7 +259,8 @@
match.set('required', 'false')
match.set('modifiers', json.dumps(modifiers))
# Look for any field named 'analytic_dimensions' and with the right prefix.
# Look for any field named 'analytic_dimensions' and with the right
# prefix.
name_cond = '@name="analytic_dimensions"'
if prefix == 'a':
pre_cond = '(@prefix="a" or not(@prefix))'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment