Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Romain Courteaud
erp5_rtl_support
Commits
750b01da
Commit
750b01da
authored
May 24, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amount_generator: fix aggregation with rounding proxies
parent
c34015d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
product/ERP5/GeneratedAmountList.py
product/ERP5/GeneratedAmountList.py
+8
-3
product/ERP5/mixin/amount_generator.py
product/ERP5/mixin/amount_generator.py
+1
-1
No files found.
product/ERP5/GeneratedAmountList.py
View file @
750b01da
...
@@ -31,6 +31,7 @@ from collections import defaultdict
...
@@ -31,6 +31,7 @@ from collections import defaultdict
import
zope.interface
import
zope.interface
from
AccessControl
import
allow_class
from
AccessControl
import
allow_class
from
Products.ERP5Type
import
interfaces
from
Products.ERP5Type
import
interfaces
from
Products.ERP5.Document.RoundingModel
import
RoundingProxy
class
GeneratedAmountList
(
list
):
class
GeneratedAmountList
(
list
):
"""
"""
...
@@ -92,10 +93,14 @@ class GeneratedAmountList(list):
...
@@ -92,10 +93,14 @@ class GeneratedAmountList(list):
# but it is not a good idea, especially when the first expand causes
# but it is not a good idea, especially when the first expand causes
# non-zero quantity and then quantity becomes zero.
# non-zero quantity and then quantity becomes zero.
aggregate
=
newTempAmount
(
amount
.
aq_parent
,
''
,
notify_workflow
=
False
)
aggregate
=
newTempAmount
(
amount
.
aq_parent
,
''
,
notify_workflow
=
False
)
result_list
.
append
(
aggregate
)
aggregate
.
__dict__
.
update
(
amount
.
aq_base
.
__dict__
)
aggregate
.
__dict__
.
update
(
amount
.
__dict__
)
aggregate
.
_setQuantity
(
quantity
)
aggregate
.
_setQuantity
(
quantity
)
del
aggregate
.
_base
if
isinstance
(
amount
,
RoundingProxy
):
aggregate
=
amount
.
getPortalObject
().
portal_roundings
.
getRoundingProxy
(
aggregate
)
else
:
del
aggregate
.
_base
result_list
.
append
(
aggregate
)
return
result_list
return
result_list
def
split
(
self
):
def
split
(
self
):
...
...
product/ERP5/mixin/amount_generator.py
View file @
750b01da
...
@@ -474,7 +474,6 @@ class AmountGeneratorMixin:
...
@@ -474,7 +474,6 @@ class AmountGeneratorMixin:
property_dict
[
'causality_value_list'
][
-
1
]
property_dict
[
'causality_value_list'
][
-
1
]
.
getRelativeUrl
().
replace
(
'/'
,
'_'
),
.
getRelativeUrl
().
replace
(
'/'
,
'_'
),
notify_workflow
=
False
)
notify_workflow
=
False
)
amount
.
_base
=
delivery_amount
amount
.
_setCategoryList
(
property_dict
.
pop
(
'category_list'
,
()))
amount
.
_setCategoryList
(
property_dict
.
pop
(
'category_list'
,
()))
if
amount
.
getQuantityUnit
():
if
amount
.
getQuantityUnit
():
del
property_dict
[
'quantity_unit'
]
del
property_dict
[
'quantity_unit'
]
...
@@ -489,6 +488,7 @@ class AmountGeneratorMixin:
...
@@ -489,6 +488,7 @@ class AmountGeneratorMixin:
if
rounding
:
if
rounding
:
# We hope here that rounding is sufficient at line level
# We hope here that rounding is sufficient at line level
amount
=
getRoundingProxy
(
amount
,
context
=
self
)
amount
=
getRoundingProxy
(
amount
,
context
=
self
)
amount
.
_base
=
delivery_amount
result
.
append
(
amount
)
result
.
append
(
amount
)
# Contribute
# Contribute
quantity
*=
property_dict
.
get
(
'price'
,
1
)
quantity
*=
property_dict
.
get
(
'price'
,
1
)
...
...
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