Commit c1fd1b6b authored by Julien Muchembled's avatar Julien Muchembled

Clean up and bugfixes to payroll

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@39295 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 675474cb
...@@ -49,7 +49,8 @@ class AmountGeneratorLine(MappedValue, XMLMatrix, Amount, ...@@ -49,7 +49,8 @@ class AmountGeneratorLine(MappedValue, XMLMatrix, Amount,
zope.interface.implements(interfaces.IAmountGeneratorLine) zope.interface.implements(interfaces.IAmountGeneratorLine)
# Declarative properties # Declarative properties
property_sheets = (PropertySheet.AmountGeneratorLine, ) property_sheets = (PropertySheet.DublinCore,
PropertySheet.AmountGeneratorLine)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCellAggregateKey') 'getCellAggregateKey')
......
...@@ -45,15 +45,8 @@ class PaymentCondition(TradeModelLine): ...@@ -45,15 +45,8 @@ class PaymentCondition(TradeModelLine):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.PaymentCondition
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Amount
, PropertySheet.PaymentCondition
, PropertySheet.Chain , PropertySheet.Chain
, PropertySheet.SortIndex
, PropertySheet.TradeModelLine
) )
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
......
...@@ -34,6 +34,11 @@ class PaymentCondition: ...@@ -34,6 +34,11 @@ class PaymentCondition:
""" """
_properties = ( _properties = (
{ 'id' : 'calculation_script_id',
'description' : 'If a script is defined on trade model Line, this '
'script will be used for calculation',
'type' : 'string',
'mode' : 'w' },
{ 'id' : 'payment_term', # XXX-JPS rename to business_term or trade_term { 'id' : 'payment_term', # XXX-JPS rename to business_term or trade_term
'description' : 'payment term in a number of days', 'description' : 'payment term in a number of days',
'type' : 'int', 'type' : 'int',
......
...@@ -58,6 +58,7 @@ class TestPayrollMixin(TestTradeModelLineMixin): ...@@ -58,6 +58,7 @@ class TestPayrollMixin(TestTradeModelLineMixin):
Tic Tic
""" + BUSINESS_PATH_CREATION_SEQUENCE_STRING """ + BUSINESS_PATH_CREATION_SEQUENCE_STRING
amount_generator_line_portal_type = 'Pay Sheet Model Line'
def getTitle(self): def getTitle(self):
return "Payroll" return "Payroll"
...@@ -66,6 +67,8 @@ class TestPayrollMixin(TestTradeModelLineMixin): ...@@ -66,6 +67,8 @@ class TestPayrollMixin(TestTradeModelLineMixin):
"""Prepare the test.""" """Prepare the test."""
TestTradeModelLineMixin.afterSetUp(self) TestTradeModelLineMixin.afterSetUp(self)
self.createCategories() self.createCategories()
self.fixed_quantity = self.setBaseAmountQuantityMethod('fixed_quantity',
"return lambda *args, **kw: 1")
@reindex @reindex
def beforeTearDown(self): def beforeTearDown(self):
...@@ -1421,6 +1424,8 @@ class TestPayrollMixin(TestTradeModelLineMixin): ...@@ -1421,6 +1424,8 @@ class TestPayrollMixin(TestTradeModelLineMixin):
trade_phase='payroll/france/labour', trade_phase='payroll/france/labour',
reference='model_without_ref', reference='model_without_ref',
resource_value=labour, resource_value=labour,
target_delivery=True,
base_application=self.fixed_quantity,
base_contribution_list=['base_amount/payroll/base/contribution', base_contribution_list=['base_amount/payroll/base/contribution',
'base_amount/payroll/report/salary/gross'], 'base_amount/payroll/report/salary/gross'],
quantity=10000.0) quantity=10000.0)
...@@ -1468,6 +1473,8 @@ class TestPayrollMixin(TestTradeModelLineMixin): ...@@ -1468,6 +1473,8 @@ class TestPayrollMixin(TestTradeModelLineMixin):
trade_phase='payroll/france/labour', trade_phase='payroll/france/labour',
reference='model_without_date', reference='model_without_date',
resource_value=labour, resource_value=labour,
target_delivery=True,
base_application=self.fixed_quantity,
base_contribution_list=['base_amount/payroll/base/contribution', base_contribution_list=['base_amount/payroll/base/contribution',
'base_amount/payroll/report/salary/gross'], 'base_amount/payroll/report/salary/gross'],
quantity=10000.0) quantity=10000.0)
...@@ -1547,6 +1554,8 @@ class TestPayrollMixin(TestTradeModelLineMixin): ...@@ -1547,6 +1554,8 @@ class TestPayrollMixin(TestTradeModelLineMixin):
trade_phase='payroll/france/labour', trade_phase='payroll/france/labour',
reference='check_model_date_validity_1', reference='check_model_date_validity_1',
resource_value=labour, resource_value=labour,
target_delivery=True,
base_application=self.fixed_quantity,
base_contribution_list=['base_amount/payroll/base/contribution', base_contribution_list=['base_amount/payroll/base/contribution',
'base_amount/payroll/report/salary/gross'], 'base_amount/payroll/report/salary/gross'],
quantity=20000, quantity=20000,
...@@ -1557,6 +1566,8 @@ class TestPayrollMixin(TestTradeModelLineMixin): ...@@ -1557,6 +1566,8 @@ class TestPayrollMixin(TestTradeModelLineMixin):
trade_phase='payroll/france/labour', trade_phase='payroll/france/labour',
reference='check_model_date_validity_2', reference='check_model_date_validity_2',
resource_value=labour, resource_value=labour,
target_delivery=True,
base_application=self.fixed_quantity,
base_contribution_list=['base_amount/payroll/base/contribution', base_contribution_list=['base_amount/payroll/base/contribution',
'base_amount/payroll/report/salary/gross'], 'base_amount/payroll/report/salary/gross'],
quantity=30000, quantity=30000,
......
...@@ -58,6 +58,7 @@ class TestTradeModelLineMixin(TestBPMMixin, UserDict): ...@@ -58,6 +58,7 @@ class TestTradeModelLineMixin(TestBPMMixin, UserDict):
base_unit_quantity = 0.01 base_unit_quantity = 0.01
node_portal_type = 'Organisation' node_portal_type = 'Organisation'
order_date = DateTime() order_date = DateTime()
amount_generator_line_portal_type = 'Trade Model Line'
def setBaseAmountQuantityMethod(self, base_amount_id, text): def setBaseAmountQuantityMethod(self, base_amount_id, text):
"""Populate TradeModelLine_getBaseAmountQuantityMethod shared script """Populate TradeModelLine_getBaseAmountQuantityMethod shared script
...@@ -77,7 +78,8 @@ class TestTradeModelLineMixin(TestBPMMixin, UserDict): ...@@ -77,7 +78,8 @@ class TestTradeModelLineMixin(TestBPMMixin, UserDict):
except KeyError: except KeyError:
base_amount = base_amount.newContent(base_amount_id).getRelativeUrl() base_amount = base_amount.newContent(base_amount_id).getRelativeUrl()
skin = self.portal.portal_skins.custom skin = self.portal.portal_skins.custom
script_id = 'TradeModelLine_getBaseAmountQuantityMethod' script_id = self.amount_generator_line_portal_type.replace(' ', '') \
+ '_getBaseAmountQuantityMethod'
test = "\nif base_application == %r:\n " % base_amount test = "\nif base_application == %r:\n " % base_amount
try: try:
old_text = '\n' + skin[script_id].body() old_text = '\n' + skin[script_id].body()
......
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