[Erp5-report] r21585 - in /erp5/trunk/products/ERP5: Document/ PropertySheet/
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Jun 13 16:40:25 CEST 2008
Author: jerome
Date: Fri Jun 13 16:40:25 2008
New Revision: 21585
URL: http://svn.erp5.org?rev=21585&view=rev
Log:
Support a generate prevision script in the accounting rule cell line (other
changes in erp5_accounting in r21584 are required for this)
Added:
erp5/trunk/products/ERP5/PropertySheet/AccountingRuleCellLine.py
Modified:
erp5/trunk/products/ERP5/Document/InvoiceTransactionRule.py
Modified: erp5/trunk/products/ERP5/Document/InvoiceTransactionRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/InvoiceTransactionRule.py?rev=21585&r1=21584&r2=21585&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/InvoiceTransactionRule.py (original)
+++ erp5/trunk/products/ERP5/Document/InvoiceTransactionRule.py Fri Jun 13 16:40:25 2008
@@ -78,7 +78,7 @@
cell = self._getMatchingCell(context_movement)
if cell is not None : # else, we do nothing
- for transaction_line in cell.objectValues() :
+ for accounting_rule_cell_line in cell.objectValues() :
# get the resource (in that order):
# * resource from the invoice (using deliveryValue)
# * price_currency from the invoice
@@ -113,7 +113,7 @@
.getParentValue().getParentValue()
if resource is None :
# last resort : get the resource from the rule
- resource = transaction_line.getResource() or cell.getResource()
+ resource = accounting_rule_cell_line.getResource() or cell.getResource()
if resource in (None, '') :
# XXX this happen in many order, so this log is probably useless
LOG("InvoiceTransactionRule", PROBLEM,
@@ -121,15 +121,15 @@
# XXX Harcoded list
prevision_line = {
- 'id': transaction_line.getId(),
- 'source': transaction_line.getSource(),
+ 'id': accounting_rule_cell_line.getId(),
+ 'source': accounting_rule_cell_line.getSource(),
'source_section': context_movement.getSourceSection(),
'source_decision': context_movement.getSourceDecision(),
'source_administration': context_movement.getSourceAdministration(),
'source_project': context_movement.getSourceProject(),
'source_function': context_movement.getSourceFunction(),
'source_payment': context_movement.getSourcePayment(),
- 'destination': transaction_line.getDestination(),
+ 'destination': accounting_rule_cell_line.getDestination(),
'destination_section': context_movement.getDestinationSection(),
'destination_section': context_movement.getDestinationSection(),
'destination_decision': context_movement.getDestinationDecision(),
@@ -141,18 +141,24 @@
'stop_date': context_movement.getStopDate(),
'resource': resource,
# 'variation_category_list': \
-# transaction_line.getVariationCategoryList(),
+# accounting_rule_cell_line.getVariationCategoryList(),
# 'variation_property_dict': \
-# transaction_line.getVariationPropertyDict(),
-# 'aggregate_list': transaction_line.getAggregateList(),
-# 'price': transaction_line.getPrice(),
-# 'price_currency': transaction_line.getPriceCurrency(),
+# accounting_rule_cell_line.getVariationPropertyDict(),
+# 'aggregate_list': accounting_rule_cell_line.getAggregateList(),
+# 'price': accounting_rule_cell_line.getPrice(),
+# 'price_currency': accounting_rule_cell_line.getPriceCurrency(),
# calculate (quantity * price) * cell_quantity
'quantity': (context_movement.getCorrectedQuantity() *
- context_movement.getPrice(0.0)) * transaction_line.getQuantity(),
-# 'quantity_unit': transaction_line.getQuantityUnit(),
+ context_movement.getPrice(0.0)) * accounting_rule_cell_line.getQuantity(),
+# 'quantity_unit': accounting_rule_cell_line.getQuantityUnit(),
'force_update': 1,
}
+
+ if accounting_rule_cell_line.hasProperty('generate_prevision_script_id'):
+ generate_prevision_script_id = \
+ accounting_rule_cell_line.getGeneratePrevisionScriptId()
+ prevision_line.update(getattr(context_movement,
+ generate_prevision_script_id)(prevision_line))
prevision_list.append(prevision_line)
return prevision_list
Added: erp5/trunk/products/ERP5/PropertySheet/AccountingRuleCellLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/AccountingRuleCellLine.py?rev=21585&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/AccountingRuleCellLine.py (added)
+++ erp5/trunk/products/ERP5/PropertySheet/AccountingRuleCellLine.py Fri Jun 13 16:40:25 2008
@@ -1,0 +1,41 @@
+##############################################################################
+#
+# Copyright (c) 2008 Nexedi SA and Contributors. All Rights Reserved.
+# Jerome Perrin <jerome at nexedi.com>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+##############################################################################
+
+
+class AccountingRuleCellLine:
+ """Properties for Accounting Rule Cell Lines
+ """
+ _properties = (
+ { 'id': 'generate_prevision_script_id',
+ 'description': 'ID of a script used to generate prevision',
+ 'type': 'string',
+ 'mode': 'w',
+ },
+
+ )
+
More information about the Erp5-report
mailing list