Commit 177b4dd3 authored by Łukasz Nowak's avatar Łukasz Nowak

Go back to merging builders.

Also update rule to allow automatic solving.
parent cb16f458
...@@ -84,7 +84,10 @@ ...@@ -84,7 +84,10 @@
<item> <item>
<key> <string>delivery_cell_separate_order</string> </key> <key> <string>delivery_cell_separate_order</string> </key>
<value> <value>
<tuple/> <tuple>
<string>calculateAddQuantity</string>
<string>calculateAveragePrice</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</item> </item>
<item> <item>
<key> <string>int_index</string> </key> <key> <string>int_index</string> </key>
<value> <int>2</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</item> </item>
<item> <item>
<key> <string>int_index</string> </key> <key> <string>int_index</string> </key>
<value> <int>3</int> </value> <value> <int>2</int> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Split Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/line</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>split_on_line</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Split Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -84,7 +84,10 @@ ...@@ -84,7 +84,10 @@
<item> <item>
<key> <string>delivery_cell_separate_order</string> </key> <key> <string>delivery_cell_separate_order</string> </key>
<value> <value>
<tuple/> <tuple>
<string>calculateAddQuantity</string>
<string>calculateSeparatePrice</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Split Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/line</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>split_on_line</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Split Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -58,7 +58,9 @@ ...@@ -58,7 +58,9 @@
<item> <item>
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple/> <tuple>
<string>solver/portal_solvers/Automatic Quantity Adopt Solver</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -314,6 +314,11 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder): ...@@ -314,6 +314,11 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
[delivery_2.getRelativeUrl()]), **invoice_kw) [delivery_2.getRelativeUrl()]), **invoice_kw)
class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder): class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
def checkSimulationMovement(self, simulation_movement):
self.assertNotEqual(0.0, simulation_movement.getDeliveryRatio())
self.assertEqual(0.0, simulation_movement.getDeliveryError())
self.assertNotEqual(None, simulation_movement.getDeliveryValue())
def test(self): def test(self):
hosting_subscription = self.portal.hosting_subscription_module\ hosting_subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
...@@ -691,14 +696,15 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder): ...@@ -691,14 +696,15 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
transaction_line.getCategoryList() transaction_line.getCategoryList()
) )
self.assertEqual(simulation_movement.getQuantity(), self.assertEqual(simulation_movement.getQuantity(),
transaction_line.getQuantity()) transaction_line.getQuantity()
* simulation_movement.getDeliveryRatio())
self.assertEqual(simulation_movement.getPrice(), self.assertEqual(simulation_movement.getPrice(),
transaction_line.getPrice()) transaction_line.getPrice())
self.assertFalse(transaction_line.hasStartDate()) self.assertFalse(transaction_line.hasStartDate())
self.assertFalse(transaction_line.hasStopDate()) self.assertFalse(transaction_line.hasStopDate())
self.assertEqual([], transaction_line.contentValues( self.assertEqual([], transaction_line.contentValues(
portal_type='Delivery Cell')) portal_type='Delivery Cell'))
self.assertSameSet([simulation_movement.getRelativeUrl()], self.assertTrue(simulation_movement.getRelativeUrl() in
transaction_line.getDeliveryRelatedList( transaction_line.getDeliveryRelatedList(
portal_type='Simulation Movement')) portal_type='Simulation Movement'))
...@@ -778,6 +784,11 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder): ...@@ -778,6 +784,11 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
path='%s/%%' % applied_rule.getPath()) path='%s/%%' % applied_rule.getPath())
self.tic() self.tic()
# as invoice_1 has been updated it is time to update its causality
# with automatic solving
invoice_1.updateCausalityState(solve_automatically=True)
self.tic()
self.checkSimulationMovement(transaction_movement_1_rec_bis2) self.checkSimulationMovement(transaction_movement_1_rec_bis2)
transaction_line_1_rec_bis2 = transaction_movement_1_rec_bis2\ transaction_line_1_rec_bis2 = transaction_movement_1_rec_bis2\
.getDeliveryValue() .getDeliveryValue()
...@@ -798,11 +809,17 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder): ...@@ -798,11 +809,17 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
self.assertEqual(invoice_1.getRelativeUrl(), self.assertEqual(invoice_1.getRelativeUrl(),
transation_model_line_1_rec_bis2.getParentValue().getRelativeUrl()) transation_model_line_1_rec_bis2.getParentValue().getRelativeUrl())
checkTransactionedInvoice(invoice_1) self.assertEqual('solved', invoice_1.getCausalityState())
self.assertEqual('confirmed', invoice_1.getSimulationState())
self.assertEqual('solved', invoice_2.getCausalityState()) self.assertEqual('solved', invoice_2.getCausalityState())
self.assertEqual('confirmed', invoice_2.getSimulationState()) self.assertEqual('confirmed', invoice_2.getSimulationState())
class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingListBuilder): class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingListBuilder):
def checkSimulationMovement(self, simulation_movement):
self.assertNotEqual(0.0, simulation_movement.getDeliveryRatio())
self.assertEqual(0.0, simulation_movement.getDeliveryError())
self.assertNotEqual(None, simulation_movement.getDeliveryValue())
def test(self): def test(self):
hosting_subscription = self.portal.hosting_subscription_module\ hosting_subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
...@@ -995,14 +1012,15 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis ...@@ -995,14 +1012,15 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
transaction_line.getCategoryList() transaction_line.getCategoryList()
) )
self.assertEqual(simulation_movement.getQuantity(), self.assertEqual(simulation_movement.getQuantity(),
transaction_line.getQuantity()) transaction_line.getQuantity()
* simulation_movement.getDeliveryRatio())
self.assertEqual(simulation_movement.getPrice(), self.assertEqual(simulation_movement.getPrice(),
transaction_line.getPrice()) transaction_line.getPrice())
self.assertFalse(transaction_line.hasStartDate()) self.assertFalse(transaction_line.hasStartDate())
self.assertFalse(transaction_line.hasStopDate()) self.assertFalse(transaction_line.hasStopDate())
self.assertEqual([], transaction_line.contentValues( self.assertEqual([], transaction_line.contentValues(
portal_type='Delivery Cell')) portal_type='Delivery Cell'))
self.assertSameSet([simulation_movement.getRelativeUrl()], self.assertTrue(simulation_movement.getRelativeUrl() in
transaction_line.getDeliveryRelatedList( transaction_line.getDeliveryRelatedList(
portal_type='Simulation Movement')) portal_type='Simulation Movement'))
...@@ -1037,6 +1055,12 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis ...@@ -1037,6 +1055,12 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
.slapos_sale_invoice_transaction_trade_model_builder.build( .slapos_sale_invoice_transaction_trade_model_builder.build(
path='%s/%%' % applied_rule.getPath()) path='%s/%%' % applied_rule.getPath())
self.tic() self.tic()
# as invoice_1 has been updated it is time to update its causality
# with automatic solving
invoice_1.updateCausalityState(solve_automatically=True)
self.tic()
self.checkSimulationMovement(model_movement_1_tax_bis) self.checkSimulationMovement(model_movement_1_tax_bis)
model_line_1_tax_bis = model_movement_1_tax_bis.getDeliveryValue() model_line_1_tax_bis = model_movement_1_tax_bis.getDeliveryValue()
checkModelLine(model_movement_1_tax_bis, model_line_1_tax_bis, [ checkModelLine(model_movement_1_tax_bis, model_line_1_tax_bis, [
......
156 157
\ No newline at end of file \ 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