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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
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
from
zLOG
import
LOG
,
WARNING
@
transactional_cached
()
def
getExchangeRate
(
source_currency_value
,
section_currency
,
start_
date
):
source_currency
=
source_
currency_value
.
getRelativeUrl
()
if
source_
currency
!=
section_currency
:
def
getExchangeRate
(
currency_value
,
section_currency
,
date
):
currency
=
currency_value
.
getRelativeUrl
()
if
currency
!=
section_currency
:
from
Products.ERP5Type.Document
import
newTempAccountingTransactionLine
return
source_
currency_value
.
getPrice
(
context
=
newTempAccountingTransactionLine
(
source_
currency_value
.
getPortalObject
(),
return
currency_value
.
getPrice
(
context
=
newTempAccountingTransactionLine
(
currency_value
.
getPortalObject
(),
"accounting_line"
,
resource
=
source_
currency
,
start_date
=
start_
date
,
resource
=
currency
,
start_date
=
date
,
price_currency
=
section_currency
))
...
...
@@ -501,7 +501,7 @@ class Movement(XMLObject, Amount, CompositionMixin, AmountGeneratorMixin):
type_based_script
=
self
.
_getTypeBasedMethod
(
'getSourceAssetPrice'
)
if
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
,
'getDestinationAssetPrice'
)
...
...
@@ -512,18 +512,18 @@ class Movement(XMLObject, Amount, CompositionMixin, AmountGeneratorMixin):
type_based_script
=
self
.
_getTypeBasedMethod
(
'getDestinationAssetPrice'
)
if
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
()
if
section
is
None
or
not
price
:
return
price
source_
currency_value
=
self
.
getPriceCurrencyValue
()
if
source_
currency_value
:
currency_value
=
self
.
getPriceCurrencyValue
()
if
currency_value
:
section_currency
=
section
.
getPriceCurrency
()
if
section_currency
:
exchange_rate
=
getExchangeRate
(
source_currency_value
,
section_currency
,
self
.
getStartDate
()
)
currency_value
,
section_currency
,
date
)
if
exchange_rate
:
return
exchange_rate
*
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