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
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
Iliya Manolov
erp5
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
import
zope.interface
from
AccessControl
import
allow_class
from
Products.ERP5Type
import
interfaces
from
Products.ERP5.Document.RoundingModel
import
RoundingProxy
class
GeneratedAmountList
(
list
):
"""
...
...
@@ -92,10 +93,14 @@ class GeneratedAmountList(list):
# but it is not a good idea, especially when the first expand causes
# non-zero quantity and then quantity becomes zero.
aggregate
=
newTempAmount
(
amount
.
aq_parent
,
''
,
notify_workflow
=
False
)
result_list
.
append
(
aggregate
)
aggregate
.
__dict__
.
update
(
amount
.
__dict__
)
aggregate
.
__dict__
.
update
(
amount
.
aq_base
.
__dict__
)
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
def
split
(
self
):
...
...
product/ERP5/mixin/amount_generator.py
View file @
750b01da
...
...
@@ -474,7 +474,6 @@ class AmountGeneratorMixin:
property_dict
[
'causality_value_list'
][
-
1
]
.
getRelativeUrl
().
replace
(
'/'
,
'_'
),
notify_workflow
=
False
)
amount
.
_base
=
delivery_amount
amount
.
_setCategoryList
(
property_dict
.
pop
(
'category_list'
,
()))
if
amount
.
getQuantityUnit
():
del
property_dict
[
'quantity_unit'
]
...
...
@@ -489,6 +488,7 @@ class AmountGeneratorMixin:
if
rounding
:
# We hope here that rounding is sufficient at line level
amount
=
getRoundingProxy
(
amount
,
context
=
self
)
amount
.
_base
=
delivery_amount
result
.
append
(
amount
)
# Contribute
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