Commit 1ece128d authored by Julien Muchembled's avatar Julien Muchembled

Bugfixes/updates in payroll and new amount generator

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@39110 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a121ee63
...@@ -103,7 +103,6 @@ ...@@ -103,7 +103,6 @@
<string>my_title</string> <string>my_title</string>
<string>my_reference</string> <string>my_reference</string>
<string>my_resource_title</string> <string>my_resource_title</string>
<string>my_calculation_script_id</string>
<string>my_price</string> <string>my_price</string>
<string>my_quantity</string> <string>my_quantity</string>
<string>my_trade_phase</string> <string>my_trade_phase</string>
...@@ -118,7 +117,6 @@ ...@@ -118,7 +117,6 @@
<string>my_variation_category_list</string> <string>my_variation_category_list</string>
<string>my_base_contribution_list</string> <string>my_base_contribution_list</string>
<string>my_base_application_list</string> <string>my_base_application_list</string>
<string>my_create_line</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -14,12 +14,9 @@ ...@@ -14,12 +14,9 @@
<value> <value>
<list> <list>
<string>description</string> <string>description</string>
<string>title</string>
<string>css_class</string>
<string>input_style</string>
<string>default</string>
<string>display_width</string> <string>display_width</string>
<string>precision</string> <string>precision</string>
<string>title</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -62,15 +59,13 @@ ...@@ -62,15 +59,13 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>default</string> </key> <key> <string>description</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -84,13 +79,17 @@ ...@@ -84,13 +79,17 @@
<item> <item>
<key> <string>precision</string> </key> <key> <string>precision</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -98,25 +97,25 @@ ...@@ -98,25 +97,25 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string>figure</string> </value>
</item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>The Base used to calculate the tax.</string> </value> <value> <string>The Base used to calculate the tax.</string> </value>
</item> </item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_float_field</string> </value> <value> <string>my_amount_generator_quantity</string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string>Base_viewPayrollFieldLibrary</string> </value> <value> <string>Base_viewFieldLibrary</string> </value>
</item> </item>
<item> <item>
<key> <string>input_style</string> </key> <key> <string>precision</string> </key>
<value> <string>-1 234.5</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
...@@ -133,22 +132,6 @@ ...@@ -133,22 +132,6 @@
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell is not None and cell.getProperty(\'quantity\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<tuple> <tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/> <global name="TALESMethod" module="Products.Formulator.TALESField"/>
...@@ -164,7 +147,7 @@ ...@@ -164,7 +147,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<tuple> <tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/> <global name="TALESMethod" module="Products.Formulator.TALESField"/>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_calculation_script_id</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>The script used to calculated the withhold amount for this line instead of the default script</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewPayrollFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Model Line Calculation Script</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_create_line</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Usefull for intermediated lines. By default, Pay Sheet Lines are created (checked).</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewPayrollFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create Line</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/isCreateLine</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -90,7 +90,6 @@ ...@@ -90,7 +90,6 @@
<list> <list>
<string>listbox_int_index</string> <string>listbox_int_index</string>
<string>listbox_float_index</string> <string>listbox_float_index</string>
<string>listbox_create_line</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -104,7 +103,6 @@ ...@@ -104,7 +103,6 @@
<string>my_source_section_title</string> <string>my_source_section_title</string>
<string>my_price_currency</string> <string>my_price_currency</string>
<string>my_specialise_title_list</string> <string>my_specialise_title_list</string>
<string>my_calculation_script_id</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -84,38 +84,10 @@ ...@@ -84,38 +84,10 @@
<key> <string>all_columns</string> </key> <key> <string>all_columns</string> </key>
<value> <value>
<list> <list>
<tuple>
<string>int_index</string>
<string>Payslip Order</string>
</tuple>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>resource_title</string>
<string>Service</string>
</tuple>
<tuple>
<string>reference</string>
<string>Reference</string>
</tuple>
<tuple>
<string>description</string>
<string>Description</string>
</tuple>
<tuple>
<string>create_line</string>
<string>Create Line</string>
</tuple>
<tuple> <tuple>
<string>trade_phase_title</string> <string>trade_phase_title</string>
<string>Trade Phase</string> <string>Trade Phase</string>
</tuple> </tuple>
<tuple>
<string>calculation_script_id</string>
<string>Calculation Script</string>
</tuple>
<tuple> <tuple>
<string>base_contribution_list</string> <string>base_contribution_list</string>
<string>Base Contribution</string> <string>Base Contribution</string>
...@@ -155,10 +127,6 @@ ...@@ -155,10 +127,6 @@
<string>description</string> <string>description</string>
<string>Description</string> <string>Description</string>
</tuple> </tuple>
<tuple>
<string>create_line</string>
<string>Create Line</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
...@@ -174,10 +142,6 @@ ...@@ -174,10 +142,6 @@
<string>int_index</string> <string>int_index</string>
<string>int_index</string> <string>int_index</string>
</tuple> </tuple>
<tuple>
<string>create_line</string>
<string>Create Line</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_create_line</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Usefull for intermediated lines. By default, Pay Sheet Lines are created (checked).</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewPayrollFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create Line</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>cell/isCreateLine</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_calculation_script_id</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>The script used to calculate the withhold amount for each line.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewPayrollFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Calculation Script</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -91,7 +91,6 @@ ...@@ -91,7 +91,6 @@
<value> <value>
<list> <list>
<string>my_specialise_title_list</string> <string>my_specialise_title_list</string>
<string>my_calculation_script_id</string>
<string>my_float_index</string> <string>my_float_index</string>
<string>my_int_index</string> <string>my_int_index</string>
</list> </list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_calculation_script_id</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>The script used to calculate the withhold amount for each line.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Calculation Script</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_view_mode_amount_generator_quantity</string> </value> <value> <string>my_amount_generator_quantity</string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
......
...@@ -28,11 +28,8 @@ ...@@ -28,11 +28,8 @@
############################################################################## ##############################################################################
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5.Document.TradeModelCell import TradeModelCell from Products.ERP5.Document.TradeModelCell import TradeModelCell
import zope.interface import zope.interface
class PaySheetModelCell(TradeModelCell): class PaySheetModelCell(TradeModelCell):
...@@ -51,4 +48,4 @@ class PaySheetModelCell(TradeModelCell): ...@@ -51,4 +48,4 @@ class PaySheetModelCell(TradeModelCell):
if not result: if not result:
if not self.hasCellContent(base_id='variation'): if not self.hasCellContent(base_id='variation'):
result = self.getVariationRangeBaseCategoryList() # The current resource variation result = self.getVariationRangeBaseCategoryList() # The current resource variation
return list(result) + ['trade_phase', 'base_contribution', 'quantity_unit'] return result + ['trade_phase', 'quantity_unit']
...@@ -152,7 +152,8 @@ class PaySheetTransaction(Invoice): ...@@ -152,7 +152,8 @@ class PaySheetTransaction(Invoice):
def updateAggregatedAmountList(self, *args, **kw): def updateAggregatedAmountList(self, *args, **kw):
amount_dict = dict(((x.getReference(), amount_dict = dict(((x.getReference(),
tuple(x.getVariationCategoryList())), x) tuple(x.getVariationCategoryList())), x)
for x in self.getAggregatedAmountList(*args, **kw)) for x in self.getAggregatedAmountList(*args, **kw)
if x.getResource())
movement_to_delete_list = [] movement_to_delete_list = []
for movement in self.getMovementList(): for movement in self.getMovementList():
if movement.getBaseApplication(): if movement.getBaseApplication():
......
...@@ -28,15 +28,11 @@ ...@@ -28,15 +28,11 @@
############################################################################## ##############################################################################
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5.Document.TradeModelLine import TradeModelLine from Products.ERP5.Document.TradeModelLine import TradeModelLine
from Products.ERP5.Document.MappedValue import MappedValue
import zope.interface import zope.interface
class TradeModelCell(TradeModelLine, MappedValue): class TradeModelCell(TradeModelLine):
"""Trade Model Line """Trade Model Line
""" """
meta_type = 'ERP5 Trade Model Cell' meta_type = 'ERP5 Trade Model Cell'
......
...@@ -182,7 +182,7 @@ ...@@ -182,7 +182,7 @@
<string>listbox_modification_date</string> <string>listbox_modification_date</string>
<string>listbox_creation_date</string> <string>listbox_creation_date</string>
<string>listbox_owner_title</string> <string>listbox_owner_title</string>
<string>my_view_mode_amount_generator_quantity</string> <string>my_amount_generator_quantity</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_view_mode_amount_generator_quantity</string> </value> <value> <string>my_amount_generator_quantity</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -209,7 +209,7 @@ class AmountGeneratorMixin: ...@@ -209,7 +209,7 @@ class AmountGeneratorMixin:
return return
# Try to collect cells and aggregate their mapped properties # Try to collect cells and aggregate their mapped properties
# using resource + variation as aggregation key or base_application # using resource + variation as aggregation key or base_application
# for intermediate lines # for intermediate lines.
amount_generator_cell_list = [self] + self.contentValues( amount_generator_cell_list = [self] + self.contentValues(
portal_type=amount_generator_cell_type_list) portal_type=amount_generator_cell_type_list)
cell_aggregate = {} # aggregates final line information cell_aggregate = {} # aggregates final line information
...@@ -249,6 +249,16 @@ class AmountGeneratorMixin: ...@@ -249,6 +249,16 @@ class AmountGeneratorMixin:
base_amount.setAmountGeneratorLine(self) base_amount.setAmountGeneratorLine(self)
for property_dict in cell_aggregate.itervalues(): for property_dict in cell_aggregate.itervalues():
# Ignore line (i.e. self) if cells produce unrelated amounts.
# With Transformed Resource (Transformation), line is considered in
# order to gather common properties and cells are used to describe
# varianted properties: only 1 amount is produced.
# In cases like trade, payroll or assorted resources,
# we want to ignore the line if they are cells.
# See also implementations of 'getCellAggregateKey'
causality_value = property_dict['causality_value_list'][-1]
if causality_value is self and len(cell_aggregate) > 1:
continue
base_application_set = property_dict['base_application_set'] base_application_set = property_dict['base_application_set']
# property_dict may include # property_dict may include
# resource - VAT service or a Component in MRP # resource - VAT service or a Component in MRP
...@@ -274,16 +284,15 @@ class AmountGeneratorMixin: ...@@ -274,16 +284,15 @@ class AmountGeneratorMixin:
if quantity_key in property_dict: if quantity_key in property_dict:
try: try:
quantity *= property_dict.pop(quantity_key) quantity *= property_dict.pop(quantity_key)
except ValueError: # None or '' except TypeError: # None or ''
pass pass
break break
if not quantity: if not quantity:
continue continue
# Create an Amount object # Create an Amount object
amount = newTempAmount(portal, amount = newTempAmount(portal,
# we only want the id to be unique # we only want the id to be unique so we pick a random causality
property_dict['causality_value_list'][0] causality_value.getRelativeUrl().replace('/', '_'))
.getRelativeUrl().replace('/', '_'))
amount._setCategoryList(property_dict.pop('category_list', ())) amount._setCategoryList(property_dict.pop('category_list', ()))
amount._edit( amount._edit(
quantity=quantity, quantity=quantity,
......
...@@ -34,7 +34,7 @@ from Products.ERP5Type.tests.utils import reindex ...@@ -34,7 +34,7 @@ from Products.ERP5Type.tests.utils import reindex
from DateTime import DateTime from DateTime import DateTime
import transaction import transaction
class TestPayrollMixin(ERP5ReportTestCase, TestTradeModelLineMixin): class TestPayrollMixin(TestTradeModelLineMixin):
BUSINESS_PATH_CREATION_SEQUENCE_STRING = """ BUSINESS_PATH_CREATION_SEQUENCE_STRING = """
CreateBusinessProcess CreateBusinessProcess
CreateBusinessLink CreateBusinessLink
...@@ -159,6 +159,17 @@ class TestPayrollMixin(ERP5ReportTestCase, TestTradeModelLineMixin): ...@@ -159,6 +159,17 @@ class TestPayrollMixin(ERP5ReportTestCase, TestTradeModelLineMixin):
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
return TestTradeModelLineMixin.getBusinessTemplateList(self) + ('erp5_payroll', ) return TestTradeModelLineMixin.getBusinessTemplateList(self) + ('erp5_payroll', )
def stepCreatePriceCurrency(self, sequence):
sequence.edit(price_currency = self.createResource('Currency',
title='Currency', base_unit_quantity=self.base_unit_quantity))
def stepCreateBusinessProcess(self, sequence):
sequence.edit(business_process=self.createBusinessProcess(title=self.id()))
def stepCreateBusinessLink(self, sequence):
business_process = sequence.get('business_process')
sequence.edit(business_link=self.createBusinessLink(business_process))
def createService(self): def createService(self):
module = self.portal.getDefaultModule(portal_type='Service') module = self.portal.getDefaultModule(portal_type='Service')
return module.newContent(portal_type='Service') return module.newContent(portal_type='Service')
...@@ -1078,14 +1089,10 @@ class TestPayrollMixin(ERP5ReportTestCase, TestTradeModelLineMixin): ...@@ -1078,14 +1089,10 @@ class TestPayrollMixin(ERP5ReportTestCase, TestTradeModelLineMixin):
model_line = self.createModelLine(model) model_line = self.createModelLine(model)
model_line.edit(title='intermediate line', model_line.edit(title='intermediate line',
int_index = 10, int_index = 10,
trade_phase='payroll/france/urssaf',
resource_value=sequence.get('urssaf_service'),
reference='intermediate_line', reference='intermediate_line',
variation_category_list=['contribution_share/employee', price=0.2,
'contribution_share/employer'],
base_contribution_list=['base_amount/payroll/base/income_tax'], base_contribution_list=['base_amount/payroll/base/income_tax'],
base_application_list=['base_amount/payroll/base/contribution'], base_application_list=['base_amount/payroll/base/contribution'])
create_line=False,)
sequence.edit(intermediate_model_line = model_line) sequence.edit(intermediate_model_line = model_line)
def stepModelCreateAppliedOnTaxModelLine(self, sequence=None, **kw): def stepModelCreateAppliedOnTaxModelLine(self, sequence=None, **kw):
...@@ -1105,20 +1112,6 @@ class TestPayrollMixin(ERP5ReportTestCase, TestTradeModelLineMixin): ...@@ -1105,20 +1112,6 @@ class TestPayrollMixin(ERP5ReportTestCase, TestTradeModelLineMixin):
base_application_list=['base_amount/payroll/base/income_tax']) base_application_list=['base_amount/payroll/base/income_tax'])
sequence.edit(model_line_applied_on_tax = model_line) sequence.edit(model_line_applied_on_tax = model_line)
def stepIntermediateModelLineCreateMovements(self, sequence=None,
**kw):
model_line = sequence.get('intermediate_model_line')
cell1 = model_line.newCell('contribution_share/employee',
portal_type='Pay Sheet Model Cell',
base_id='movement',
mapped_value_property_list=('quantity', 'price'))
cell1.edit(price=0.2, quantity=None, contribution_share='employee')
cell2 = model_line.newCell('contribution_share/employer',
portal_type='Pay Sheet Model Cell',
base_id='movement',
mapped_value_property_list=('quantity', 'price'))
cell2.edit(price=0.2, quantity=None, contribution_share='employer')
def stepAppliedOnTaxModelLineCreateMovements(self, sequence=None, **kw): def stepAppliedOnTaxModelLineCreateMovements(self, sequence=None, **kw):
model_line = sequence.get('model_line_applied_on_tax') model_line = sequence.get('model_line_applied_on_tax')
cell1 = model_line.newCell('contribution_share/employee', cell1 = model_line.newCell('contribution_share/employee',
...@@ -2071,7 +2064,6 @@ class TestPayroll(TestPayrollMixin): ...@@ -2071,7 +2064,6 @@ class TestPayroll(TestPayrollMixin):
Tic Tic
ModelCreateIntermediateModelLine ModelCreateIntermediateModelLine
ModelCreateAppliedOnTaxModelLine ModelCreateAppliedOnTaxModelLine
IntermediateModelLineCreateMovements
AppliedOnTaxModelLineCreateMovements AppliedOnTaxModelLineCreateMovements
CreateBasicPaysheet CreateBasicPaysheet
PaysheetCreateLabourPaySheetLine PaysheetCreateLabourPaySheetLine
......
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