changeset 4596:fe74214e17d3

Fix bug bug #59970: Dump when accessing Dentistry procedures reports
author Luis Falcon <falcon@gnuhealth.org>
date Fri, 12 Feb 2021 16:27:25 +0000
parents 860173a1b7c7
children dc33b3e665ba
files tryton/health_dentistry/report/procedures_report.fodt tryton/health_dentistry/report/procedures_report.py
diffstat 2 files changed, 19 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/tryton/health_dentistry/report/procedures_report.fodt
+++ b/tryton/health_dentistry/report/procedures_report.fodt
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <office:document xmlns:officeooo="http://openoffice.org/2009/office" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
- <office:meta><meta:initial-creator>lfm </meta:initial-creator><meta:creation-date>2011-06-15T19:12:18</meta:creation-date><dc:date>2021-01-09T02:46:08.877773330</dc:date><meta:editing-duration>P3DT10H7M51S</meta:editing-duration><meta:editing-cycles>93</meta:editing-cycles><meta:generator>LibreOffice/7.0.3.1$Linux_X86_64 LibreOffice_project/00$Build-1</meta:generator><meta:document-statistic meta:table-count="4" meta:image-count="0" meta:object-count="0" meta:page-count="2" meta:paragraph-count="21" meta:word-count="51" meta:character-count="645" meta:non-whitespace-character-count="613"/></office:meta>
+ <office:meta><meta:initial-creator>lfm </meta:initial-creator><meta:creation-date>2011-06-15T19:12:18</meta:creation-date><dc:date>2021-02-11T18:12:30.008908357</dc:date><meta:editing-duration>P3DT10H12M47S</meta:editing-duration><meta:editing-cycles>95</meta:editing-cycles><meta:generator>LibreOffice/7.0.3.1$Linux_X86_64 LibreOffice_project/00$Build-1</meta:generator><meta:document-statistic meta:table-count="4" meta:image-count="0" meta:object-count="0" meta:page-count="2" meta:paragraph-count="21" meta:word-count="50" meta:character-count="619" meta:non-whitespace-character-count="588"/></office:meta>
  <office:settings>
   <config:config-item-set config:name="ooo:view-settings">
-   <config:config-item config:name="ViewAreaTop" config:type="long">11</config:config-item>
+   <config:config-item config:name="ViewAreaTop" config:type="long">25518</config:config-item>
    <config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item>
    <config:config-item config:name="ViewAreaWidth" config:type="long">27210</config:config-item>
    <config:config-item config:name="ViewAreaHeight" config:type="long">10836</config:config-item>
@@ -16,9 +16,9 @@
      <config:config-item config:name="ViewLeft" config:type="long">10091</config:config-item>
      <config:config-item config:name="ViewTop" config:type="long">33001</config:config-item>
      <config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item>
-     <config:config-item config:name="VisibleTop" config:type="long">11</config:config-item>
+     <config:config-item config:name="VisibleTop" config:type="long">25518</config:config-item>
      <config:config-item config:name="VisibleRight" config:type="long">27208</config:config-item>
-     <config:config-item config:name="VisibleBottom" config:type="long">10844</config:config-item>
+     <config:config-item config:name="VisibleBottom" config:type="long">36352</config:config-item>
      <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
      <config:config-item config:name="ViewLayoutColumns" config:type="short">0</config:config-item>
      <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item>
@@ -85,7 +85,7 @@
    <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
    <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
    <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
-   <config:config-item config:name="Rsid" config:type="int">8447576</config:config-item>
+   <config:config-item config:name="Rsid" config:type="int">8507360</config:config-item>
    <config:config-item config:name="EmbeddedDatabaseName" config:type="string"/>
    <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
    <config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item>
@@ -143,7 +143,7 @@
  <office:styles>
   <style:default-style style:family="graphic">
    <style:graphic-properties svg:stroke-color="#000000" draw:fill-color="#99ccff" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/>
-   <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:font-independent-line-spacing="false">
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
     <style:tab-stops/>
    </style:paragraph-properties>
    <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="10pt" fo:language="es" fo:country="ES" style:letter-kerning="true" style:font-name-asian="DejaVu Sans" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="DejaVu Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
@@ -413,19 +413,16 @@
    <style:text-properties fo:color="#000000" loext:opacity="100%" style:font-name="Cantarell" officeooo:rsid="001d80de" officeooo:paragraph-rsid="0060221f"/>
   </style:style>
   <style:style style:name="P20" style:family="paragraph" style:parent-style-name="Table_20_Contents">
+   <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
+   <style:text-properties fo:color="#000000" loext:opacity="100%" style:font-name="Cantarell" fo:font-size="10pt" fo:font-weight="bold" officeooo:rsid="00b2781d" officeooo:paragraph-rsid="007fb33d" style:font-size-asian="10pt" style:font-weight-asian="bold" style:font-size-complex="10pt" style:font-weight-complex="bold"/>
+  </style:style>
+  <style:style style:name="P21" style:family="paragraph" style:parent-style-name="Table_20_Contents">
    <style:paragraph-properties fo:margin-top="0.0783in" fo:margin-bottom="0.0783in" style:contextual-spacing="false" fo:text-align="center" style:justify-single-word="false" style:shadow="none"/>
    <style:text-properties style:font-name="Cantarell" fo:font-size="12pt" officeooo:rsid="001d80de" officeooo:paragraph-rsid="001d80de" style:font-size-asian="12pt" style:font-size-complex="12pt"/>
   </style:style>
-  <style:style style:name="P21" style:family="paragraph" style:parent-style-name="Table_20_Contents">
-   <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
-   <style:text-properties fo:color="#000000" loext:opacity="100%" style:font-name="Cantarell" fo:font-size="10pt" fo:font-weight="bold" officeooo:rsid="00b2781d" officeooo:paragraph-rsid="007fb33d" style:font-size-asian="10pt" style:font-weight-asian="bold" style:font-size-complex="10pt" style:font-weight-complex="bold"/>
-  </style:style>
   <style:style style:name="P22" style:family="paragraph" style:parent-style-name="Frame_20_contents">
    <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
   </style:style>
-  <style:style style:name="P23" style:family="paragraph" style:parent-style-name="Standard">
-   <style:text-properties style:font-name="Cantarell"/>
-  </style:style>
   <style:style style:name="T1" style:family="text">
    <style:text-properties officeooo:rsid="001d80de"/>
   </style:style>
@@ -487,26 +484,24 @@
     <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
    </text:sequence-decls>
    <text:p text:style-name="P1"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;patient in records&quot;&gt;</text:placeholder></text:p>
-   <text:p text:style-name="P1"/>
-   <text:p text:style-name="P1"/>
    <table:table table:name="Tabla1" table:style-name="Tabla1">
     <table:table-column table:style-name="Tabla1.A"/>
     <table:table-column table:style-name="Tabla1.B"/>
-    <table:table-row table:style-name="TableLine94302506139104">
+    <table:table-row table:style-name="TableLine94582036597680">
      <table:table-cell table:style-name="Tabla1.A1" table:number-columns-spanned="2" office:value-type="string">
-      <text:p text:style-name="P20"><text:span text:style-name="T6">DENTISTRY PROCEDURES</text:span><text:span text:style-name="T4"> HISTORY</text:span></text:p>
+      <text:p text:style-name="P21"><text:span text:style-name="T6">DENTISTRY PROCEDURES</text:span><text:span text:style-name="T4"> HISTORY</text:span></text:p>
      </table:table-cell>
      <table:covered-table-cell/>
     </table:table-row>
-    <table:table-row table:style-name="TableLine94302445423664">
+    <table:table-row table:style-name="TableLine94582035430592">
      <table:table-cell table:style-name="Tabla1.A2" office:value-type="string">
-      <text:p text:style-name="P18"><text:span text:style-name="T1">Patient </text:span><text:span text:style-name="T10">:</text:span><text:span text:style-name="T10"><text:placeholder text:placeholder-type="text">&lt;patient.name.lastname&gt;</text:placeholder></text:span><text:span text:style-name="T10">, </text:span><text:span text:style-name="T10"><text:placeholder text:placeholder-type="text">&lt;patient.name.name&gt;</text:placeholder></text:span><text:span text:style-name="T10"><text:s/></text:span></text:p>
+      <text:p text:style-name="P18"><text:span text:style-name="T1">Patient </text:span><text:span text:style-name="T10">:</text:span><text:span text:style-name="T10"><text:placeholder text:placeholder-type="text">&lt;patient.rec_name&gt;</text:placeholder></text:span><text:span text:style-name="T10"> </text:span></text:p>
      </table:table-cell>
      <table:table-cell table:style-name="Tabla1.B2" office:value-type="string">
       <text:p text:style-name="P7"><text:span text:style-name="T7">PU</text:span><text:span text:style-name="T3">ID</text:span><text:span text:style-name="T1"> </text:span><text:span text:style-name="T3">:</text:span><text:span text:style-name="T5"><text:placeholder text:placeholder-type="text">&lt;patient.puid&gt;</text:placeholder></text:span></text:p>
      </table:table-cell>
     </table:table-row>
-    <table:table-row table:style-name="TableLine94302455629792">
+    <table:table-row table:style-name="TableLine94582036673760">
      <table:table-cell table:style-name="Tabla1.A2" office:value-type="string">
       <text:p text:style-name="P8"><text:span text:style-name="T2">Print </text:span><text:span text:style-name="T3">Date :</text:span><text:span text:style-name="T8"><text:placeholder text:placeholder-type="text">&lt;format_date(datetime.date.today(), user.language)&gt;</text:placeholder></text:span><text:span text:style-name="T8"> <text:s/></text:span><text:span text:style-name="T8"><text:placeholder text:placeholder-type="text">&lt;datetime.datetime.now().strftime(&apos;%H:%M:%S&apos;)&gt;</text:placeholder></text:span></text:p>
      </table:table-cell>
@@ -519,10 +514,10 @@
    <table:table table:name="Tabla4" table:style-name="Tabla4">
     <table:table-column table:style-name="Tabla4.A"/>
     <table:table-column table:style-name="Tabla4.B"/>
-    <table:table-row table:style-name="TableLine94302554534080">
+    <table:table-row table:style-name="TableLine94582036653344">
      <table:table-cell table:style-name="Tabla4.A1" office:value-type="string">
       <text:p text:style-name="P15">DMFT Index: <text:span text:style-name="T9"><text:placeholder text:placeholder-type="text">&lt;patient.dmft_index&gt;</text:placeholder></text:span></text:p>
-      <text:p text:style-name="P21"/>
+      <text:p text:style-name="P20"/>
      </table:table-cell>
      <table:table-cell table:style-name="Tabla4.B1" office:value-type="string">
       <text:p text:style-name="P16"><text:span text:style-name="T13"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;patient.use_primary_schema&quot;&gt;</text:placeholder></text:span>dmft index: <text:span text:style-name="T9"><text:placeholder text:placeholder-type="text">&lt;patient.dmft_index_primary&gt;</text:placeholder></text:span><text:span text:style-name="T12"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:span></text:p>
@@ -535,7 +530,7 @@
     <table:table-column table:style-name="Tabla2.B"/>
     <table:table-column table:style-name="Tabla2.C"/>
     <table:table-column table:style-name="Tabla2.D"/>
-    <table:table-row table:style-name="TableLine94302455781216">
+    <table:table-row table:style-name="TableLine94582036738448">
      <table:table-cell table:style-name="Tabla2.A1" office:value-type="string">
       <text:p text:style-name="P10">Procedure</text:p>
      </table:table-cell>
@@ -557,7 +552,7 @@
     <table:table-column table:style-name="Tabla3.B"/>
     <table:table-column table:style-name="Tabla3.C"/>
     <table:table-column table:style-name="Tabla3.D"/>
-    <table:table-row table:style-name="TableLine94302469022848">
+    <table:table-row table:style-name="TableLine94582036745968">
      <table:table-cell table:style-name="Tabla3.A1" office:value-type="string">
       <text:p text:style-name="P12"><text:placeholder text:placeholder-type="text">&lt;treatment[&apos;procedure&apos;] or &apos;&apos;&gt;</text:placeholder></text:p>
      </table:table-cell>
--- a/tryton/health_dentistry/report/procedures_report.py
+++ b/tryton/health_dentistry/report/procedures_report.py
@@ -43,23 +43,6 @@
                     })
         return result
 
-    # Odontogram
-    @classmethod
-    def plot_odontogram(cls):
-
-        report_dir = os.path.dirname(os.path.abspath(__file__))
-
-        filename = os.path.join(report_dir, 'odontogram_template.png')
-        im = Image.open(filename)
-        ImageDraw.floodfill(im, xy=(25, 7), value=(255, 0, 255), thresh=200)
-
-        holder = io.BytesIO()
-        im.save(holder, 'png')
-        im.save("result_odonto.png")
-        image_png = holder.getvalue()
-        holder.close()
-        return (image_png)
-
     @classmethod
     def get_context(cls, records, data):
         pool = Pool()
@@ -68,6 +51,5 @@
             records, data)
         context['today'] = Date.today()
         context['digest_treatments'] = cls.digest_treatments
-        context['patient_odontogram'] = cls.plot_odontogram()
 
         return context