[Erp5-dev] Sale Supplies - problem with performance, some other questions

Łukasz K. Nowak lukasz.nowak at ventis.com.pl
Wed Jun 6 10:11:57 CEST 2007


Hello,

Dnia 05-06-2007, wto o godzinie 14:33 +0200, Łukasz K. Nowak napisał(a):
(...)
> Another thing. Please look at SupplyLine_asPredicate[1]. I thought, that
> defining of Purchase Supplies is done based on its source, am I right?
> Is that script able to support such situation? Shall I propose tested
> conditions to support sale and purchase supplies in this script?

I've attached SupplyLine_asPredicate, which, I hope, resolves correctly
issue of purchase system. I haven't written unit test for it - I'm still
waiting for comments on problems with invoking asPrediacte on all Supply
Lines. I'd like to know, if idea provided in this script is
ERP5-oriented and correct?

Thanks,
Luke

-- 
Łukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...''

-------------- next part --------------
## Script (Python) "SupplyLine_asPredicate"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=*args,**kw
##title=
##
"""
This is modified version of SupplyLine_asPredicate, which supports sale and purchase system.
Well - at least I (Luke) hope...
"""
source = context.getSourceValue()
destination = context.getDestinationValue()
script.log('me = %s source = %s destination = %s'%(context.getRelativeUrl(),source,destination))
if source is None and destination is None: # we are on supply line, which parent is Resource - eg. default_supply_line
  return context.generatePredicate(membership_criterion_base_category_list = ('resource',),
                                                   criterion_property_list = ('start_date',))

if destination is not None: # we are on supply line, which is sale supply
  return context.generatePredicate(membership_criterion_base_category_list = ('destination', 'resource'),
                                                 criterion_property_list = ('start_date',))
elif source is not None: # we are on supply line, which is purchase supply
  return context.generatePredicate(membership_criterion_base_category_list = ('source', 'resource'),
                                                 criterion_property_list = ('start_date',))


More information about the Erp5-dev mailing list