Commit 487ccdb5 authored by Łukasz Nowak's avatar Łukasz Nowak

Initialise migration of Sale Packing List Line constraint.

parent 470d286e
......@@ -8,6 +8,9 @@
<portal_type id="Sale Packing List">
<item>SlapOSAccountingSalePackingListConstraint</item>
</portal_type>
<portal_type id="Sale Packing List Line">
<item>SlapOSAccountingSalePackingListLineConstraint</item>
</portal_type>
<portal_type id="Slave Instance">
<item>InstanceAccountingSynchronisation</item>
</portal_type>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Sheet" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SlapOSAccountingSalePackingListLineConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Membership Arity 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>constraint_base_category</string> </key>
<value>
<tuple>
<string>resource</string>
</tuple>
</value>
</item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: context.getPortalServiceTypeList()</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>resource_arity_constraint</string> </value>
</item>
<item>
<key> <string>max_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>min_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Membership Arity Constraint</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
<value> <int>0</int> </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>
......@@ -338,3 +338,48 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
self.assertTrue(message in self.getMessageList(delivery))
delivery.setStartDate('2012/01/01')
self.assertFalse(message in self.getMessageList(delivery))
class TestSalePackingListLine(TestSlapOSConstraintMixin):
@withAbort
def test_property_existence(self):
message = 'Property existence error for property %s, this document has '\
'no such property or the property has never been set'
message_price = message % 'price'
message_quantity = message % 'quantity'
delivery_line = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List').newContent(
portal_type='Sale Packing List Line')
self.assertTrue(message_price in self.getMessageList(delivery_line))
self.assertTrue(message_quantity in self.getMessageList(delivery_line))
delivery_line.setQuantity(1.0)
self.assertTrue(message_price in self.getMessageList(delivery_line))
self.assertFalse(message_quantity in self.getMessageList(delivery_line))
delivery_line.setPrice(1.0)
self.assertFalse(message_price in self.getMessageList(delivery_line))
self.assertFalse(message_quantity in self.getMessageList(delivery_line))
def test_resource_arity(self):
category = 'resource'
message = "Arity Error for Relation ['%s'], arity is equal to "\
"0 but should be between 1 and 1" % category
message_2 = "Arity Error for Relation ['%s'], arity is equal to "\
"2 but should be between 1 and 1" % category
delivery_line = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List').newContent(
portal_type='Sale Packing List Line')
product = self.portal.product_module.newContent(
portal_type='Product').getRelativeUrl()
service_1 = self.portal.service_module.newContent(
portal_type='Service').getRelativeUrl()
service_2 = self.portal.service_module.newContent(
portal_type='Service').getRelativeUrl()
key = '%s_list' % category
self.assertTrue(message in self.getMessageList(delivery_line))
delivery_line.edit(**{key: [product]})
self.assertTrue(message in self.getMessageList(delivery_line))
delivery_line.edit(**{key: [service_1, service_2]})
self.assertTrue(message_2 in self.getMessageList(delivery_line))
delivery_line.edit(**{key: [service_1]})
self.assertFalse(message in self.getMessageList(delivery_line))
self.assertFalse(message_2 in self.getMessageList(delivery_line))
191
\ No newline at end of file
192
\ No newline at end of file
Hosting Subscription | SlapOSAccountingHostingSubscriptionConstraint
Sale Invoice Transaction | SlapOSAccountingSaleInvoiceTransactionConstraint
Sale Packing List Line | SlapOSAccountingSalePackingListLineConstraint
Sale Packing List | SlapOSAccountingSalePackingListConstraint
Slave Instance | InstanceAccountingSynchronisation
Software Instance | InstanceAccountingSynchronisation
\ No newline at end of file
......@@ -2,4 +2,5 @@ InstanceAccountingSynchronisation
SlapOSAccountingHostingSubscriptionConstraint
SlapOSAccountingSaleInvoiceTransactionConstraint
SlapOSAccountingSalePackingListConstraint
SlapOSAccountingSalePackingListLineConstraint
SlapOSAccountingSystemPreference
\ No newline at end of file
578
\ No newline at end of file
579
\ No newline at end of file
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