Commit 8cbc2ba4 authored by Jérome Perrin's avatar Jérome Perrin

change fast default value in getTotalPrice / getTotalQuantity. Do not use sql

methods by default, because they return wrong result when movements are not
indexed yet.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20515 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2594ae07
...@@ -116,7 +116,7 @@ class Delivery(XMLObject, ImmobilisationDelivery): ...@@ -116,7 +116,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
'getTotalPrice') 'getTotalPrice')
def getTotalPrice(self, fast=1, src__=0, **kw): def getTotalPrice(self, fast=0, src__=0, **kw):
""" Returns the total price for this order """ Returns the total price for this order
if the `fast` argument is set to a true value, then it use if the `fast` argument is set to a true value, then it use
SQLCatalog to compute the price, otherwise it sums the total SQLCatalog to compute the price, otherwise it sums the total
...@@ -139,7 +139,7 @@ class Delivery(XMLObject, ImmobilisationDelivery): ...@@ -139,7 +139,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getTotalQuantity') 'getTotalQuantity')
def getTotalQuantity(self, fast=1, src__=0, **kw): def getTotalQuantity(self, fast=0, src__=0, **kw):
""" Returns the total quantity of this order. """ Returns the total quantity of this order.
if the `fast` argument is set to a true value, then it use if the `fast` argument is set to a true value, then it use
SQLCatalog to compute the quantity, otherwise it sums the total SQLCatalog to compute the quantity, otherwise it sums the total
......
...@@ -80,11 +80,13 @@ class OrderLine(DeliveryLine): ...@@ -80,11 +80,13 @@ class OrderLine(DeliveryLine):
transactional_variable[call_method_key] = result transactional_variable[call_method_key] = result
return result return result
def _getTotalPrice(self, context, fast=1): def _getTotalPrice(self, context, fast=0):
""" """Returns the total price for this order line.
if hasLineContent: return sum of lines total price if hasLineContent: return sum of lines total price
if hasCellContent: return sum of cells total price if hasCellContent: return sum of cells total price
else: return quantity * price else: return quantity * price
if fast is argument true, then a SQL method will be used.
""" """
base_id = 'movement' base_id = 'movement'
if self.hasLineContent(): if self.hasLineContent():
...@@ -104,11 +106,13 @@ class OrderLine(DeliveryLine): ...@@ -104,11 +106,13 @@ class OrderLine(DeliveryLine):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getTotalQuantity') 'getTotalQuantity')
def getTotalQuantity(self, fast=1): def getTotalQuantity(self, fast=0):
""" """Returns the total quantity of this order line.
if hasLineContent: return sum of lines total quantity if hasLineContent: return sum of lines total quantity
if hasCellContent: return sum of cells total quantity if hasCellContent: return sum of cells total quantity
else: return quantity else: return quantity
if fast argument is true, then a SQL method will be used.
""" """
base_id = 'movement' base_id = 'movement'
if self.hasLineContent(): if self.hasLineContent():
......
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