[Erp5-report] r23757 - /erp5/trunk/products/ERP5/tests/testInvoice.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Sep 23 14:30:43 CEST 2008
Author: jerome
Date: Tue Sep 23 14:30:26 2008
New Revision: 23757
URL: http://svn.erp5.org?rev=23757&view=rev
Log:
tests invoice printing when sections have an empty logo
Modified:
erp5/trunk/products/ERP5/tests/testInvoice.py
Modified: erp5/trunk/products/ERP5/tests/testInvoice.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInvoice.py?rev=23757&r1=23756&r2=23757&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInvoice.py (original)
+++ erp5/trunk/products/ERP5/tests/testInvoice.py Tue Sep 23 14:30:26 2008
@@ -37,6 +37,7 @@
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
+from Products.ERP5OOo.OOoUtils import OOoParser
from AccessControl.SecurityManagement import newSecurityManager
from DateTime import DateTime
from Acquisition import aq_parent
@@ -663,6 +664,50 @@
if err_list:
self.fail(''.join(err_list))
+ def test_Invoice_viewAsODT_empty_image(self):
+ resource = self.portal.getDefaultModule(
+ self.resource_portal_type).newContent(
+ portal_type=self.resource_portal_type,
+ title='Resource',)
+ client = self.portal.organisation_module.newContent(
+ portal_type='Organisation', title='Client')
+ client_logo = client.newContent(portal_type='Image',
+ id='default_image')
+ vendor = self.portal.organisation_module.newContent(
+ portal_type='Organisation', title='Vendor')
+ vendor_logo = vendor.newContent(portal_type='Image',
+ id='default_image')
+ self.assertEquals(0, vendor_logo.getSize())
+ self.assertEquals(0, vendor.getDefaultImageWidth())
+ self.assertEquals(0, vendor.getDefaultImageHeight())
+ invoice = self.portal.getDefaultModule(self.invoice_portal_type).newContent(
+ portal_type=self.invoice_portal_type,
+ start_date=DateTime(2008, 12, 31),
+ title='Invoice',
+ source_value=vendor,
+ source_section_value=vendor,
+ destination_value=client,
+ destination_section_value=client)
+ line = invoice.newContent(portal_type=self.invoice_line_portal_type,
+ resource_value=resource,
+ quantity=10,
+ price=3)
+ invoice.confirm()
+ get_transaction().commit()
+ self.tic()
+
+ odt = invoice.Invoice_viewAsODT()
+ from Products.ERP5OOo.tests.utils import Validator
+ odf_validator = Validator()
+ err_list = odf_validator.validate(odt)
+ if err_list:
+ self.fail(''.join(err_list))
+
+ # the <draw:image> should not be present, because there's no logo
+ parser = OOoParser()
+ parser.openFromString(odt)
+ style_xml = parser.oo_files['styles.xml']
+ self.assert_('<draw:image' not in style_xml)
def test_invoice_building_with_cells(self):
# if the order has cells, the invoice built from that order must have
More information about the Erp5-report
mailing list