[Erp5-dev] Predicates magic - property similar to price

Łukasz Nowak lukasz.nowak at ventis.com.pl
Mon Nov 27 16:12:47 CET 2006


Hello,

Price can be defined on resource by default_supply_line or using Sale
Supply. It's copied using Predicate (predicated?) do Sale Order Line.

In our case we have very similar property, trade_name. It shall be used
same as price. For now I was using interaction_workflow, but now I want
to move to Predicate.

In my PropertySheet/Shufla.py I've got trade_name property. That PS is
associated with portal_types:

 * Product
 * Sale Supply Line
 * Sale Supply Cell
 * Supply Line
 * Supply Cell
 * Sale Order Line

I've modified SaleSupplyLine_init script's setMappedValuePropertyList()
list and added 'trade_name'.

So all this portal_types do have accessors *TradeName. And they are
working. But as price is copied to Sale Order Line without problems my
own field isn't. Such snippet:
===
print context,context.getUrl()
print context.portal_domains.searchPredicateList(context)
print \
context.portal_domains.generateMappedValue(context).getProperty('discount_ratio')
print \
context.portal_domains.generateMappedValue(context).getProperty('trade_name')
print context.portal_domains.generateMappedValue(context).getTradeName()
print context.portal_domains.generateMappedValue(context).getBasePrice()
return printed
===
run on Sale Order Line gives me:
===
<OrderLine at 5> /erp5/sale_order_module/1/5
[<SupplyLine at /erp5/sale_supply_module/1/1>]
0.05
Sale Supply Line: Trade Name
Sale Supply Line: Trade Name
100.0
===

Well... As I see predicate works. Am I wrong? Right? Where now shall I
do my investigation? What I'm doing wrong? I'm using
http://wiki.erp5.org/TechnicalNoteOnPredicates all the time, but for now
I'm stucked... I'd like any suggestion, tip, idea. I'll then put my path
of resolving this, I think common, problem on wiki.

Thanks in advance!

Bye,
Luke

-- 
Łukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 392 10 60 int 37 fax: +48 32 392 10 61
https://ssl.ventis.com.pl/keys/lukasz.nowak.pub.asc
``Use the Source, Luke...''




More information about the Erp5-dev mailing list