From f3a76b4e7e719bc576885bf8c3bc00632782d85a Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Fri, 1 Sep 2006 14:02:08 +0000 Subject: [PATCH] added method getPrice on item git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9612 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Item.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/product/ERP5/Document/Item.py b/product/ERP5/Document/Item.py index 10381279e5..5ba1095763 100644 --- a/product/ERP5/Document/Item.py +++ b/product/ERP5/Document/Item.py @@ -89,3 +89,18 @@ class Item(XMLObject, Amount, ImmobilisableItem): """ return XMLObject.generateNewId(self, id_group=id_group, default=default, method=method) + def getPrice(self,**kw): + """ + Get the Price in the context. + + If price is not stored locally, lookup a price + """ + local_price = self._baseGetPrice() + if local_price is None: + # We must find a price for this movement + resource = self.getResourceValue() + if resource is not None: + local_price = resource.getPrice(self.asContext( context=context, **kw)) + return local_price + + -- 2.30.9