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
b985a7b5
Commit
b985a7b5
authored
Jan 18, 2019
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Movement: use start date for source and stop date for destination and rename variable
parent
351b887a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
product/ERP5/Document/Movement.py
product/ERP5/Document/Movement.py
+13
-13
No files found.
product/ERP5/Document/Movement.py
View file @
b985a7b5
...
@@ -47,15 +47,15 @@ from Products.ERP5Type.Cache import transactional_cached
...
@@ -47,15 +47,15 @@ from Products.ERP5Type.Cache import transactional_cached
from
zLOG
import
LOG
,
WARNING
from
zLOG
import
LOG
,
WARNING
@
transactional_cached
()
@
transactional_cached
()
def
getExchangeRate
(
source_currency_value
,
section_currency
,
start_
date
):
def
getExchangeRate
(
currency_value
,
section_currency
,
date
):
source_currency
=
source_
currency_value
.
getRelativeUrl
()
currency
=
currency_value
.
getRelativeUrl
()
if
source_
currency
!=
section_currency
:
if
currency
!=
section_currency
:
from
Products.ERP5Type.Document
import
newTempAccountingTransactionLine
from
Products.ERP5Type.Document
import
newTempAccountingTransactionLine
return
source_
currency_value
.
getPrice
(
context
=
newTempAccountingTransactionLine
(
return
currency_value
.
getPrice
(
context
=
newTempAccountingTransactionLine
(
source_
currency_value
.
getPortalObject
(),
currency_value
.
getPortalObject
(),
"accounting_line"
,
"accounting_line"
,
resource
=
source_
currency
,
resource
=
currency
,
start_date
=
start_
date
,
start_date
=
date
,
price_currency
=
section_currency
price_currency
=
section_currency
))
))
...
@@ -501,7 +501,7 @@ class Movement(XMLObject, Amount, CompositionMixin, AmountGeneratorMixin):
...
@@ -501,7 +501,7 @@ class Movement(XMLObject, Amount, CompositionMixin, AmountGeneratorMixin):
type_based_script
=
self
.
_getTypeBasedMethod
(
'getSourceAssetPrice'
)
type_based_script
=
self
.
_getTypeBasedMethod
(
'getSourceAssetPrice'
)
if
type_based_script
:
if
type_based_script
:
return
type_based_script
()
return
type_based_script
()
return
self
.
_getAssetPrice
(
section
=
self
.
getSourceSectionValue
())
return
self
.
_getAssetPrice
(
section
=
self
.
getSourceSectionValue
()
,
date
=
self
.
getStartDate
()
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDestinationAssetPrice'
)
'getDestinationAssetPrice'
)
...
@@ -512,18 +512,18 @@ class Movement(XMLObject, Amount, CompositionMixin, AmountGeneratorMixin):
...
@@ -512,18 +512,18 @@ class Movement(XMLObject, Amount, CompositionMixin, AmountGeneratorMixin):
type_based_script
=
self
.
_getTypeBasedMethod
(
'getDestinationAssetPrice'
)
type_based_script
=
self
.
_getTypeBasedMethod
(
'getDestinationAssetPrice'
)
if
type_based_script
:
if
type_based_script
:
return
type_based_script
()
return
type_based_script
()
return
self
.
_getAssetPrice
(
section
=
self
.
getDestinationSectionValue
())
return
self
.
_getAssetPrice
(
section
=
self
.
getDestinationSectionValue
()
,
date
=
self
.
getStopDate
()
)
def
_getAssetPrice
(
self
,
section
):
def
_getAssetPrice
(
self
,
section
,
date
):
price
=
self
.
getPrice
()
price
=
self
.
getPrice
()
if
section
is
None
or
not
price
:
if
section
is
None
or
not
price
:
return
price
return
price
source_
currency_value
=
self
.
getPriceCurrencyValue
()
currency_value
=
self
.
getPriceCurrencyValue
()
if
source_
currency_value
:
if
currency_value
:
section_currency
=
section
.
getPriceCurrency
()
section_currency
=
section
.
getPriceCurrency
()
if
section_currency
:
if
section_currency
:
exchange_rate
=
getExchangeRate
(
exchange_rate
=
getExchangeRate
(
source_currency_value
,
section_currency
,
self
.
getStartDate
()
)
currency_value
,
section_currency
,
date
)
if
exchange_rate
:
if
exchange_rate
:
return
exchange_rate
*
price
return
exchange_rate
*
price
return
price
return
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