Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
11077f97
Commit
11077f97
authored
Apr 26, 2022
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_invoicing: fix asset price value on movement
parent
f363ac65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
21 deletions
+27
-21
bt5/erp5_invoicing/DocumentTemplateItem/portal_components/document.erp5.InvoiceTransactionSimulationRule.py
...ponents/document.erp5.InvoiceTransactionSimulationRule.py
+27
-21
No files found.
bt5/erp5_invoicing/DocumentTemplateItem/portal_components/document.erp5.InvoiceTransactionSimulationRule.py
View file @
11077f97
...
@@ -124,29 +124,35 @@ class InvoiceTransactionRuleMovementGenerator(MovementGeneratorMixin):
...
@@ -124,29 +124,35 @@ class InvoiceTransactionRuleMovementGenerator(MovementGeneratorMixin):
.
getParentValue
().
getParentValue
()
.
getParentValue
().
getParentValue
()
kw
=
{
'delivery'
:
None
,
'resource'
:
resource
,
'price'
:
1
}
kw
=
{
'delivery'
:
None
,
'resource'
:
resource
,
'price'
:
1
}
return
kw
if
resource
is
not
None
:
def
getGeneratedMovementList
(
self
,
movement_list
=
None
,
rounding
=
False
):
#set asset_price on movement when resource is different from price
movement_list
=
super
(
InvoiceTransactionRuleMovementGenerator
,
self
).
getGeneratedMovementList
(
movement_list
=
movement_list
,
rounding
=
rounding
)
#currency of the source/destination section
portal
=
self
.
_applied_rule
.
getPortalObject
()
for
arrow
in
'destination'
,
'source'
:
for
arrow
in
'destination'
,
'source'
:
section
=
input_movement
.
getDefaultAcquiredValue
(
arrow
+
'_section'
)
for
movement
in
movement_list
:
if
section
is
not
None
:
resource
=
movement
.
getResource
()
try
:
if
resource
is
not
None
:
currency_url
=
section
.
getPriceCurrency
()
section
=
movement
.
getDefaultAcquiredValue
(
arrow
+
'_section'
)
except
AttributeError
:
if
section
is
not
None
:
currency_url
=
None
try
:
if
currency_url
not
in
(
None
,
resource
):
currency_url
=
section
.
getPriceCurrency
()
currency
=
portal
.
unrestrictedTraverse
(
currency_url
)
except
AttributeError
:
exchange_ratio
=
currency
.
getPrice
(
currency_url
=
None
context
=
input_movement
.
asContext
(
if
currency_url
not
in
(
None
,
resource
):
categories
=
(
'price_currency/'
+
currency_url
,
currency
=
portal
.
unrestrictedTraverse
(
currency_url
)
'resource/'
+
resource
)))
exchange_ratio
=
currency
.
getPrice
(
if
exchange_ratio
is
not
None
:
context
=
movement
.
asContext
(
kw
[
arrow
+
'_total_asset_price'
]
=
round
(
categories
=
(
'price_currency/'
+
currency_url
,
exchange_ratio
*
input_movement
.
getQuantity
(),
'resource/'
+
resource
)))
currency
.
getQuantityPrecision
())
if
exchange_ratio
is
not
None
:
if
arrow
==
'destination'
:
sign
=
1
else
:
sign
=
-
1
movement
.
setProperty
(
arrow
+
'_total_asset_price'
,
movement
.
getQuantity
()
*
exchange_ratio
*
sign
)
return
kw
return
movement_list
def
_getInputMovementList
(
self
,
movement_list
=
None
,
rounding
=
False
):
def
_getInputMovementList
(
self
,
movement_list
=
None
,
rounding
=
False
):
simulation_movement
=
self
.
_applied_rule
.
getParentValue
()
simulation_movement
=
self
.
_applied_rule
.
getParentValue
()
...
...
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