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,
zope.interface.implements(interfaces.IAmountGeneratorLine)
# Declarative properties
property_sheets = (PropertySheet.AmountGeneratorLine, )
property_sheets = (PropertySheet.DublinCore,
PropertySheet.AmountGeneratorLine)
security.declareProtected(Permissions.AccessContentsInformation,
'getCellAggregateKey')
......
......@@ -45,15 +45,8 @@ class PaymentCondition(TradeModelLine):
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Amount
, PropertySheet.PaymentCondition
property_sheets = ( PropertySheet.PaymentCondition
, PropertySheet.Chain
, PropertySheet.SortIndex
, PropertySheet.TradeModelLine
)
security.declareProtected(Permissions.AccessContentsInformation,
......
......@@ -34,6 +34,11 @@ class PaymentCondition:
"""
_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
'description' : 'payment term in a number of days',
'type' : 'int',
......
......@@ -58,6 +58,7 @@ class TestPayrollMixin(TestTradeModelLineMixin):
Tic
""" + BUSINESS_PATH_CREATION_SEQUENCE_STRING
amount_generator_line_portal_type = 'Pay Sheet Model Line'
def getTitle(self):
return "Payroll"
......@@ -66,6 +67,8 @@ class TestPayrollMixin(TestTradeModelLineMixin):
"""Prepare the test."""
TestTradeModelLineMixin.afterSetUp(self)
self.createCategories()
self.fixed_quantity = self.setBaseAmountQuantityMethod('fixed_quantity',
"return lambda *args, **kw: 1")
@reindex
def beforeTearDown(self):
......@@ -1421,6 +1424,8 @@ class TestPayrollMixin(TestTradeModelLineMixin):
trade_phase='payroll/france/labour',
reference='model_without_ref',
resource_value=labour,
target_delivery=True,
base_application=self.fixed_quantity,
base_contribution_list=['base_amount/payroll/base/contribution',
'base_amount/payroll/report/salary/gross'],
quantity=10000.0)
......@@ -1468,6 +1473,8 @@ class TestPayrollMixin(TestTradeModelLineMixin):
trade_phase='payroll/france/labour',
reference='model_without_date',
resource_value=labour,
target_delivery=True,
base_application=self.fixed_quantity,
base_contribution_list=['base_amount/payroll/base/contribution',
'base_amount/payroll/report/salary/gross'],
quantity=10000.0)
......@@ -1547,6 +1554,8 @@ class TestPayrollMixin(TestTradeModelLineMixin):
trade_phase='payroll/france/labour',
reference='check_model_date_validity_1',
resource_value=labour,
target_delivery=True,
base_application=self.fixed_quantity,
base_contribution_list=['base_amount/payroll/base/contribution',
'base_amount/payroll/report/salary/gross'],
quantity=20000,
......@@ -1557,6 +1566,8 @@ class TestPayrollMixin(TestTradeModelLineMixin):
trade_phase='payroll/france/labour',
reference='check_model_date_validity_2',
resource_value=labour,
target_delivery=True,
base_application=self.fixed_quantity,
base_contribution_list=['base_amount/payroll/base/contribution',
'base_amount/payroll/report/salary/gross'],
quantity=30000,
......
......@@ -58,6 +58,7 @@ class TestTradeModelLineMixin(TestBPMMixin, UserDict):
base_unit_quantity = 0.01
node_portal_type = 'Organisation'
order_date = DateTime()
amount_generator_line_portal_type = 'Trade Model Line'
def setBaseAmountQuantityMethod(self, base_amount_id, text):
"""Populate TradeModelLine_getBaseAmountQuantityMethod shared script
......@@ -77,7 +78,8 @@ class TestTradeModelLineMixin(TestBPMMixin, UserDict):
except KeyError:
base_amount = base_amount.newContent(base_amount_id).getRelativeUrl()
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
try:
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