Commit 6e8d5324 authored by Arnaud Fontaine's avatar Arnaud Fontaine

erp5_real_time_inventory_accounting: Implement Production Packing List use case.

Same as IPL use case.
parent 43efd567
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']
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
<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
......@@ -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>
......
<?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>
......@@ -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:
......
......@@ -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
......
......@@ -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
......
......@@ -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:
......
......@@ -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()
......
erp5_real_time_inventory_accounting_test | View
\ 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