[Erp5-report] r33077 kazuhiko - in /erp5/trunk/products/ERP5: Document/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Feb 24 08:52:13 CET 2010
Author: kazuhiko
Date: Wed Feb 24 08:52:13 2010
New Revision: 33077
URL: http://svn.erp5.org?rev=33077&view=rev
Log:
minimise the configuratino of payment rule cell.
* one cell per predicate is enough
* no need to specify quantity
Modified:
erp5/trunk/products/ERP5/Document/PaymentSimulationRule.py
erp5/trunk/products/ERP5/tests/testAccountingRules.py
erp5/trunk/products/ERP5/tests/testInvoice.py
Modified: erp5/trunk/products/ERP5/Document/PaymentSimulationRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/PaymentSimulationRule.py?rev=33077&r1=33076&r2=33077&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/PaymentSimulationRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/PaymentSimulationRule.py [utf8] Wed Feb 24 08:52:13 2010
@@ -101,26 +101,28 @@
input_movement.getStartDate()
stop_date = payment_condition.getExpectedStopDate(input_movement) or \
input_movement.getStopDate()
+ kw.update({'start_date':start_date, 'stop_date':stop_date})
quantity = payment_condition.getExpectedQuantity(input_movement)
- for payment_rule_cell_line in cell.objectValues():
- prevision_line = kw.copy()
- prevision_line.update(
- source=payment_rule_cell_line.getSource() or \
- input_movement.getSource(),
- destination=payment_rule_cell_line.getDestination() or \
- input_movement.getDestination(),
- start_date=start_date,
- stop_date=stop_date,
- quantity=quantity * payment_rule_cell_line.getQuantity()
- )
- # Generate Prevision Script is required for Payment Simulation Rule?
- if payment_rule_cell_line.hasProperty(
- 'generate_prevision_script_id'):
- generate_prevision_script_id = \
- payment_rule_cell_line.getGeneratePrevisionScriptId()
- prevision_line.update(getattr(input_movement,
- generate_prevision_script_id)(prevision_line))
- prevision_list.append(prevision_line)
+
+ # one for payable
+ prevision_line = kw.copy()
+ prevision_line.update(
+ source=input_movement.getSource(),
+ destination=input_movement.getDestination(),
+ quantity=-quantity
+ )
+ prevision_list.append(prevision_line)
+ # one for cash, bank etc.
+ payment_rule_cell_line_list = cell.objectValues()
+ assert len(payment_rule_cell_line_list) == 1
+ payment_rule_cell_line = payment_rule_cell_line_list[0]
+ prevision_line = kw.copy()
+ prevision_line.update(
+ source=payment_rule_cell_line.getSource(),
+ destination=payment_rule_cell_line.getDestination(),
+ quantity=quantity
+ )
+ prevision_list.append(prevision_line)
return prevision_list
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
Modified: erp5/trunk/products/ERP5/tests/testAccountingRules.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccountingRules.py?rev=33077&r1=33076&r2=33077&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccountingRules.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testAccountingRules.py [utf8] Wed Feb 24 08:52:13 2010
@@ -88,8 +88,7 @@
payment_transaction_portal_type = "Payment Transaction"
payment_transaction_line_definition_list = (
- ('payable', None, None, -1.0),
- ('bank', 'account_module/bank', 'account_module/bank', 1.0)
+ ('bank', 'account_module/bank', 'account_module/bank'),
)
def getBusinessTemplateList(self):
@@ -538,10 +537,10 @@
self.assertEqual(len(cell_list), 1)
cell = cell_list[0]
- for line_id, line_source_id, line_destination_id, line_ratio in \
+ for line_id, line_source_id, line_destination_id in \
self.payment_transaction_line_definition_list:
line = cell.newContent(id=line_id,
- portal_type='Accounting Transaction Line', quantity=line_ratio,
+ portal_type='Accounting Transaction Line',
source=line_source_id,
destination=line_destination_id)
payment_rule.validate()
Modified: erp5/trunk/products/ERP5/tests/testInvoice.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInvoice.py?rev=33077&r1=33076&r2=33077&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInvoice.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testInvoice.py [utf8] Wed Feb 24 08:52:13 2010
@@ -78,8 +78,7 @@
)
payment_transaction_line_definition_list = (
- ('payable', None, None, -1.0),
- ('bank', 'account_module/bank', 'account_module/bank', 1.0)
+ ('bank', 'account_module/bank', 'account_module/bank'),
)
def getTitle(self):
@@ -195,10 +194,10 @@
self.assertEqual(len(cell_list), 1)
cell = cell_list[0]
- for line_id, line_source_id, line_destination_id, line_ratio in \
+ for line_id, line_source_id, line_destination_id in \
self.payment_transaction_line_definition_list:
line = cell.newContent(id=line_id,
- portal_type='Accounting Transaction Line', quantity=line_ratio,
+ portal_type='Accounting Transaction Line',
source=line_source_id,
destination=line_destination_id)
transaction.commit()
More information about the Erp5-report
mailing list