Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
7a4db2aa
Commit
7a4db2aa
authored
Jan 13, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ImmobilisableItem: Fix pylint error: E: 799, 47: Using variable 'currency' before assignment.
parent
1840bc00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
product/ERP5/Document/AmortisationRule.py
product/ERP5/Document/AmortisationRule.py
+2
-1
product/ERP5/Document/ImmobilisableItem.py
product/ERP5/Document/ImmobilisableItem.py
+16
-9
No files found.
product/ERP5/Document/AmortisationRule.py
View file @
7a4db2aa
...
...
@@ -271,10 +271,11 @@ class AmortisationRule(RuleMixin):
### First, plan the theorical accounting movements
accounting_movement_list
=
[]
immo_cache_dict
=
{
'period'
:{},
'price'
:{}}
immo_cache_dict
=
{
'period'
:{},
'price'
:{}
,
'currency'
:
{}
}
immo_period_list
=
my_item
.
getImmobilisationPeriodList
(
immo_cache_dict
=
immo_cache_dict
)
for
period_number
in
range
(
len
(
immo_period_list
)):
immo_cache_dict
[
'price'
]
=
{}
immo_cache_dict
[
'currency'
]
=
{}
previous_period
=
None
next_period
=
None
immo_period
=
immo_period_list
[
period_number
]
...
...
product/ERP5/Document/ImmobilisableItem.py
View file @
7a4db2aa
...
...
@@ -326,7 +326,9 @@ class ImmobilisableItem(Item, Amount):
kw_key_list
.
sort
()
if
kw_key_list
.
count
(
'immo_cache_dict'
):
kw_key_list
.
remove
(
'immo_cache_dict'
)
immo_cache_dict
=
kw
.
get
(
'immo_cache_dict'
,
{
'period'
:{},
'price'
:{}})
immo_cache_dict
=
kw
.
get
(
'immo_cache_dict'
,
{
'period'
:{},
'price'
:{},
'currency'
:
{}})
kw
[
'immo_cache_dict'
]
=
immo_cache_dict
if
immo_cache_dict
[
'period'
].
has_key
((
self
.
getRelativeUrl
(),
from_date
,
to_date
)
+
tuple
([(
key
,
kw
[
key
])
for
key
in
kw_key_list
]))
:
...
...
@@ -732,7 +734,9 @@ class ImmobilisableItem(Item, Amount):
start_date
=
immo_period
[
'start_date'
]
start_durability
=
immo_period
[
'start_durability'
]
if
start_durability
is
None
:
immo_cache_dict
=
kw
.
get
(
'immo_cache_dict'
,
{
'period'
:{},
'price'
:{}})
immo_cache_dict
=
kw
.
get
(
'immo_cache_dict'
,
{
'period'
:{},
'price'
:{},
'currency'
:
{}})
start_durability
=
self
.
getRemainingDurability
(
at_date
=
start_date
,
immo_cache_dict
=
immo_cache_dict
)
if
start_durability
is
None
:
...
...
@@ -788,14 +792,17 @@ class ImmobilisableItem(Item, Amount):
if
kw_key_list
.
count
(
'immo_cache_dict'
):
kw_key_list
.
remove
(
'immo_cache_dict'
)
immo_cache_dict
=
kw
.
get
(
'immo_cache_dict'
,
{
'period'
:{},
'price'
:{}})
immo_cache_dict
=
kw
.
get
(
'immo_cache_dict'
,
{
'period'
:{},
'price'
:{},
'currency'
:
{}})
kw
[
'immo_cache_dict'
]
=
immo_cache_dict
i
f
immo_cache_dict
[
'price'
].
has_key
(
(
self
.
getRelativeUrl
(),
at_date
)
+
tuple
([(
key
,
kw
[
key
])
for
key
in
kw_key_list
])
)
:
returned_price
=
immo_cache_dict
[
'price'
][
(
self
.
getRelativeUrl
(),
at_date
)
+
tuple
(
[(
key
,
kw
[
key
])
for
key
in
kw_key_list
])
]
i
mmo_cache_dict_price_key
=
(
(
self
.
getRelativeUrl
(),
at_date
)
+
tuple
([(
key
,
kw
[
key
])
for
key
in
kw_key_list
]))
if
immo_cache_dict
[
'price'
].
has_key
(
immo_cache_dict_price_key
)
:
returned_price
=
immo_cache_dict
[
'price'
][
immo_cache_dict_price_key
]
if
with_currency
:
currency
=
immo_cache_dict
[
'currency'
][
immo_cache_dict_price_key
]
return
'%0.2f %s'
%
(
returned_price
,
currency
)
return
returned_price
...
...
@@ -1017,8 +1024,8 @@ class ImmobilisableItem(Item, Amount):
if
returned_price
is
None
:
return
None
returned_price
+=
disposal_price
immo_cache_dict
[
'price'
][
(
self
.
getRelativeUrl
(),
at_date
)
+
tuple
([(
key
,
kw
[
key
])
for
key
in
kw_key_list
])
]
=
returned_price
immo_cache_dict
[
'price'
][
immo_cache_dict_price_key
]
=
returned_price
immo_cache_dict
[
'currency'
][
immo_cache_dict_price_key
]
=
currency
if
with_currency
:
return
'%0.2f %s'
%
(
returned_price
,
currency
)
return
returned_price
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment