Commit 9a33227a authored by Yoshinori Okuji's avatar Yoshinori Okuji

When calculating the diff of a quantity, it is necessary to use real values...

When calculating the diff of a quantity, it is necessary to use real values instead of recorded ones.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37156 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 224537c8
...@@ -408,14 +408,17 @@ class Rule(Predicate, XMLObject): ...@@ -408,14 +408,17 @@ class Rule(Predicate, XMLObject):
if p_matched_list != []: if p_matched_list != []:
# Check the quantity # Check the quantity
m_quantity = 0.0 m_quantity = 0.0
real_quantity = 0.0
for movement in p_matched_list: for movement in p_matched_list:
quantity = movement.getQuantity()
if movement.isPropertyRecorded('quantity'): if movement.isPropertyRecorded('quantity'):
m_quantity += movement.getRecordedProperty('quantity') m_quantity += movement.getRecordedProperty('quantity')
else: else:
m_quantity += movement.getQuantity() m_quantity += quantity
real_quantity += quantity
if m_quantity != prevision.get('quantity'): if m_quantity != prevision.get('quantity'):
# special case - quantity # special case - quantity
q_diff = prevision.get('quantity') - m_quantity q_diff = prevision.get('quantity') - real_quantity
# try to find a movement that can be edited # try to find a movement that can be edited
for movement in p_matched_list: for movement in p_matched_list:
if movement in (mutable_movement_list \ if movement in (mutable_movement_list \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment