From f80336675ca1265a968175d46a76e89f88324744 Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Wed, 14 Feb 2018 15:28:10 +0900
Subject: [PATCH] erp5_real_time_inventory_accounting: Implement Production
 Packing List use case.

Same as IPL use case.
---
 ...ction_selectInventoryAssetPriceMovement.py |   2 +-
 ...accounting_stock_ledger_in_credit_path.xml |   2 +-
 ..._accounting_stock_ledger_in_debit_path.xml |   2 +-
 ...ccounting_stock_ledger_out_credit_path.xml |   2 +-
 ...accounting_stock_ledger_out_debit_path.xml |   2 +-
 .../registered_skin_selection.xml             |   6 +
 ...p5_real_time_inventory_accounting_test.xml |  21 +++
 .../ProductionPackingList_getRuleReference.py |   1 +
 ...ProductionPackingList_getRuleReference.xml |  62 +++++++
 ...ccountingStockLedgerInCreditDestination.py |   2 +-
 ...AccountingStockLedgerInDebitDestination.py |   2 +-
 ...oryAccountingStockLedgerOutCreditSource.py |   2 +-
 ...toryAccountingStockLedgerOutDebitSource.py |   2 +-
 ...st.erp5.testRealTimeInventoryAccounting.py | 154 ++++++++++++++++++
 .../template_registered_skin_selection_list   |   1 +
 15 files changed, 254 insertions(+), 9 deletions(-)
 create mode 100644 bt5/erp5_real_time_inventory_accounting_test/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml
 create mode 100644 bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/ProductionPackingList_getRuleReference.py
 create mode 100644 bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/ProductionPackingList_getRuleReference.xml
 create mode 100644 bt5/erp5_real_time_inventory_accounting_test/bt/template_registered_skin_selection_list

diff --git a/bt5/erp5_real_time_inventory_accounting/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting/AccountingTransaction_selectInventoryAssetPriceMovement.py b/bt5/erp5_real_time_inventory_accounting/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting/AccountingTransaction_selectInventoryAssetPriceMovement.py
index e56538a814..b8718b69b0 100644
--- a/bt5/erp5_real_time_inventory_accounting/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting/AccountingTransaction_selectInventoryAssetPriceMovement.py
+++ b/bt5/erp5_real_time_inventory_accounting/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting/AccountingTransaction_selectInventoryAssetPriceMovement.py
@@ -1,6 +1,6 @@
 kw['parent_specialise_reference'] = ['default_inventory_accounting_transaction_rule']
 kw['grand_grand_parent_specialise_reference'] = ['default_delivering_rule', 'default_delivery_rule']
-kw['explanation_portal_type'] = ['Sale Packing List', 'Purchase Packing List', 'Internal Packing List']
+kw['explanation_portal_type'] = ['Sale Packing List', 'Purchase Packing List', 'Internal Packing List', 'Production Packing List']
 kw['portal_type'] = 'Simulation Movement'
 kw['delivery_uid'] = None
 kw['left_join_list'] = ['delivery_uid']
diff --git a/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_in_credit_path.xml b/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_in_credit_path.xml
index e0ec552702..b99477f71b 100644
--- a/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_in_credit_path.xml
+++ b/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_in_credit_path.xml
@@ -114,7 +114,7 @@
         </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>
+            <value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Production Packing List Line\', \'Production Packing List Cell\', \'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>
diff --git a/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_in_debit_path.xml b/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_in_debit_path.xml
index 71f317ff1d..7d313ca3ea 100644
--- a/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_in_debit_path.xml
+++ b/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_in_debit_path.xml
@@ -110,7 +110,7 @@
         </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>
+            <value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Production Packing List Line\', \'Production Packing List Cell\', \'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>
diff --git a/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_out_credit_path.xml b/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_out_credit_path.xml
index dc7f7a8ad0..ec11d4a1cf 100644
--- a/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_out_credit_path.xml
+++ b/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_out_credit_path.xml
@@ -114,7 +114,7 @@
         </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>
+            <value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Production Packing List Line\', \'Production Packing List Cell\', \'Sale Packing List Line\', \'Sale Packing List Cell\', \'Internal Packing List Line\', \'Internal Packing List Cell\')</string> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
diff --git a/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_out_debit_path.xml b/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_out_debit_path.xml
index 06079a08fa..79c0193c6b 100644
--- a/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_out_debit_path.xml
+++ b/bt5/erp5_real_time_inventory_accounting_test/PathTemplateItem/business_process_module/bpm_hoge/inventory_accounting_stock_ledger_out_debit_path.xml
@@ -110,7 +110,7 @@
         </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>
+            <value> <string>python: context.getDeliveryValue() is not None and context.getDeliveryValue().getPortalType() in (\'Production Packing List Line\', \'Production Packing List Cell\', \'Sale Packing List Line\', \'Sale Packing List Cell\', \'Internal Packing List Line\', \'Internal Packing List Cell\')</string> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
diff --git a/bt5/erp5_real_time_inventory_accounting_test/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml b/bt5/erp5_real_time_inventory_accounting_test/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml
new file mode 100644
index 0000000000..72c89b7c03
--- /dev/null
+++ b/bt5/erp5_real_time_inventory_accounting_test/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml
@@ -0,0 +1,6 @@
+<registered_skin_selection>
+ <skin_folder_selection>
+  <skin_folder>erp5_real_time_inventory_accounting_test</skin_folder>
+  <skin_selection>View</skin_selection>
+ </skin_folder_selection>
+</registered_skin_selection>
\ No newline at end of file
diff --git a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test.xml b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test.xml
index c6a72eb259..a91e94c1dd 100644
--- a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test.xml
+++ b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test.xml
@@ -6,12 +6,33 @@
     </pickle>
     <pickle>
       <dictionary>
+        <item>
+            <key> <string>_local_properties</string> </key>
+            <value>
+              <tuple>
+                <dictionary>
+                  <item>
+                      <key> <string>id</string> </key>
+                      <value> <string>business_template_skin_layer_priority</string> </value>
+                  </item>
+                  <item>
+                      <key> <string>type</string> </key>
+                      <value> <string>float</string> </value>
+                  </item>
+                </dictionary>
+              </tuple>
+            </value>
+        </item>
         <item>
             <key> <string>_objects</string> </key>
             <value>
               <tuple/>
             </value>
         </item>
+        <item>
+            <key> <string>business_template_skin_layer_priority</string> </key>
+            <value> <float>99.0</float> </value>
+        </item>
         <item>
             <key> <string>id</string> </key>
             <value> <string>erp5_real_time_inventory_accounting_test</string> </value>
diff --git a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/ProductionPackingList_getRuleReference.py b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/ProductionPackingList_getRuleReference.py
new file mode 100644
index 0000000000..117c474afd
--- /dev/null
+++ b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/ProductionPackingList_getRuleReference.py
@@ -0,0 +1 @@
+return 'default_delivery_rule'
diff --git a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/ProductionPackingList_getRuleReference.xml b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/ProductionPackingList_getRuleReference.xml
new file mode 100644
index 0000000000..4b817e4e7d
--- /dev/null
+++ b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/ProductionPackingList_getRuleReference.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>ProductionPackingList_getRuleReference</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerInCreditDestination.py b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerInCreditDestination.py
index c4f1081d5e..9a4b3e0c16 100644
--- a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerInCreditDestination.py
+++ b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerInCreditDestination.py
@@ -3,7 +3,7 @@ assert delivery_portal_type # XXX debug
 if delivery_portal_type.startswith('Purchase Packing List'):
   if movement.getDestination() == 'organisation_module/supplier':
     return ['source/account_module/stock_parts_port']
-elif delivery_portal_type.startswith('Internal Packing List'):
+elif delivery_portal_type.startswith('Internal Packing List') or delivery_portal_type.startswith('Production Packing List'):
   if movement.getDestination() == 'organisation_module/park':
     return ['source/account_module/stock_car_park']
 else:
diff --git a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerInDebitDestination.py b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerInDebitDestination.py
index b5c6a62854..cfa833c5f3 100644
--- a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerInDebitDestination.py
+++ b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerInDebitDestination.py
@@ -3,7 +3,7 @@ assert delivery_portal_type # XXX debug
 if delivery_portal_type.startswith('Purchase Packing List'):
   if movement.getDestination() == 'organisation_module/supplier':
     return ['source/account_module/variation_parts']
-elif delivery_portal_type.startswith('Internal Packing List'):
+elif delivery_portal_type.startswith('Internal Packing List') or delivery_portal_type.startswith('Production Packing List'):
   return ['source/account_module/variation_cars']
 else:
   raise NotImplementedError
diff --git a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerOutCreditSource.py b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerOutCreditSource.py
index daa2b680fa..2c345a508a 100644
--- a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerOutCreditSource.py
+++ b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerOutCreditSource.py
@@ -3,7 +3,7 @@ assert delivery_portal_type # XXX debug
 if delivery_portal_type.startswith('Sale Packing List'):
   if movement.getSource() == 'organisation_module/hoge':
     return ['source/account_module/variation_cars']
-elif delivery_portal_type.startswith('Internal Packing List'):
+elif delivery_portal_type.startswith('Internal Packing List') or delivery_portal_type.startswith('Production Packing List'):
   return ['source/account_module/variation_cars']
 else:
   raise NotImplementedError
diff --git a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerOutDebitSource.py b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerOutDebitSource.py
index 4f23222386..ebb33ddaaf 100644
--- a/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerOutDebitSource.py
+++ b/bt5/erp5_real_time_inventory_accounting_test/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting_test/TradeModelPath_getInventoryAccountingStockLedgerOutDebitSource.py
@@ -3,7 +3,7 @@ assert delivery_portal_type # XXX debug
 if delivery_portal_type.startswith('Sale Packing List'):
   if movement.getSource() == 'organisation_module/hoge':
     return ['source/account_module/stock_car_park']
-elif delivery_portal_type.startswith('Internal Packing List'):
+elif delivery_portal_type.startswith('Internal Packing List') or delivery_portal_type.startswith('Production Packing List'):
   if movement.getSource() == 'organisation_module/workshop':
     return ['source/account_module/stock_car_workshop']
 else:
diff --git a/bt5/erp5_real_time_inventory_accounting_test/TestTemplateItem/portal_components/test.erp5.testRealTimeInventoryAccounting.py b/bt5/erp5_real_time_inventory_accounting_test/TestTemplateItem/portal_components/test.erp5.testRealTimeInventoryAccounting.py
index 2e53546aa3..8ecfd8a543 100644
--- a/bt5/erp5_real_time_inventory_accounting_test/TestTemplateItem/portal_components/test.erp5.testRealTimeInventoryAccounting.py
+++ b/bt5/erp5_real_time_inventory_accounting_test/TestTemplateItem/portal_components/test.erp5.testRealTimeInventoryAccounting.py
@@ -44,6 +44,9 @@ class TestRealTimeInventoryAccountingMixin:
   def stepSelectInternalPackingList1(self, sequence=None, sequence_list=None):
     sequence.edit(current_internal_packing_list=sequence['internal_packing_list_1'])
 
+  def stepSelectProductionPackingList1(self, sequence=None, sequence_list=None):
+    sequence.edit(current_production_packing_list=sequence['production_packing_list_1'])
+
   def _transitAndCheck(self, document, workflow_method_id, expected_state):
     from Products.DCWorkflow.DCWorkflow import ValidationFailed
     try:
@@ -99,6 +102,18 @@ class TestRealTimeInventoryAccountingMixin:
     packing_list = sequence['current_internal_packing_list']
     self._transitAndCheck(packing_list, 'stop_action', 'stopped')
 
+  def stepConfirmProductionPackingList(self, sequence=None, sequence_list=None):
+    packing_list = sequence['current_production_packing_list']
+    self._transitAndCheck(packing_list, 'confirm_action', 'confirmed')
+
+  def stepStartProductionPackingList(self, sequence=None, sequence_list=None):
+    packing_list = sequence['current_production_packing_list']
+    self._transitAndCheck(packing_list, 'start_action', 'started')
+
+  def stepStopProductionPackingList(self, sequence=None, sequence_list=None):
+    packing_list = sequence['current_production_packing_list']
+    self._transitAndCheck(packing_list, 'stop_action', 'stopped')
+
   def _checkAndGetCausalityRelated(self,
                                    document,
                                    causality_related_portal_type,
@@ -119,6 +134,10 @@ class TestRealTimeInventoryAccountingMixin:
     packing_list = sequence['current_internal_packing_list']
     self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 0)
 
+  def stepCheckAccountingTransactionNotGeneratedFromProductionPackingList(self, sequence=None, sequence_list=None):
+    packing_list = sequence['current_production_packing_list']
+    self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 0)
+
   def stepCheckThreeAccountingTransactionGeneratedFromSalePackingList(self, sequence=None, sequence_list=None):
     packing_list = sequence['current_sale_packing_list']
     accounting_transaction_list = self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 3)
@@ -134,6 +153,11 @@ class TestRealTimeInventoryAccountingMixin:
     accounting_transaction_list = self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 2)
     sequence.edit(current_accounting_transaction_list=accounting_transaction_list)
 
+  def stepCheckTwoAccountingTransactionGeneratedFromProductionPackingList(self, sequence=None, sequence_list=None):
+    packing_list = sequence['current_production_packing_list']
+    accounting_transaction_list = self._checkAndGetCausalityRelated(packing_list, 'Accounting Transaction', 2)
+    sequence.edit(current_accounting_transaction_list=accounting_transaction_list)
+
   def _checkDelivery(self,
                      delivery,
                      delivery_property_dict=None,
@@ -959,6 +983,136 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
     sequence_list.addSequenceString(sequence_str)
     sequence_list.play(self, quiet=0)
 
+  def stepTestProductionPackingList_create(self, sequence=None, sequence_list=None):
+    production_packing_list = self.portal.production_packing_list_module.newContent(
+      portal_type='Production Packing List',
+      specialise_value=self.portal.business_process_module.bpm_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)
+
+    production_packing_list.newContent(
+      portal_type='Production 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(production_packing_list_1=production_packing_list)
+
+  def stepTestProductionPackingList_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 testProductionPackingList(self):
+    sequence_list = SequenceList()
+    sequence_str = """
+      TestProductionPackingList_create
+      Tic
+      SelectProductionPackingList1
+      ConfirmProductionPackingList
+      Tic
+      StartProductionPackingList
+      Tic
+      StopProductionPackingList
+      Tic
+      CallBuilder
+      Tic
+      CheckTwoAccountingTransactionGeneratedFromProductionPackingList
+      TestProductionPackingList_checkAllAccountingTransaction
+      """
+    sequence_list.addSequenceString(sequence_str)
+    sequence_list.play(self, quiet=0)
+
+  def stepTestProductionPackingListNoPriceAndNoSupply_create(self, sequence=None, sequence_list=None):
+    production_packing_list = self.portal.production_packing_list_module.newContent(
+      portal_type='Production Packing List',
+      specialise_value=self.portal.business_process_module.bpm_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)
+
+    production_packing_list.newContent(
+      portal_type='Production 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(production_packing_list_1=production_packing_list)
+
+  def testProductionPackingListNoPriceAndNoSupply(self):
+    sequence_list = SequenceList()
+    sequence_str = """
+      TestProductionPackingListNoPriceAndNoSupply_create
+      Tic
+      SelectProductionPackingList1
+      ConfirmProductionPackingList
+      Tic
+      StartProductionPackingList
+      Tic
+      StopProductionPackingList
+      Tic
+      CallBuilder
+      Tic
+      CheckAccountingTransactionNotGeneratedFromProductionPackingList
+      """
+    sequence_list.addSequenceString(sequence_str)
+    sequence_list.play(self, quiet=0)
+
 import unittest
 def test_suite():
   suite = unittest.TestSuite()
diff --git a/bt5/erp5_real_time_inventory_accounting_test/bt/template_registered_skin_selection_list b/bt5/erp5_real_time_inventory_accounting_test/bt/template_registered_skin_selection_list
new file mode 100644
index 0000000000..bbdc59978d
--- /dev/null
+++ b/bt5/erp5_real_time_inventory_accounting_test/bt/template_registered_skin_selection_list
@@ -0,0 +1 @@
+erp5_real_time_inventory_accounting_test | View
\ No newline at end of file
-- 
2.30.9