From a20dee7b7fecdb3790f966510979357d49e49cd9 Mon Sep 17 00:00:00 2001 From: Rafael Monnerat <rafael@nexedi.com> Date: Tue, 13 May 2008 19:49:22 +0000 Subject: [PATCH] [source|destination]_administation, [source|destination]_decision is copied on invoice throw Simulation git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20936 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/InvoicingRule.py | 8 +++-- product/ERP5/tests/testInvoice.py | 47 ++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/product/ERP5/Document/InvoicingRule.py b/product/ERP5/Document/InvoicingRule.py index 71ac412592..f6cb9ff5ee 100644 --- a/product/ERP5/Document/InvoicingRule.py +++ b/product/ERP5/Document/InvoicingRule.py @@ -90,9 +90,13 @@ class InvoicingRule(Rule): invoice_line = { 'source': context_movement.getSource(), 'source_section': context_movement.getSourceSection(), - 'destination': context_movement.getDestination(), + 'source_decision': context_movement.getSourceDecision(), + 'source_administration': context_movement.getSourceAdministration(), + 'destination': context_movement.getDestination(), 'destination_section': context_movement.getDestinationSection(), - 'start_date': context_movement.getStartDate(), + 'destination_decision': context_movement.getDestinationDecision(), + 'destination_administration': context_movement.getDestinationAdministration(), + 'start_date': context_movement.getStartDate(), 'stop_date': context_movement.getStopDate(), 'resource': context_movement.getResource(), 'variation_category_list': context_movement.getVariationCategoryList(), diff --git a/product/ERP5/tests/testInvoice.py b/product/ERP5/tests/testInvoice.py index 636954077c..77f71b6b70 100644 --- a/product/ERP5/tests/testInvoice.py +++ b/product/ERP5/tests/testInvoice.py @@ -532,6 +532,30 @@ class TestInvoice(TestPackingListMixin, self.assertEquals(round(line.getQuantity(), resource_precision), round(expected_price * line_ratio, resource_precision)) + def stepCheckPackingListInvoice( + self, sequence=None, sequence_list=None, **kw): + """ Checks if the delivery builder is working as expected, + coping the atributes from packing list to invoice.""" + packing_list = sequence.get('packing_list') + related_invoice_list = packing_list.getCausalityRelatedValueList( + portal_type=self.sale_invoice_transaction_portal_type) + self.assertEquals(len(related_invoice_list), 1) + invoice = related_invoice_list[0] + self.assertEquals(packing_list.getSource(), invoice.getSource()) + self.assertEquals(packing_list.getDestination(), invoice.getDestination()) + self.assertEquals(packing_list.getDestinationSection(), \ + invoice.getDestinationSection()) + self.assertEquals(packing_list.getSourceSection(), \ + invoice.getSourceSection()) + self.assertEquals(packing_list.getSourceDecision(), \ + invoice.getSourceDecision()) + self.assertEquals(packing_list.getDestinationAdministration(), \ + invoice.getDestinationAdministration()) + self.assertEquals(packing_list.getSourceAdministration(), \ + invoice.getSourceAdministration()) + + + def stepCheckDeliveryRuleForDeferred( self, sequence=None, sequence_list=None, **kw): """ Checks that a delivery rule has been created when we took 'split @@ -1914,6 +1938,29 @@ class TestInvoice(TestPackingListMixin, """) sequence_list.play(self, quiet=quiet) + def test_18_compareInvoiceAndPackingList(self, quiet=quiet, run=RUN_ALL_TESTS): + """ + Checks that a Simple Invoice is created from a Packing List + """ + if not run: return + if not quiet: + self.logMessage('Simple Invoice') + sequence_list = SequenceList() + for base_sequence in (self.PACKING_LIST_DEFAULT_SEQUENCE, ) : + sequence_list.addSequenceString( + base_sequence + + """ + stepSetReadyPackingList + stepTic + stepStartPackingList + stepCheckInvoicingRule + stepTic + stepCheckInvoiceBuilding + stepCheckInvoicesConsistency + stepCheckPackingListInvoice + """) + 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 -- 2.30.9