diff --git a/product/ERP5/Document/Delivery.py b/product/ERP5/Document/Delivery.py index 291d5129d62c25ae3bea40acd4bc3e6ca629909e..4fd88bf7f0693b4c6e78f4227b768b05889c1658 100644 --- a/product/ERP5/Document/Delivery.py +++ b/product/ERP5/Document/Delivery.py @@ -119,17 +119,23 @@ class Delivery(XMLObject, ImmobilisationDelivery): So if the order is not in the catalog, getTotalPrice(fast=1) will return 0, this is not a bug. """ - if not fast : + result = None + if not fast: kw.setdefault( 'portal_type', self.getPortalDeliveryMovementTypeList()) - return sum([ line.getTotalPrice(fast=0) for line in - self.objectValues(**kw) ]) - kw['explanation_uid'] = self.getUid() - kw.update(self.portal_catalog.buildSQLQuery(**kw)) - if src__: - return self.Delivery_zGetTotal(src__=1, **kw) - aggregate = self.Delivery_zGetTotal(**kw)[0] - return aggregate.total_price or 0 + result = sum([ line.getTotalPrice(fast=0) for line in + self.objectValues(**kw) ]) + else: + kw['explanation_uid'] = self.getUid() + kw.update(self.portal_catalog.buildSQLQuery(**kw)) + if src__: + return self.Delivery_zGetTotal(src__=1, **kw) + aggregate = self.Delivery_zGetTotal(**kw)[0] + result = aggregate.total_price or 0 + method = self._getTypeBasedMethod('getTotalPrice') + if method is None: + return method(result) + return result security.declareProtected(Permissions.AccessContentsInformation, 'getTotalNetPrice') diff --git a/product/ERP5/Document/Movement.py b/product/ERP5/Document/Movement.py index d935a8aff33f63ab24b6ee8b695e90d1034ffe14..1529ffa047b64a757172dd6ba106604dcae83c6d 100644 --- a/product/ERP5/Document/Movement.py +++ b/product/ERP5/Document/Movement.py @@ -306,7 +306,11 @@ class Movement(XMLObject, Amount): default = None tmp_context = self.asContext(context=context, REQUEST=REQUEST, **kw) - return self._getTotalPrice(default=default, context=tmp_context, fast=fast, **kw) + result = self._getTotalPrice(default=default, context=tmp_context, fast=fast, **kw) + method = self._getTypeBasedMethod('getTotalPrice') + if method is None: + return result + return method(result) security.declareProtected( Permissions.AccessContentsInformation, 'getTotalQuantity')