Commit 4693135b authored by Romain Courteaud's avatar Romain Courteaud 🐙

slapos_pdm:

* set SoftwareProduct default quantity unit
* support document without categories property
* add constraint to ensure quantity unit of a Software Product is defined
parent d561ae81
......@@ -61,11 +61,18 @@ class SoftwareProduct(ERP5SoftwareProduct):
default_category_list = (
'base_contribution/base_amount/invoicing/discounted',
'base_contribution/base_amount/invoicing/taxable',
'use/trade/sale'
'use/trade/sale',
'quantity_unit/time/month'
)
def __getattribute__(self, name):
result = super(SoftwareProduct, self).__getattribute__(name)
try:
result = super(SoftwareProduct, self).__getattribute__(name)
except AttributeError:
if name == 'categories':
result = []
else:
raise
if name == 'categories':
# Force getting default_category_list
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TALES Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>expression</string> </key>
<value> <string>python: context.getQuantityUnit() == \'time/month\'</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>forced_quantity_unit_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>TALES Constraint</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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