Commit 55726acf authored by Arnaud Fontaine's avatar Arnaud Fontaine

erp5_real_time_inventory_accounting: Implement Internal Packing List use case.

IPL must expand both "In"coming (only PPL until now) and "Out"going (only SPL
until now) SMs, so split up ledger='stock' TMPs and add accordingly two
subcategories to stock ("entree" and "sortie").

Also instead of using 'use' categories everywhere (TMPs and Rules), use the
Delivery Portal Type as this makes things clearer for IPL use case.
parent 741ade21
...@@ -71,7 +71,11 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM ...@@ -71,7 +71,11 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM
update_property_dict=update_property_dict): update_property_dict=update_property_dict):
# PATCH-BEGIN # PATCH-BEGIN
update_dict = {} update_dict = {}
if movement.getLedger() == 'transit/entree': if movement.getLedger() == 'stock/entree':
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStopDate()
elif movement.getLedger() == 'stock/sortie':
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStartDate()
elif movement.getLedger() == 'transit/entree':
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStartDate() update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStartDate()
elif movement.getLedger() == 'transit/sortie': elif movement.getLedger() == 'transit/sortie':
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStopDate() update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStopDate()
...@@ -105,30 +109,8 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM ...@@ -105,30 +109,8 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM
self, self,
input_movement) input_movement)
# XXX: Root Applied Rule? if input_movement.getDeliveryValue().getPortalType().startswith('Purchase Packing List'):
use = input_movement.getUse()
# Site Preference => Trade => Sale/Purchase uses
#input_movement.log("%r (ledger=%r)" % (input_movement, input_movement.getLedger()))
if use == 'trade/sale':
start_date = input_movement.getStartDate()
if input_movement.getLedger() == 'transit/sortie':
stop_date = input_movement.getStopDate()
else:
stop_date = start_date
elif use == 'trade/purchase':
stop_date = input_movement.getStopDate()
if input_movement.getLedger() == 'transit/entree':
start_date = input_movement.getStartDate()
else:
start_date = stop_date
update_property_dict['source_section'] = input_movement.getDestinationSection() update_property_dict['source_section'] = input_movement.getDestinationSection()
else:
raise NotImplementedError("%s: use='%s' not handled by this Rule" %
(input_movement.getPath(), use))
update_property_dict['start_date'] = start_date
update_property_dict['stop_date'] = stop_date
return update_property_dict return update_property_dict
......
kw['parent_specialise_reference'] = ['default_inventory_accounting_transaction_rule'] kw['parent_specialise_reference'] = ['default_inventory_accounting_transaction_rule']
kw['grand_grand_parent_specialise_reference'] = ['default_delivering_rule', 'default_delivery_rule'] kw['grand_grand_parent_specialise_reference'] = ['default_delivering_rule', 'default_delivery_rule']
kw['explanation_portal_type'] = ['Sale Packing List', 'Purchase Packing List'] kw['explanation_portal_type'] = ['Sale Packing List', 'Purchase Packing List', 'Internal Packing List']
kw['portal_type'] = 'Simulation Movement' kw['portal_type'] = 'Simulation Movement'
kw['delivery_uid'] = None kw['delivery_uid'] = None
kw['left_join_list'] = ['delivery_uid'] kw['left_join_list'] = ['delivery_uid']
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Trade Model Path" 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>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>ledger</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>trade_phase/trade/inventory_accounting</string>
<string>ledger/stock/entree</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>TMP-INVENTORY-ACCOUNTING-STOCK-LG-IN-CREDIT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>destination_method_id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingStockLedgerInCreditDestination</string> </value>
</item>
<item>
<key> <string>efficiency</string> </key>
<value> <float>-1.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>inventory_accounting_stock_ledger_in_credit_path</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>ledger</string> </key>
<value> <string>stock</string> </value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>payment_end_of_month</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Trade Model Path</string> </value>
</item>
<item>
<key> <string>source_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Purchase Packing List Line\', \'Purchase Packing List Cell\', \'Internal Packing List Line\', \'Internal Packing List Cell\')</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Inventory Accounting Stock Ledger In Credit</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>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Trade Model Path" 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>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>ledger</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>trade_phase/trade/inventory_accounting</string>
<string>ledger/stock/entree</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>TMP-INVENTORY-ACCOUNTING-STOCK-LG-IN-DEBIT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>destination_method_id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingStockLedgerInDebitDestination</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>inventory_accounting_stock_ledger_in_debit_path</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>ledger</string> </key>
<value> <string>stock</string> </value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>payment_end_of_month</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Trade Model Path</string> </value>
</item>
<item>
<key> <string>source_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Purchase Packing List Line\', \'Purchase Packing List Cell\', \'Internal Packing List Line\', \'Internal Packing List Cell\')</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Inventory Accounting Stock Ledger In Debit</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>
...@@ -40,13 +40,13 @@ ...@@ -40,13 +40,13 @@
<value> <value>
<tuple> <tuple>
<string>trade_phase/trade/inventory_accounting</string> <string>trade_phase/trade/inventory_accounting</string>
<string>ledger/stock</string> <string>ledger/stock/sortie</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>TMP-INVENTORY-ACCOUNTING-STOCK-LG-CREDIT</string> </value> <value> <string>TMP-INVENTORY-ACCOUNTING-STOCK-LG-OUT-CREDIT</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -56,7 +56,9 @@ ...@@ -56,7 +56,9 @@
</item> </item>
<item> <item>
<key> <string>destination_method_id</string> </key> <key> <string>destination_method_id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingStockLedgerCreditDestination</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>efficiency</string> </key> <key> <string>efficiency</string> </key>
...@@ -64,7 +66,7 @@ ...@@ -64,7 +66,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>inventory_accounting_stock_ledger_credit_path</string> </value> <value> <string>inventory_accounting_stock_ledger_out_credit_path</string> </value>
</item> </item>
<item> <item>
<key> <string>int_index</string> </key> <key> <string>int_index</string> </key>
...@@ -80,6 +82,12 @@ ...@@ -80,6 +82,12 @@
<key> <string>ledger</string> </key> <key> <string>ledger</string> </key>
<value> <string>stock</string> </value> <value> <string>stock</string> </value>
</item> </item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>payment_end_of_month</string> </key> <key> <string>payment_end_of_month</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
...@@ -90,11 +98,27 @@ ...@@ -90,11 +98,27 @@
</item> </item>
<item> <item>
<key> <string>source_method_id</string> </key> <key> <string>source_method_id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingStockLedgerCreditSource</string> </value> <value> <string>TradeModelPath_getInventoryAccountingStockLedgerOutCreditSource</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Sale Packing List Line\', \'Sale Packing List Cell\', \'Internal Packing List Line\', \'Internal Packing List Cell\')</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Inventory Accounting Stock Ledger Credit</string> </value> <value> <string>Inventory Accounting Stock Ledger Out Credit</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -40,13 +40,13 @@ ...@@ -40,13 +40,13 @@
<value> <value>
<tuple> <tuple>
<string>trade_phase/trade/inventory_accounting</string> <string>trade_phase/trade/inventory_accounting</string>
<string>ledger/stock</string> <string>ledger/stock/sortie</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>TMP-INVENTORY-ACCOUNTING-STOCK-LG-DEBIT</string> </value> <value> <string>TMP-INVENTORY-ACCOUNTING-STOCK-LG-OUT-DEBIT</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -56,11 +56,13 @@ ...@@ -56,11 +56,13 @@
</item> </item>
<item> <item>
<key> <string>destination_method_id</string> </key> <key> <string>destination_method_id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingStockLedgerDebitDestination</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>inventory_accounting_stock_ledger_debit_path</string> </value> <value> <string>inventory_accounting_stock_ledger_out_debit_path</string> </value>
</item> </item>
<item> <item>
<key> <string>int_index</string> </key> <key> <string>int_index</string> </key>
...@@ -76,6 +78,12 @@ ...@@ -76,6 +78,12 @@
<key> <string>ledger</string> </key> <key> <string>ledger</string> </key>
<value> <string>stock</string> </value> <value> <string>stock</string> </value>
</item> </item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>payment_end_of_month</string> </key> <key> <string>payment_end_of_month</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
...@@ -86,11 +94,27 @@ ...@@ -86,11 +94,27 @@
</item> </item>
<item> <item>
<key> <string>source_method_id</string> </key> <key> <string>source_method_id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingStockLedgerDebitSource</string> </value> <value> <string>TradeModelPath_getInventoryAccountingStockLedgerOutDebitSource</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Sale Packing List Line\', \'Sale Packing List Cell\', \'Internal Packing List Line\', \'Internal Packing List Cell\')</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Inventory Accounting Stock Ledger Debit</string> </value> <value> <string>Inventory Accounting Stock Ledger Out Debit</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -44,6 +44,12 @@ ...@@ -44,6 +44,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>TMP-INVENTORY-ACCOUNTING-TRANSIT-LG-IN-CREDIT</string> </value> <value> <string>TMP-INVENTORY-ACCOUNTING-TRANSIT-LG-IN-CREDIT</string> </value>
...@@ -80,6 +86,12 @@ ...@@ -80,6 +86,12 @@
<key> <string>ledger</string> </key> <key> <string>ledger</string> </key>
<value> <string>stock</string> </value> <value> <string>stock</string> </value>
</item> </item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>payment_end_of_month</string> </key> <key> <string>payment_end_of_month</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
...@@ -92,6 +104,22 @@ ...@@ -92,6 +104,22 @@
<key> <string>source_method_id</string> </key> <key> <string>source_method_id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingTransitLedgerInCreditSource</string> </value> <value> <string>TradeModelPath_getInventoryAccountingTransitLedgerInCreditSource</string> </value>
</item> </item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Sale Packing List Line\', \'Sale Packing List Cell\', \'Purchase Packing List Line\', \'Purchase Packing List Cell\')</string> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Inventory Accounting Transit Ledger In Credit</string> </value> <value> <string>Inventory Accounting Transit Ledger In Credit</string> </value>
......
...@@ -76,6 +76,12 @@ ...@@ -76,6 +76,12 @@
<key> <string>ledger</string> </key> <key> <string>ledger</string> </key>
<value> <string>stock</string> </value> <value> <string>stock</string> </value>
</item> </item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>payment_end_of_month</string> </key> <key> <string>payment_end_of_month</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
...@@ -88,6 +94,22 @@ ...@@ -88,6 +94,22 @@
<key> <string>source_method_id</string> </key> <key> <string>source_method_id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingTransitLedgerInDebitSource</string> </value> <value> <string>TradeModelPath_getInventoryAccountingTransitLedgerInDebitSource</string> </value>
</item> </item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Sale Packing List Line\', \'Sale Packing List Cell\', \'Purchase Packing List Line\', \'Purchase Packing List Cell\')</string> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Inventory Accounting Transit Ledger In Debit</string> </value> <value> <string>Inventory Accounting Transit Ledger In Debit</string> </value>
......
...@@ -80,6 +80,12 @@ ...@@ -80,6 +80,12 @@
<key> <string>ledger</string> </key> <key> <string>ledger</string> </key>
<value> <string>stock</string> </value> <value> <string>stock</string> </value>
</item> </item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>payment_end_of_month</string> </key> <key> <string>payment_end_of_month</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
...@@ -92,6 +98,22 @@ ...@@ -92,6 +98,22 @@
<key> <string>source_method_id</string> </key> <key> <string>source_method_id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingTransitLedgerOutCreditSource</string> </value> <value> <string>TradeModelPath_getInventoryAccountingTransitLedgerOutCreditSource</string> </value>
</item> </item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Sale Packing List Line\', \'Sale Packing List Cell\', \'Purchase Packing List Line\', \'Purchase Packing List Cell\')</string> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Inventory Accounting Transit Ledger Out Credit</string> </value> <value> <string>Inventory Accounting Transit Ledger Out Credit</string> </value>
......
...@@ -76,6 +76,12 @@ ...@@ -76,6 +76,12 @@
<key> <string>ledger</string> </key> <key> <string>ledger</string> </key>
<value> <string>stock</string> </value> <value> <string>stock</string> </value>
</item> </item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>payment_end_of_month</string> </key> <key> <string>payment_end_of_month</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
...@@ -88,6 +94,22 @@ ...@@ -88,6 +94,22 @@
<key> <string>source_method_id</string> </key> <key> <string>source_method_id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingTransitLedgerOutDebitSource</string> </value> <value> <string>TradeModelPath_getInventoryAccountingTransitLedgerOutDebitSource</string> </value>
</item> </item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Sale Packing List Line\', \'Sale Packing List Cell\', \'Purchase Packing List Line\', \'Purchase Packing List Cell\')</string> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Inventory Accounting Transit Ledger Out Debit</string> </value> <value> <string>Inventory Accounting Transit Ledger Out Debit</string> </value>
......
...@@ -53,6 +53,24 @@ ...@@ -53,6 +53,24 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<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> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>stock</string> </value> <value> <string>stock</string> </value>
...@@ -68,4 +86,26 @@ ...@@ -68,4 +86,26 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>ledger/stock/entree</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>entree</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>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Entree Stock</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>ledger/stock/sortie</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>sortie</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Sortie Stock</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
return [] if delivery_portal_type.startswith('Purchase Packing List'):
elif use == 'trade/purchase':
if movement.getDestination() == 'organisation_module/supplier': if movement.getDestination() == 'organisation_module/supplier':
return ['source/account_module/stock_parts_port'] return ['source/account_module/stock_parts_port']
elif delivery_portal_type.startswith('Internal Packing List'):
if movement.getDestination() == 'organisation_module/park':
return ['source/account_module/stock_car_park']
else: else:
raise NotImplementedError raise NotImplementedError
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingStockLedgerCreditDestination</string> </value> <value> <string>TradeModelPath_getInventoryAccountingStockLedgerInCreditDestination</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
return [] if delivery_portal_type.startswith('Purchase Packing List'):
elif use == 'trade/purchase':
if movement.getDestination() == 'organisation_module/supplier': if movement.getDestination() == 'organisation_module/supplier':
return ['source/account_module/variation_parts'] return ['source/account_module/variation_parts']
elif delivery_portal_type.startswith('Internal Packing List'):
return ['source/account_module/variation_cars']
else: else:
raise NotImplementedError raise NotImplementedError
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingStockLedgerDebitDestination</string> </value> <value> <string>TradeModelPath_getInventoryAccountingStockLedgerInDebitDestination</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
if delivery_portal_type.startswith('Sale Packing List'):
if movement.getSource() == 'organisation_module/hoge': if movement.getSource() == 'organisation_module/hoge':
return ['source/account_module/variation_cars'] return ['source/account_module/variation_cars']
elif use == 'trade/purchase': elif delivery_portal_type.startswith('Internal Packing List'):
return [] return ['source/account_module/variation_cars']
else: else:
raise NotImplementedError raise NotImplementedError
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingStockLedgerCreditSource</string> </value> <value> <string>TradeModelPath_getInventoryAccountingStockLedgerOutCreditSource</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
if delivery_portal_type.startswith('Sale Packing List'):
if movement.getSource() == 'organisation_module/hoge': if movement.getSource() == 'organisation_module/hoge':
return ['source/account_module/stock_car_park'] return ['source/account_module/stock_car_park']
elif use == 'trade/purchase': elif delivery_portal_type.startswith('Internal Packing List'):
return [] if movement.getSource() == 'organisation_module/workshop':
return ['source/account_module/stock_car_workshop']
else: else:
raise NotImplementedError raise NotImplementedError
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>TradeModelPath_getInventoryAccountingStockLedgerDebitSource</string> </value> <value> <string>TradeModelPath_getInventoryAccountingStockLedgerOutDebitSource</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
if delivery_portal_type.startswith('Sale Packing List'):
return [] return []
elif use == 'trade/purchase': elif delivery_portal_type.startswith('Purchase Packing List'):
if movement.getDestination() == 'organisation_module/supplier': if movement.getDestination() == 'organisation_module/supplier':
return ['source/account_module/stock_parts_transit'] return ['source/account_module/stock_parts_transit']
else: else:
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
if delivery_portal_type.startswith('Sale Packing List'):
if movement.getSource() == 'organisation_module/hoge': if movement.getSource() == 'organisation_module/hoge':
return ['source/account_module/variation_cars'] return ['source/account_module/variation_cars']
elif use == 'trade/purchase': elif delivery_portal_type.startswith('Purchase Packing List'):
return [] return []
else: else:
raise NotImplementedError raise NotImplementedError
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
if delivery_portal_type.startswith('Sale Packing List'):
return [] return []
elif use == 'trade/purchase': elif delivery_portal_type.startswith('Purchase Packing List'):
if movement.getDestination() == 'organisation_module/supplier': if movement.getDestination() == 'organisation_module/supplier':
return ['source/account_module/variation_parts'] return ['source/account_module/variation_parts']
else: else:
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
if delivery_portal_type.startswith('Sale Packing List'):
if movement.getSource() == 'organisation_module/hoge': if movement.getSource() == 'organisation_module/hoge':
return ['source/account_module/stock_car_transit'] return ['source/account_module/stock_car_transit']
elif use == 'trade/purchase': elif delivery_portal_type.startswith('Purchase Packing List'):
return [] return []
else: else:
raise NotImplementedError raise NotImplementedError
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
if delivery_portal_type.startswith('Sale Packing List'):
return [] return []
elif use == 'trade/purchase': elif delivery_portal_type.startswith('Purchase Packing List'):
if movement.getDestination() == 'organisation_module/supplier': if movement.getDestination() == 'organisation_module/supplier':
return ['source/account_module/variation_parts'] return ['source/account_module/variation_parts']
else: else:
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
if delivery_portal_type.startswith('Sale Packing List'):
if movement.getSource() == 'organisation_module/hoge': if movement.getSource() == 'organisation_module/hoge':
return ['source/account_module/stock_car_transit'] return ['source/account_module/stock_car_transit']
elif use == 'trade/purchase': elif delivery_portal_type.startswith('Purchase Packing List'):
return [] return []
else: else:
raise NotImplementedError raise NotImplementedError
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
if delivery_portal_type.startswith('Sale Packing List'):
return [] return []
elif use == 'trade/purchase': elif delivery_portal_type.startswith('Purchase Packing List'):
if movement.getDestination() == 'organisation_module/supplier': if movement.getDestination() == 'organisation_module/supplier':
return ['source/account_module/stock_parts_transit'] return ['source/account_module/stock_parts_transit']
else: else:
......
use = movement.getUse() delivery_portal_type = movement.getDeliveryValue().getPortalType()
if use == 'trade/sale': assert delivery_portal_type # XXX debug
if delivery_portal_type.startswith('Sale Packing List'):
if movement.getSource() == 'organisation_module/hoge': if movement.getSource() == 'organisation_module/hoge':
return ['source/account_module/variation_cars'] return ['source/account_module/variation_cars']
elif use == 'trade/purchase': elif delivery_portal_type.startswith('Purchase Packing List'):
return [] return []
else: else:
raise NotImplementedError raise NotImplementedError
......
...@@ -41,6 +41,9 @@ class TestRealTimeInventoryAccountingMixin: ...@@ -41,6 +41,9 @@ class TestRealTimeInventoryAccountingMixin:
def stepSelectPurchasePackingList1(self, sequence=None, sequence_list=None): def stepSelectPurchasePackingList1(self, sequence=None, sequence_list=None):
sequence.edit(current_purchase_packing_list=sequence['purchase_packing_list_1']) sequence.edit(current_purchase_packing_list=sequence['purchase_packing_list_1'])
def stepSelectInternalPackingList1(self, sequence=None, sequence_list=None):
sequence.edit(current_internal_packing_list=sequence['internal_packing_list_1'])
def _transitAndCheck(self, document, workflow_method_id, expected_state): def _transitAndCheck(self, document, workflow_method_id, expected_state):
from Products.DCWorkflow.DCWorkflow import ValidationFailed from Products.DCWorkflow.DCWorkflow import ValidationFailed
try: try:
...@@ -84,6 +87,18 @@ class TestRealTimeInventoryAccountingMixin: ...@@ -84,6 +87,18 @@ class TestRealTimeInventoryAccountingMixin:
packing_list = sequence['current_purchase_packing_list'] packing_list = sequence['current_purchase_packing_list']
self._transitAndCheck(packing_list, 'stop_action', 'stopped') self._transitAndCheck(packing_list, 'stop_action', 'stopped')
def stepConfirmInternalPackingList(self, sequence=None, sequence_list=None):
packing_list = sequence['current_internal_packing_list']
self._transitAndCheck(packing_list, 'confirm_action', 'confirmed')
def stepStartInternalPackingList(self, sequence=None, sequence_list=None):
packing_list = sequence['current_internal_packing_list']
self._transitAndCheck(packing_list, 'start_action', 'started')
def stepStopInternalPackingList(self, sequence=None, sequence_list=None):
packing_list = sequence['current_internal_packing_list']
self._transitAndCheck(packing_list, 'stop_action', 'stopped')
def _checkAndGetCausalityRelated(self, def _checkAndGetCausalityRelated(self,
document, document,
causality_related_portal_type, causality_related_portal_type,
...@@ -100,6 +115,10 @@ class TestRealTimeInventoryAccountingMixin: ...@@ -100,6 +115,10 @@ class TestRealTimeInventoryAccountingMixin:
packing_list = sequence['current_purchase_packing_list'] packing_list = sequence['current_purchase_packing_list']
self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 0) self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 0)
def stepCheckAccountingTransactionNotGeneratedFromInternalPackingList(self, sequence=None, sequence_list=None):
packing_list = sequence['current_internal_packing_list']
self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 0)
def stepCheckThreeAccountingTransactionGeneratedFromSalePackingList(self, sequence=None, sequence_list=None): def stepCheckThreeAccountingTransactionGeneratedFromSalePackingList(self, sequence=None, sequence_list=None):
packing_list = sequence['current_sale_packing_list'] packing_list = sequence['current_sale_packing_list']
accounting_transaction_list = self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 3) accounting_transaction_list = self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 3)
...@@ -110,6 +129,11 @@ class TestRealTimeInventoryAccountingMixin: ...@@ -110,6 +129,11 @@ class TestRealTimeInventoryAccountingMixin:
accounting_transaction_list = self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 3) accounting_transaction_list = self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 3)
sequence.edit(current_accounting_transaction_list=accounting_transaction_list) sequence.edit(current_accounting_transaction_list=accounting_transaction_list)
def stepCheckTwoAccountingTransactionGeneratedFromInternalPackingList(self, sequence=None, sequence_list=None):
packing_list = sequence['current_internal_packing_list']
accounting_transaction_list = self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 2)
sequence.edit(current_accounting_transaction_list=accounting_transaction_list)
def _checkDelivery(self, def _checkDelivery(self,
delivery, delivery,
delivery_property_dict=None, delivery_property_dict=None,
...@@ -154,7 +178,8 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc ...@@ -154,7 +178,8 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
[category_tool.ledger.achat, [category_tool.ledger.achat,
category_tool.ledger.preparation, category_tool.ledger.preparation,
category_tool.ledger.production, category_tool.ledger.production,
category_tool.ledger.stock, category_tool.ledger.stock.entree,
category_tool.ledger.stock.sortie,
category_tool.ledger.transit.entree, category_tool.ledger.transit.entree,
category_tool.ledger.transit.sortie, category_tool.ledger.transit.sortie,
category_tool.ledger.vente]) category_tool.ledger.vente])
...@@ -194,6 +219,16 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc ...@@ -194,6 +219,16 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
financial_section_value=category_tool.financial_section.asset.current_assets.stock, financial_section_value=category_tool.financial_section.asset.current_assets.stock,
gap_value=category_tool.gap.fr.pcg['3']['35']['355']) gap_value=category_tool.gap.fr.pcg['3']['35']['355'])
if 'stock_car_workshop' not in self.portal.account_module:
self.portal.account_module.newContent(
portal_type='Account',
id='stock_car_workshop',
reference='STOCK_CAR_WORKSHOP',
title='Stock Atelier Véhicules',
account_type_value=category_tool.account_type.asset,
financial_section_value=category_tool.financial_section.asset.current_assets.stock,
gap_value=category_tool.gap.fr.pcg['3']['35']['355'])
if 'variation_parts' not in self.portal.account_module: if 'variation_parts' not in self.portal.account_module:
self.portal.account_module.newContent( self.portal.account_module.newContent(
portal_type='Account', portal_type='Account',
...@@ -284,6 +319,26 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc ...@@ -284,6 +319,26 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
if organisation_supplier.getValidationState() != 'validated': if organisation_supplier.getValidationState() != 'validated':
organisation_supplier.validate() organisation_supplier.validate()
try:
organisation_workshop = self.portal.organisation_module.workshop
except AttributeError:
organisation_workshop = self.portal.organisation_module.newContent(
portal_type='Organisation',
id='workshop',
title='Workshop')
if organisation_workshop.getValidationState() != 'validated':
organisation_workshop.validate()
try:
organisation_park = self.portal.organisation_module.park
except AttributeError:
organisation_park = self.portal.organisation_module.newContent(
portal_type='Organisation',
id='park',
title='Park')
if organisation_park.getValidationState() != 'validated':
organisation_park.validate()
try: try:
currency_dol_conversion_eur = currency_dol.CONV_EUR currency_dol_conversion_eur = currency_dol.CONV_EUR
except AttributeError: except AttributeError:
...@@ -329,6 +384,21 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc ...@@ -329,6 +384,21 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
if ptc.getValidationState() != 'validated': if ptc.getValidationState() != 'validated':
ptc.validate() ptc.validate()
try:
itc = self.portal.internal_trade_condition_module.hoge
except AttributeError:
itc = self.portal.internal_trade_condition_module.newContent(
portal_type='Internal Trade Condition',
id='hoge',
reference='ITC-HOGE',
title='HOGE Internal Trade Condition',
source_value=organisation_hoge,
source_section_value=organisation_hoge,
price_currency_value=currency_eur,
specialise_value=self.portal.business_process_module.bpm_hoge)
if itc.getValidationState() != 'validated':
itc.validate()
try: try:
product_big_b_car = self.portal.product_module.big_b_car product_big_b_car = self.portal.product_module.big_b_car
except AttributeError: except AttributeError:
...@@ -425,6 +495,26 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc ...@@ -425,6 +495,26 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
if purchase_supply.getValidationState() != 'validated': if purchase_supply.getValidationState() != 'validated':
purchase_supply.validate() purchase_supply.validate()
try:
internal_supply = self.portal.internal_supply_module.hoge
except AttributeError:
internal_supply = self.portal.internal_supply_module.newContent(
portal_type='Internal Supply',
id='hoge',
title='HOGE Internal Supply',
start_date_range_min=DateTime('2018/01/01 00:00:00 GMT+9'),
start_date_range_max=DateTime('2999/12/31 00:00:00 GMT+9'),
source_section_value=organisation_hoge)
if 'product_big_b_car' not in internal_supply:
internal_supply.newContent(
portal_type='Internal Supply Line',
id='product_big_b_car',
title=product_big_b_car.getTitle(),
resource_value=product_big_b_car,
base_price=4242)
if internal_supply.getValidationState() != 'validated':
internal_supply.validate()
self.tic() self.tic()
def stepCallBuilder(self, sequence=None, sequence_list=None): def stepCallBuilder(self, sequence=None, sequence_list=None):
...@@ -459,7 +549,7 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc ...@@ -459,7 +549,7 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
accounting_transaction_list = sequence['current_accounting_transaction_list'] accounting_transaction_list = sequence['current_accounting_transaction_list']
for accounting_transaction in accounting_transaction_list: for accounting_transaction in accounting_transaction_list:
self.assertEquals(accounting_transaction.getSimulationState(), 'draft') self.assertEquals(accounting_transaction.getSimulationState(), 'draft')
if accounting_transaction.getLedgerValue() == self.portal.portal_categories.ledger.stock: if accounting_transaction.getLedgerValue() == self.portal.portal_categories.ledger.stock.sortie:
self._checkDelivery( self._checkDelivery(
accounting_transaction, accounting_transaction,
delivery_property_dict=dict( delivery_property_dict=dict(
...@@ -618,7 +708,7 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc ...@@ -618,7 +708,7 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
accounting_transaction_list = sequence['current_accounting_transaction_list'] accounting_transaction_list = sequence['current_accounting_transaction_list']
for accounting_transaction in accounting_transaction_list: for accounting_transaction in accounting_transaction_list:
self.assertEquals(accounting_transaction.getSimulationState(), 'draft') self.assertEquals(accounting_transaction.getSimulationState(), 'draft')
if accounting_transaction.getLedgerValue() == self.portal.portal_categories.ledger.stock: if accounting_transaction.getLedgerValue() == self.portal.portal_categories.ledger.stock.entree:
self._checkDelivery( self._checkDelivery(
accounting_transaction, accounting_transaction,
delivery_property_dict=dict( delivery_property_dict=dict(
...@@ -739,6 +829,136 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc ...@@ -739,6 +829,136 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
sequence_list.addSequenceString(sequence_str) sequence_list.addSequenceString(sequence_str)
sequence_list.play(self, quiet=0) sequence_list.play(self, quiet=0)
def stepTestInternalPackingList_create(self, sequence=None, sequence_list=None):
internal_packing_list = self.portal.internal_packing_list_module.newContent(
portal_type='Internal Packing List',
specialise_value=self.portal.internal_trade_condition_module.hoge,
title='Transfert Workshop to Park',
start_date=DateTime('2018/03/02 00:00:00 GMT+9'),
stop_date=DateTime('2018/03/03 00:00:00 GMT+9'),
source_value=self.portal.organisation_module.workshop,
source_section_value=self.portal.organisation_module.hoge,
destination_value=self.portal.organisation_module.park,
destination_section_value=self.portal.organisation_module.hoge,
price_currency_value=self.portal.currency_module.DOL)
internal_packing_list.newContent(
portal_type='Internal Packing List Line',
int_index=1,
resource_value=self.portal.product_module.big_b_car,
price=4242,
quantity=1,
quantity_unit_value=self.portal.portal_categories.quantity_unit.unit.piece,
use_value=self.portal.portal_categories.use.trade.purchase)
sequence.edit(internal_packing_list_1=internal_packing_list)
def stepTestInternalPackingList_checkAllAccountingTransaction(self, sequence=None, sequence_list=None):
accounting_transaction_list = sequence['current_accounting_transaction_list']
for accounting_transaction in accounting_transaction_list:
self.assertEquals(accounting_transaction.getSimulationState(), 'draft')
if accounting_transaction.getLedgerValue() == self.portal.portal_categories.ledger.stock.entree:
self._checkDelivery(
accounting_transaction,
delivery_property_dict=dict(
source_section_value=self.portal.organisation_module.hoge,
resource_value=self.portal.currency_module.DOL,
# start_date=stop_date=IPL.stop_date
start_date=DateTime('2018/03/03 00:00:00 GMT+9'),
stop_date=DateTime('2018/03/03 00:00:00 GMT+9')),
movement_property_dict_tuple=(
dict(portal_type='Accounting Transaction Line',
source_value=self.portal.account_module.stock_car_park,
# sum(IPLL.price)
quantity=-4242),
dict(portal_type='Accounting Transaction Line',
source_value=self.portal.account_module.variation_cars,
# sum(IPLL.price)
quantity=4242)))
# ledger/stock/sortie
else:
self._checkDelivery(
accounting_transaction,
delivery_property_dict=dict(
source_section_value=self.portal.organisation_module.hoge,
resource_value=self.portal.currency_module.DOL,
ledger_value=self.portal.portal_categories.ledger.stock.sortie,
# start_date=stop_date=IPL.start_date
start_date=DateTime('2018/03/02 00:00:00 GMT+9'),
stop_date=DateTime('2018/03/02 00:00:00 GMT+9')),
movement_property_dict_tuple=(
dict(portal_type='Accounting Transaction Line',
source_value=self.portal.account_module.variation_cars,
# sum(IPLL.price)
quantity=-4242),
dict(portal_type='Accounting Transaction Line',
source_value=self.portal.account_module.stock_car_workshop,
# sum(IPLL.price)
quantity=4242)))
def testInternalPackingList(self):
sequence_list = SequenceList()
sequence_str = """
TestInternalPackingList_create
Tic
SelectInternalPackingList1
ConfirmInternalPackingList
Tic
StartInternalPackingList
Tic
StopInternalPackingList
Tic
CallBuilder
Tic
CheckTwoAccountingTransactionGeneratedFromInternalPackingList
TestInternalPackingList_checkAllAccountingTransaction
"""
sequence_list.addSequenceString(sequence_str)
sequence_list.play(self, quiet=0)
def stepTestInternalPackingListNoPriceAndNoSupply_create(self, sequence=None, sequence_list=None):
internal_packing_list = self.portal.internal_packing_list_module.newContent(
portal_type='Internal Packing List',
specialise_value=self.portal.internal_trade_condition_module.hoge,
title='Transfer Workshop to Park (No Supply/Price)',
start_date=DateTime('2018/03/02 00:00:00 GMT+9'),
stop_date=DateTime('2018/03/02 00:00:00 GMT+9'),
source_value=self.portal.organisation_module.workshop,
source_section_value=self.portal.organisation_module.hoge,
destination_value=self.portal.organisation_module.park,
destination_section_value=self.portal.organisation_module.hoge,
price_currency_value=self.portal.currency_module.DOL)
internal_packing_list.newContent(
portal_type='Internal Packing List Line',
int_index=1,
resource_value=self.portal.product_module.car_no_supply,
quantity=1,
quantity_unit_value=self.portal.portal_categories.quantity_unit.unit.piece,
use_value=self.portal.portal_categories.use.trade.purchase)
sequence.edit(internal_packing_list_1=internal_packing_list)
def testInternalPackingListNoPriceAndNoSupply(self):
sequence_list = SequenceList()
sequence_str = """
TestInternalPackingListNoPriceAndNoSupply_create
Tic
SelectInternalPackingList1
ConfirmInternalPackingList
Tic
StartInternalPackingList
Tic
StopInternalPackingList
Tic
CallBuilder
Tic
CheckAccountingTransactionNotGeneratedFromInternalPackingList
"""
sequence_list.addSequenceString(sequence_str)
sequence_list.play(self, quiet=0)
import unittest import unittest
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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