本文整理匯總了Python中Products.ERP5.Document.Movement.Movement._getTotalPrice方法的典型用法代碼示例。如果您正苦於以下問題:Python Movement._getTotalPrice方法的具體用法?Python Movement._getTotalPrice怎麽用?Python Movement._getTotalPrice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Products.ERP5.Document.Movement.Movement
的用法示例。
在下文中一共展示了Movement._getTotalPrice方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _getTotalPrice
# 需要導入模塊: from Products.ERP5.Document.Movement import Movement [as 別名]
# 或者: from Products.ERP5.Document.Movement.Movement import _getTotalPrice [as 別名]
def _getTotalPrice(self, default=0.0, context=None, fast=0):
"""
Returns the total price for this line, this line contains, or the cells it contains.
if hasLineContent: return sum of lines total price
if hasCellContent: return sum of cells total price
else: return quantity * price
if fast argument is true, inventory API will be used.
"""
if fast:
kw = {}
kw['section_uid'] = self.getDestinationSectionUid()
kw['stock.explanation_uid'] = self.getExplanationUid()
kw['relative_url'] = ( '%s/%%' % (
self.getRelativeUrl().replace('_', '\\_')),
self.getRelativeUrl() )
kw['only_accountable'] = False
return self.getPortalObject().portal_simulation.getInventoryAssetPrice(**kw)
if self.hasLineContent():
meta_type = self.meta_type
return sum(l.getTotalPrice(context=context)
for l in self.objectValues() if l.meta_type==meta_type)
elif not self.hasCellContent(base_id='movement'):
return Movement._getTotalPrice(self, default=default, context=context)
return sum(cell.getTotalPrice(default=0.0, context=context)
for cell in self.getCellValueList())
示例2: _getTotalPrice
# 需要導入模塊: from Products.ERP5.Document.Movement import Movement [as 別名]
# 或者: from Products.ERP5.Document.Movement.Movement import _getTotalPrice [as 別名]
def _getTotalPrice(self, default=0.0, context=None, fast=0):
"""
Returns the total price for this line, this line contains, or the cells it contains.
if hasLineContent: return sum of lines total price
if hasCellContent: return sum of cells total price
else: return quantity * price
if fast is argument true, then a SQL method will be used.
"""
if self.hasLineContent():
meta_type = self.meta_type
return sum(l.getTotalPrice(context=context)
for l in self.objectValues() if l.meta_type==meta_type)
elif not self.hasCellContent(base_id='movement'):
return Movement._getTotalPrice(self, default=default, context=context)
elif fast: # Use MySQL
return self.DeliveryLine_zGetTotal()[0].total_price or 0.0
return sum(cell.getTotalPrice(default=0.0, context=context)
for cell in self.getCellValueList())