def serialize_to_xml(self, **kwargs): reporting_period = kwargs.get('reporting_period', None) from koalixcrm.djangoUserExtension.models import UserExtension objects = [self, ] objects += UserExtension.objects_to_serialize(self, self.project_manager) main_xml = PDFExport.write_xml(objects) for task in Task.objects.filter(project=self.id): task_xml = task.serialize_to_xml(reporting_period=reporting_period) main_xml = PDFExport.merge_xml(main_xml, task_xml) main_xml = PDFExport.append_element_to_pattern(main_xml, "object/[@model='crm.project']", "Effective_Effort_Overall", self.effective_costs(reporting_period=None)) if reporting_period: main_xml = PDFExport.append_element_to_pattern(main_xml, "object/[@model='crm.project']", "Effective_Effort_InPeriod", self.effective_costs(reporting_period=reporting_period)) main_xml = PDFExport.append_element_to_pattern(main_xml, "object/[@model='crm.project']", "Planned_Effort", self.planned_costs()) main_xml = PDFExport.append_element_to_pattern(main_xml, "object/[@model='crm.project']", "Effective_Duration", self.effective_duration()) main_xml = PDFExport.append_element_to_pattern(main_xml, "object/[@model='crm.project']", "Planned_Duration", self.planned_duration()) return main_xml
def serialize_to_xml(self, **kwargs): reporting_period = kwargs.get('reporting_period', None) from koalixcrm.djangoUserExtension.models import UserExtension objects = [self, ] objects += UserExtension.objects_to_serialize(self, self.project_manager) main_xml = PDFExport.write_xml(objects) for task in Task.objects.filter(project=self.id): task_xml = task.serialize_to_xml(reporting_period=reporting_period) main_xml = PDFExport.merge_xml(main_xml, task_xml) main_xml = PDFExport.append_element_to_pattern(main_xml, "object/[@model='crm.project']", "Effective_Effort_Overall", self.effective_costs(reporting_period=None)) if reporting_period: main_xml = PDFExport.append_element_to_pattern(main_xml, "object/[@model='crm.project']", "Effective_Effort_InPeriod", self.effective_costs(reporting_period=reporting_period)) main_xml = PDFExport.append_element_to_pattern(main_xml, "object/[@model='crm.project']", "Planned_Effort", self.planned_costs()) main_xml = PDFExport.append_element_to_pattern(main_xml, "object/[@model='crm.project']", "Effective_Duration", self.effective_duration()) main_xml = PDFExport.append_element_to_pattern(main_xml, "object/[@model='crm.project']", "Planned_Duration", self.planned_duration()) return main_xml
def serialize_to_xml(self): from koalixcrm.crm.contact.contact import PostalAddressForContact from koalixcrm.crm.contact.postaladdress import PostalAddress from koalixcrm.crm.product.currency import Currency from koalixcrm.crm.contact.contact import Contact from django.contrib import auth objects = [self, ] position_class = koalixcrm.crm.documents.salesdocumentposition.SalesDocumentPosition objects += list(koalixcrm.crm.documents.salesdocument.SalesDocument.objects.filter(id=self.id)) if isinstance(self, koalixcrm.crm.documents.purchaseorder.PurchaseOrder): objects += list(Contact.objects.filter(id=self.supplier.id)) objects += list(PostalAddressForContact.objects.filter(person=self.supplier.id)) for address in list(PostalAddressForContact.objects.filter(person=self.supplier.id)): objects += list(PostalAddress.objects.filter(id=address.id)) else: objects += list(Contact.objects.filter(id=self.customer.id)) objects += list(PostalAddressForContact.objects.filter(person=self.customer.id)) for address in list(PostalAddressForContact.objects.filter(person=self.customer.id)): objects += list(PostalAddress.objects.filter(id=address.id)) objects += list(TextParagraphInSalesDocument.objects.filter(sales_document=self.id)) objects += list(Currency.objects.filter(id=self.currency.id)) objects += SalesDocumentPosition.add_positions(position_class, self) objects += list(auth.models.User.objects.filter(id=self.staff.id)) objects += UserExtension.objects_to_serialize(self, self.staff) main_xml = PDFExport.write_xml(objects) return main_xml
def serialize_to_xml(self): from koalixcrm.djangoUserExtension.models import UserExtension objects = [ self, ] objects += UserExtension.objects_to_serialize(self, self.project_manager) main_xml = PDFExport.write_xml(objects) for task in Task.objects.filter(project=self.id): task_xml = task.serialize_to_xml() main_xml = PDFExport.merge_xml(main_xml, task_xml) main_xml = PDFExport.append_element_to_pattern( main_xml, "object/[@model='crm.project']", "Effective_Effort", self.effective_effort()) main_xml = PDFExport.append_element_to_pattern( main_xml, "object/[@model='crm.project']", "Planned_Effort", self.planned_effort()) main_xml = PDFExport.append_element_to_pattern( main_xml, "object/[@model='crm.project']", "Effective_Duration", self.effective_duration()) main_xml = PDFExport.append_element_to_pattern( main_xml, "object/[@model='crm.project']", "Planned_Duration", self.planned_duration()) return main_xml