Commit d90f82c4 authored by Rafael Monnerat's avatar Rafael Monnerat Committed by Xiaowu Zhang

erp5_commerce: use context to get price and be able to customize it

parent 48691d96
...@@ -3,9 +3,17 @@ from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod ...@@ -3,9 +3,17 @@ from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
import urllib import urllib
import mechanize import mechanize
def getProductPrice(product): def getProductPrice(product, date=None):
getPrice = UnrestrictedMethod(product.getPrice) getPrice = UnrestrictedMethod(product.getPrice)
return getPrice(supply_path_type=["Sale Supply Line", "Sale Supply Cell"]) getDefaultContext = UnrestrictedMethod(product.Resource_getPriceCalculationDefaultContext)
return getPrice(supply_path_type=["Sale Supply Line", "Sale Supply Cell"],
context=getDefaultContext(date=date))
def getCurrentInventory(product, **kw):
return UnrestrictedMethod(product.getCurrentInventory)(**kw)
def getFutureInventory(product, **kw):
return UnrestrictedMethod(product.getFutureInventory)(**kw)
def submitPaypalNVPRequest(parameter_dict, nvp_url): def submitPaypalNVPRequest(parameter_dict, nvp_url):
request = mechanize.Request(nvp_url) request = mechanize.Request(nvp_url)
......
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