[Erp5-report] r18793 - in /erp5/trunk/products/ERP5: Document/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jan 18 14:57:43 CET 2008


Author: jerome
Date: Fri Jan 18 14:57:43 2008
New Revision: 18793

URL: http://svn.erp5.org?rev=18793&view=rev
Log:
The simulation movement corresponding to the invoice transaction line should
have the order price currency as resource.


Modified:
    erp5/trunk/products/ERP5/Document/InvoiceTransactionRule.py
    erp5/trunk/products/ERP5/tests/testInvoice.py

Modified: erp5/trunk/products/ERP5/Document/InvoiceTransactionRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/InvoiceTransactionRule.py?rev=18793&r1=18792&r2=18793&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/InvoiceTransactionRule.py (original)
+++ erp5/trunk/products/ERP5/Document/InvoiceTransactionRule.py Fri Jan 18 14:57:43 2008
@@ -101,7 +101,7 @@
             delivery = simulation_movement.getDeliveryValue()
             if delivery is not None:
               resource = delivery.getProperty('price_currency', None)
-            if (resource is not None) and \
+            if (resource is None) and \
                (simulation_movement.getParentValue().getParentValue() \
                                       == portal_simulation) :
               # we are on the first simulation movement, we'll try

Modified: erp5/trunk/products/ERP5/tests/testInvoice.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInvoice.py?rev=18793&r1=18792&r2=18793&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInvoice.py (original)
+++ erp5/trunk/products/ERP5/tests/testInvoice.py Fri Jan 18 14:57:43 2008
@@ -1914,6 +1914,44 @@
           """)
     sequence_list.play(self, quiet=quiet)
 
+  def test_invoice_transaction_line_resource(self):
+    # tests that simulation movements corresponding to accounting line have a
+    # good resource in the simulation
+    
+    sequence_list = SequenceList()
+    sequence = sequence_list.addSequenceString('''
+      stepCreateEntities
+      stepCreateCurrency
+      stepCreateSaleInvoiceTransactionRule
+      stepCreateOrder
+      stepSetOrderProfile
+      stepSetOrderPriceCurrency
+      stepCreateNotVariatedResource
+      stepTic
+      stepCreateOrderLine
+      stepSetOrderLineResource
+      stepSetOrderLineDefaultValues
+      stepOrderOrder
+      stepTic
+    ''')
+    sequence_list.play(self, quiet=1)
+    order = sequence.get('order')
+    order_price_currency = order.getPriceCurrency()
+    self.assertNotEquals(None, order_price_currency)
+    related_applied_rule = order.getCausalityRelatedValue(
+                             portal_type='Applied Rule')
+    delivery_movement = related_applied_rule.contentValues()[0]
+    invoice_applied_rule = delivery_movement.contentValues()[0]
+    invoice_movement = invoice_applied_rule.contentValues()[0]
+    invoice_transaction_applied_rule = invoice_movement.contentValues()[0]
+    invoice_transaction_movement =\
+         invoice_transaction_applied_rule.contentValues()[0]
+    self.assertEquals(order_price_currency,
+          invoice_transaction_movement.getResource())
+    # TODO: price currency have to be copied on simulation movements too
+    # self.assertEquals(order_price_currency,
+    #      invoice_transaction_movement.getPriceCurrency())
+
 #class TestPurchaseInvoice(TestInvoice):
 #  order_portal_type = 'Purchase Order'
 #  order_line_portal_type = 'Purchase Order Line'




More information about the Erp5-report mailing list